Japanese Language Study, 4 Year Progress

It’s currently September 2020, which means that I’ve been studying Japanese for over 4 years now. Woah.

I started studying it in August of 2016 simply because I had too much free time on my hands and I was interested in the Japanese gaming industry. I didn’t really think too much of Anime or Japanese culture, I just found myself in my room one night writing hiragana characters in my notebook over and over and over and over and over and over and over again until their pronunciation stuck with me and I was able to read them in an instant.

The first year of learning a language makes you feel like a toddler all over again. You have limited resources that you can use to accurately express yourself and you can spend up to 10 seconds trying to read one particular word. And like babies, we use our tiny underdeveloped vocabularies to deliver convoluted ways of saying things that native speakers can express in 4 words or less. It’s a very frustrating stage of learning a language and can leave you feeling discouraged.

It’s amazing when I look back at my Japanese language skills from only 2 years ago and compare them to my skills now. While I’m certainly nowhere near fluent, I can speak at a basic conversational level where I can express my thoughts and have them understood and I can (usually) understand what other people are trying to say. Had I actually been living in Japan for these last 4 years, I think my language skills would have developed much faster, but alas, I’m stuck here in America where the most I can hope for is long-distance communication between Japanese friends and exposing myself to cultural influences.

Being self-taught, I was at a bit of a disadvantage for resources compared to someone who might have taken a college course on the language. I definitely would not be anywhere nearly as proficient as I am now without making Japanese friends or constantly grinding on practice material. I highly recommend watching Ken Shimura’s Daijoubuda on YouTube. It comes with Japanese subtitles so it’s great for improving your listening comprehension.

So, being proficient enough to understand everyday casual Japanese, where are my weak points right now? I’d say I have a fairly good grasp on grammar; despite being almost completely backwards from English, I rarely ever stutter to comprehend the difference word orders and even the more colloquial patterns where they intentionally leave sentences incomplete. My biggest struggle at the moment is probably just vocabulary.

Japanese has 3 different systems of writing: Hiragana, Katakana and Kanji. While Hiragana and Katakana are both entirely phonetic and easy to read at the beginner level, Kanji refers to the special characters borrowed from the Chinese language and they all have up to 2, 3 or sometimes even 5 different pronunciations depending on the context. This can be a big obstacle in expanding your vocabulary, and honestly the concept of Kanji in general is a huge turn-off for newcomers.

It’s not usually a wise idea to rely on Google Translate to expand your vocabulary, considering that it makes too many assumptions about the context and only gives you a translation without an explanation. I personally use a site called Jisho.org. “Jisho” is Japanese for “Dictionary” and that’s exactly what this site is. It will give you a list of all possible Japanese words that could match your input, along with definitions that explain their subtle difference, and an indicator of how common that word is.

Unfortunately, opening up a web browser all the time and then going to “jisho.org” and typing stuff in English every time I’m stuck in the middle of a sentence is a bit of an inconvenience for me. I recently developed a simple Python script that interacts with Jisho’s public API, meaning that all I have to do now is open up a terminal and type in whatever word I need to know. And it doesn’t tell me anything more than what I need. Just the pronunciation of the Kanji, the definition of the word and whether or not it’s common.

Yeah, I use an Inspiron. Don’t bully.

It’s also great for inputting Japanese words and getting a more in-depth translation, along with a pronunciation.

Here’s a github link. https://github.com/GavynBryan/QuickJapanese Although it’s incredibly easy to code one for yourself. I’ll find this quite useful when I’m on Japanese internet chatrooms and I’m lost on how to read a kanji. I think I’m going to go study some more Japanese. Maybe I’ll get back to you guys in 4 more years and we’ll how much I’ve improved since. 🙂

New Small Project: Running Gun

I participated in the 9-day Game Jam on itch.io https://gavynb.itch.io/running-gun

Screenshot of Running Gun at low health, 2 scorpions

This is a game that I had to make within 9 days. The rules of the jam totally permitted me to use a premade engine, but I wanted to challenge myself and work from scratch. So, this was made in about 9 days using C++ and SFML. In the game, you play as a cowboy named Marty, who has to shoot down a demonic bull who makes it rain scorpions. During the first 2 days of the jam, I had a general idea of what I wanted to make: A wild west side scrolling shooter. My first idea was to have a cowboy chase somebody on horseback while they throw exploding barrels at him and he has to jump over other obstacles. But, by the time I had finished a good portion of my codebase, this seemed a bit difficult to pull of within my remaining time frame.

That’s not to say I worked slow. While I didn’t have a complete, solid design for my game quite yet, I spent about 2-3 days working on an entity component system and other “management” frameworks to handle things like animations and physics. Which was actually my first time doing all that from absolute scratch. The screenshot below shows the fruition of 2 days of hard work.

I was actually so happy to see that face when my project finally successfully loaded. It’s one thing to load up a sprite through a short series of commands, but loading up a sprite after you write a <Key, Value> Resource Map, Entity Component System and proper layering system is a different story. In just one silly little picture, you get proof that all your hard work is finally coming to fruition.

After that, the next thing I had to do was create and test a proper input/physics system. I attached a PhysicsComponent and PlayerController to the yellow dude, and allowed him to spawn another yellow dude when the space bar was pressed. After that, I got proof that gravity was working and my system of “queuing entities” to be added to the world didn’t have problems with the game loop.

Then I figured it was time to test collision and finally get things going in the graphical department; considering there was only such a short amount of time left. I added a red ball to the world so I could write a console output “Hit!” every time the two collided. I used a “tagging” method of collision detection, similar to Unity, so I could avoid type casting.

The ball actually stayed in there longer than I was expecting, I still needed to test out some various patterns and other components. It’s not like I wanted him in the final game or anything. It was around this point that the design for the game had solidified, as I released chasing a horse probably couldn’t be done within the timeframe I needed.

If I had any regrets about this project, it may be that the codebase was very big. It’s a simple arcade game that can be beaten in less than a minute, yet it features about 20 files of code (for both source and header files). I’ve seen SFML Mario clones that only have about 10 files. For a small project like this, I don’t think polymorphism in favor of “composition” is a bad idea at all. Programming patterns are great, but they’re best used for games where the project’s code would already be too big without them.

I also had to cut some corners during the last few days, hacking together code that “works” even if it’s symptomatic of a larger problem or it’s ugly to look at. Let’s just say I understand now when games have tons of cut content and some weird bugs upon release. Despite that, I will likely be using some of the code from Running Gun as a framework for future projects, but I have some cleaning to do before I want to use it again! I hope you enjoy the brief minute of gameplay that Running Gun has to offer, hopefully I’ll be back soon with some more fun projects!

Binary Buttons

Being self taught for 10 years and beginning formal education in Computer Science, I have learned much more than I was expecting to, including the math behind binary numbers. And while it might seem like useless information at first glance, I’m actually glad I learned it because understanding binary to a certain degree means that you also understand how much memory numbers take up, and it also its foundations in the basic abstractions of computing: by default, things are either on or off. You can’t exactly send the number “37” through an electrical signal and expect a computer to process it. What’s actually happening deep down is a series of simple “yes/no” logic gates, and they all add up to the complexity that we know as modern computers.

To help other people better understand how simple “on/off” switches add up to make a number (and to hone my JavaScript skills) I’ve created a simple webapp using React. You can press the corresponding buttons to toggle each number to 1 or 0 (on or off).

https://gavynbryan.github.io/BinaryButtons/

It’s pretty ugly, but I never claimed to be a competent UI designer

I designed it with the assumption that you already know the basics of how the math works, but just in case this article shows up in a Google search, I’ll give a quick explanation. Binary numbers are actually best read from right to left. Each number adds 2, to the power of whatever column it’s in, starting with zero. So, the rightmost column, would be 2^0, if it were activated. That would be 1. The leftmost number here it’s the 8th column. But, because the columns start with 0, it would actually be 2^7, which is 128. Therefore, if you had 10000001, it would equal 129.

If it sounds confusing to you, then don’t worry. It also took me a minute or two of thinking before things clicked and I said, “I get it now!”. That’s why I built this app, to create a visual and interactive demonstration that you can use for yourself, so it will take other people less than a minute or two. I hope future CS students find this useful.

How I programmed it

I used React, which is a JavaScript library for making UI development much easier. There were 2 reasons I used JS.

  1. I wanted the app to be lightweight and web-based.
  2. I needed practice because I don’t use JavaScript very often

It’s not usually my go-to language when making things, I much prefer using C++, C# or Python. However it has become a very common language now that things are becoming mobile/cloud-based and I think that brushing up on it would help maintain relevance in the job market.

I initialized an array of size 8, filling it all with 0s as default values. These do not directly point to the columns displayed on the page, but instead (inversely) represent their place and allow me to do the math directly from the core of the app as opposed to collecting a bunch of values stored inside of other objects.

Per click on the buttons, the corresponding columns[] index is changed to either 1 or 0, and I call the calculate() function. The calculate function iterates through every value in the array. Notice how I set the exponent to 7 minus the index of the for loop. This is because I chose to write the columns from left to right and the binary math actually works from right to left. So when the for loop is on column #0, the app will bring 2 to the power of 7, multiplied by either 1 or 0. This adds up to the total, after which it’s rendered to the screen.

Back to the Basics

I’ve been programming since I was in middle school, with the intention of being a game programmer. At the time of writing this, I am 22 years old and I’m fairly confident in my ability to develop a presentable game in something like Unity. Except engines like Unity aren’t where I learned how to code.

Back in 2009, there weren’t quite as many helpful resources for an 11 year old kid to learn about game programming. There were some pretty cool engines like Blitz and GameMaker, but I didn’t want to make those kinds of games. I wanted to make the real stuff, I wanted to make games that could compete with the likes of Oblivion and Half-Life 2! Most of the resources I found lead me to study C++, and I gave up as soon as my attempt to build a “Hello World!” application failed. I managed to take a deep breath and consider starting small, first with GameMaker. Then I built my very first game, Ball Fighter.

And what a visual beauty it was

This game can be beaten in 10 seconds and took me about 3 weeks to make. I had no programming knowledge at the time and even back then I wasn’t quite satisfied with how it turned out. Neither was the YoYoGames community; in fact one person very strongly voiced his opinion that it was probably the worst game he had ever played. I promised everyone a sequel with more effort put into it within a year, but I got distracted by other things.

Fast forward a few years, after familiarizing myself with more programming concepts in easier languages, I decide to actually pick up a book on C++. From there, I programmed a few short “choose your own adventure” text games that I was fairly proud of at the time, but never published. After a couple more years of switching between premade engines and working from scratch, I finally managed to find a good resource for creating a game framework from scratch in SFML2. I followed the book and then started going my own way so I could experiment with things like the update loop and rendering order. It was good to know how these things actually worked, but I just could never manage to finish a project.

Finally, I decided to go back to the basics with the knowledge I have now. I’m a C++ programmer, I knew how the update loop in a game works and what goes on under the hood, I was aware of common game programming patterns. I thought, “Why not make that sequel to Ball Fighter, the way I originally wanted it to be?”

First I had to familiarize myself with the engine. And hey, what a lucky coincidence that Ball Fighter was originally intended to be a roll-a-ball game, while the most basic Unity tutorial was for roll-a-ball? 😉 After finishing the tutorial, I customized things for my own needs and turned the game into what 11 year old me was trying to make: A game where you roll around as a ball and fight bosses. Except with my developed sensibilities of challenge and level design structure. And my developed understanding of how game engines work.

Which brings me to talk about another issue. How many gamers first boot up an indie game and then sigh when they first see this, knowing that the game is probably going to run at 24 FPS and be full of unnecessary post-processing effects?

Unity Logo White Png Black And White Stock - Unity 3d - Free ...

Unfortunately, while game development has gotten a lot more accessible, we have not yet removed the necessity to understand how games operate on a technical level. Many aspiring game developers these days will start with either Unity or Unreal Engine 4, completely unrestrained by their lack of knowledge. Which means that they do things that are extremely performance costly, or follow really convoluted programming patterns that are helpful in the long run.

And it’s unfortunate because these are actually some very powerful engines in the hands of people who know what they are doing. The problem is you can’t really know what you’re doing until you know what the engine is doing. I’m not proud that it took me so long to become a competent programmer, but I’m glad that I experienced low-level development before sticking with the higher level stuff. I think everyone programming potentially resource-intensive applications should take some time to create things from scratch before trying to use somebody else’ tools. Think of it like learning to ride a bike without training wheels, but then you install training wheels that make your bike go even faster. (Also, pretend like there’s no social stigma around using training wheels)

Overall, I think as a developer, it’s your responsibility to master the toolset you’re working with. The toolset shouldn’t master you. I believe most people learn best with hands-on experience and there’s nothing more hands on than trying to recreate something you’re working with. Even if it’s not anything presentable, I’d encourage you to make your own engine before sticking with Unity; it never hurts to be overpowered.

Oh, hey. Some physicist condensed my entire blogpost into a single quote about 50 years ago.

“What I Cannot Create, I Do Not Understand”

Richard Feynman

Just goes to show you that Computer Science is still science.

An accessible intro to pointers

I’m not satisfied with how many online resources and tutorials explain pointers, so I wrote my own guide with a simple and straight-to-the-point explanation that’s easy to follow. I’m prioritizing quality over quantity here. This is my first time doing a “coding tutorial” or anything similar so my apologies if it’s a little scattered.

https://github.com/GavynBryan/SimplePointers