Gengo Girls #8: English Has Lots Of Exceptions

Gengo Girls #8: English Has Lots Of Exceptions

Next Comic >>

<< Previous Comic

It’s easy to make fun of English for having lots of strange grammar exceptions and weird spellings, but it really isn’t that much worse than your average language.

Also, here’s a fun thought: America was named after the explorer Amerigo Vespucci. Which means there was a very real chance it could have been called “Vespuccica” instead.

Vocabulary

アメリカ = America

イングランド = England

英語 = えいご = English

Transcript

言語ガールズ #8

English Has Lots Of Exceptions

Yellow: So languages are just a country name followed by ?

Blue: That’s the pattern.

Yellow: So then we speak アメリカ語?

Blue: You do know that we speak English not “American”, right?

Yellow: Maybe you do…

Yellow: Fine then. Does that mean that English is イングランド語

Blue: That’s a very logical guess. But it’s wrong.

Blue: English is actually 英語. It doesn’t follow the pattern 100%.

Yellow: So English has weird grammar rules even in other languages…

Gengo Girls #7: Go, Go Gengo Rangers!

Gengo Girls #7: Go, Go Gengo Rangers!

Next Comic >>

<< Previous Comic

Here’s a comic to test how many of you actually went ahead an memorized the katakana along with the hiragana. You’ll be the ones who recognize スペイン as “supein” (Spain) and フランス as “furansu” (France).

Also, I’ve been thinking and it seems to me that “Genki Gengo Girls” is too long of a title to just roll of the tongue. So from now on this comic is just “Gengo Girls”. Much catchier, isn’t it? I’ll eventually get around to editing the first six strips with the new title.

Vocabulary

日本語 = にほんご = Japanese

スペイン語 = スペインご = Spanish

フランス語 = フランスご = French

言語 = げんご = Language

Transcript

Yellow: If 日本 is Japan, what is Japanese?

Blue: 日本語.

Blue: In fact, most languages are just the name of a country followed by .

Blue: Like スペイン語 and フランス語.

Blue: Also, the word for “language” in general is 言語.

Yellow: Is 言語 a common word?

Blue: Not really.

Yellow. Weird. It seems familiar.

 

Gengo Girls #6: Made In Japan?

Genki Gengo Girls #6: Made In Japan

Next Comic >>

<< Previous Comic

One popular theory for the origin of “Japan” is that the English originally heard about the country from a European explorer who originally heard about the country from the Chinese. After a multilingual game of telephone like that it’s really no surprise that “Nippon” wound up a little warped by the time it made it into our dictionaries.

Vocabulary

日本 = にほん = Japan

日本 = にっぽん = Japan

Transcript

元気 言語 ガールズ #6

Made In Japan?

Yellow: Hey, what’s the Japanese symbol for Japan?

Blue: The symbol for Japan looks like this. It’s pronounced にほん.

Yellow: にほん?! That doesn’t sound like “Japan” at all!

Blue: It can be pronounced as にっぽん too.

Yellow: Still not “Japan”!

Yellow: It’s a country name so it should be the same everywhere, right? Why is it different in English?

Blue: I’m really not sure, but we could probably find the answer online.

Yellow: Never mind then. I’m not that curious.

Blue: It would only take a few minutes to research…

Yellow: Yeah, but I only had about thirty seconds worth of curiosity.

Let’s Program A JavaScript Game 2: The Canvas Of Dreams

Let’s Program A JavaScript Game 2: The Canvas Of Dreams

 

No Time For HTML

 

This is “Let’s Program A JavaScript Game” not “Let’s Program A Website” so instead of discussing the fine points of HTML structuring I’m just going to drop the code for a very basic skeleton page that we can use for testing out the canvas. Just type or copy the following text into a file named something like “javascriptgame.html” and then open it up with your favorite modern browser (most up to date browsers support the canvas):

 

<!DOCTYPE html>
<html>
<head>
   <script>
      function canvasTest(){
         alert("Canvas Test");
      }
   </script>
</head>
<body>
   <canvas id="gameCanvas" width=600 height=400></canvas>
   <br/>
   <button onclick="canvasTest()">Canvas Test</button>
</body>
</html>

 

Not much to this. The HTML document has a HEAD, that holds our script, and a BODY that holds our canvas and one button. Clicking the button calls our script and if everything works properly you should get a screen sort of like this:

Just a quick test to make sure your button is connected to the script

Just a quick test to make sure your button is connected to the script

Paint It Black

 

The first step to actually doing something interesting with our canvas is to put a reference to the canvas inside of a JavaScript variable. Then we use that reference variable to create a “context” object that can be used to do the actual work.

 

With our context all set up painting the entire canvas is as simple as setting the fillStyle of our context to whatever color we want and then calling the fillRect function. This function needs four arguments: the x and y coordinates of the top-left corner of the rectangle you want to draw along with the width and height of the rectangle.

 

Here’s our updated canvastTest function and a picture of what it should do. Remember to refresh the page in order to get the new code into the browser. If clicking on the button just shows the alert again odds are the old page is still in your browser memory and refreshing is the easiest way to force it to get rid of the old and grab the new.

 

function canvasTest(){
   var canvas = document.getElementById('gameCanvas');
   var context = canvas.getContext('2d');
   context.fillStyle = '#000000';
   context.fillRect(0,0,600,400);
}

 

A boring but important first step: Painting the entire canvas all one color

A boring but important first step: Painting the entire canvas all one color

 

Paint It Black, But With Polka Dots

 

Painting the entire screen black is kind of boring. Let’s add some color now by choosing a new fillStyle and then drawing some more rectangles on top of the black background rectangle.

 

Here’s an updated canvasTest that draws two red squares and a blue square when we hit the button:

 

function canvasTest(){
   var canvas = document.getElementById('gameCanvas');
   var context = canvas.getContext('2d');

   //Draw background
   context.fillStyle = '#000000';
   context.fillRect(0,0,600,400);
 
   //Draw red object
   context.fillStyle = '#ff0000';
   context.fillRect(100,100,50,50);
   context.fillRect(300,300,50,50);

   //Draw blue object
   context.fillStyle = '#0000ff';
   context.fillRect(200,200,50,50);
}

Notice that when drawing the two red squares we only had to set the fillStyle once.

 

Colorful Geometry Is Colorful

Colorful Geometry Is Colorful

 

Graphics And Sprites And Images, Oh My!

 

Drawing colored boxes is nice, but not quite enough for a full game. People expect their games to actually look like things; the box has to be a robot or a soldier or an alien or an alien-robot-soldier.

 

So let’s add some graphics to this demo using these two bits of clipart I found on a free clipart website*. You’ll need to save them to the same folder as your code if you want to keep following along.

cyclevirus

Before we can draw these images to the canvas we need to load them into our code, which we do easily enough by adding a few lines to the top of our script that will be automatically run when the page loads. But watch out! Loading images over the Internet can take a long time and trying to draw an image before loading it will crash your game. This won’t be a problem for your test, since the graphics are small and already on your computer, but for an actual online game with lots of graphics it can be a real problem. We’ll talk about how to fix that later.

 

Once the images are loaded drawing them to the screen is as easy as a call to drawImage. Note that I also changed the color of the background so that the black clipart shows up better. Otherwise you’ll have two black images on a black screen and you’ll have no way to tell if it’s working or not.

 

var cycleImage = new Image();
cycleImage.src = "cycle.png";

var virusImage = new Image();
virusImage.src = "virus.png";

function canvasTest(){
   var canvas = document.getElementById('gameCanvas');
   var context = canvas.getContext('2d');

   //Draw background
   context.fillStyle = '#dcdcdc';
   context.fillRect(0,0,600,400);

   //Draw red object
   context.fillStyle = '#ff0000';
   context.fillRect(100,100,50,50);
   context.fillRect(300,300,50,50);

   //Draw blue object
   context.fillStyle = '#0000ff';
   context.fillRect(200,200,50,50);

   //Draw Images
   context.drawImage(cycleImage, 300, 100);
   context.drawImage(virusImage, 300, 200);
}

 

Motorcycles are cool! Hazard symbols are cool!

Motorcycles are cool! Hazard symbols are cool!

 

Animation! Sort of!

 

We’ve actually more or less covered everything we need to know to start prototyping our game. But just for fun let’s update our function to be “animated”: Every time you click the button the squares and clipart will move. We do this by creating a global “offset” variable right before our function. By adding an offset to the x or y coordinates of our drawings we can move them around the screen, and by constantly increasing the offset we can create the illusion that they are steadily moving in one direction.

 

So change your script to this and then click the “Canvas Test” button a few dozen times and see what happens.

 

var offset=0;

var cycleImage = new Image();
cycleImage.src = "cycle.png";

var virusImage = new Image();
virusImage.src = "virus.png";

function canvasTest(){
   var canvas = document.getElementById('gameCanvas');
   var context = canvas.getContext('2d');

   //Draw background
   context.fillStyle = '#dcdcdc';
   context.fillRect(0,0,600,400);

   //Draw red object
   context.fillStyle = '#ff0000';
   context.fillRect(100+offset,100,50,50);
   context.fillRect(300+offset,300-offset,50,50);

   //Draw blue object
   context.fillStyle = '#0000ff';
   context.fillRect(200,200-offset,50,50);

   //Draw Images
   context.drawImage(cycleImage, 300 - offset, 100);
   context.drawImage(virusImage, 300 + offset, 200);

   offset+=10;
}

 

A few things worth noticing here:

 

  • When two objects overlap whichever one comes last in the code gets drawn last and shows up on top. Example: The blue and red square
  • When an object is partially outside the canvas the part inside the canvas still gets drawn
  • You can “draw” an object completely outside of the canvas without breaking anything. It just doesn’t show up.

 

Time To Decide What To Do With All This Cool Code

 

So we can draw screens now and have even covered the basics of animation. We’re basically all set to start building our game!

 

Or we would be if we had any idea what we were going to build. So next week I’m going to take some time and lay out a simple game design document.

 

 

* Original images can be found here:

https://openclipart.org/detail/191534/motorcycle-silhouette-vector-by-raimondi1337-191534

https://openclipart.org/detail/28408/malware-hazard-symbol-by-pbcrichton

 

Gengo Girls #5: Baby Steps

Genki Gengo Girls #5: Baby Steps

<< Previous Comic

Next Comic >>

Hey, look! Vertical text. The comic’s feeling awfully Japan-y today.

Although this does bring up a really weird problem: Japanese and English comics arrange their speech bubbles differently. In English you expect to read the bubbles top to bottom, left to right. In Japaense you are supposed to read the bubbles from top to bottom, right to left.

So how exactly am I supposed to arrange the speech bubbles in a bilingual comic!?

I figure as long as I follow the top to bottom ordering rule it doesn’t matter so much which bubbles are to the left and right of each other. I hope this doesn’t cause too much confusion.

Transcript

Blue: おはよう

Yellow: おはよう

Blue: いい天気ですね

Yellow: いい天気ですね

Yellow: That was the most boring conversation I’ve ever had.

Blue: The journey of a thousand miles starts with a single step.

Gengo Girls #4: It’s The Principle Of The Thing

Genki Gengo Girls #4: It's The Principle Of The Thing

<< Previous Comic

Next Comic >>

With the alphabet out of the way (you did memorize the hiragana like I asked you to, right?) we can start moving on to actual words.

I’ll try to introduce four or five new words a week. When I first use a word I’ll show you the kanji symbol for that word, the hiragana pronunciation and the English definition. From then on I’ll just stick to using the kanji.

So basically I’m asking you to memorize up to five kanji symbols a week, which is pretty easy. Even so you might want to copy paste the “vocabulary” section of each post into a personal dictionary for later reference.

Vocabulary

おはよう = good morning

いい = good

天気 = てんき = weather

Transcript

Yellow: Practicing the alphabet is fine, but I’m ready to learn some actual Japanese!

Blue: Hmmm… let’s start with a morning greeting then.

Blue: おはよう means “good morning”.

Blue: After a greeting you can move on to some small talk.

Blue: I’ll start by saying いい 天気 です ね, which means “Nice weather, isn’t it?”

Blue: Then you agree by saying いい 天気 です ね back to me.

Yellow: What if I don’t think the weather is nice?

Blue: It’s polite to agree anyways.

Yellow: But that would be lying.

Yellow: Even a little white lie can spiral out of control and ruin your life.

Yellow: It starts with lying about the weather but the next thing you know you have to fake your own death and move toArgentina!

Blue: It’s just small talk. I promise that won’t happen.

 

Gengo Girls #3: Audio Lesson, Visual Medium

Genki Gengo Girls #3: Audio Lesson, Visual Medium

<< Previous Comic

Next Comic >>

Describing sounds with words is really really hard.

If you’re having trouble with the small つ you should probably go to Youtube and look up some videos on “Japanese Double Consonant”. It’s pretty easy to understand once you’ve heard it a few dozen times and know what to listen for.

Transcript

Yellow: As long as we’re talking about hiragana, what’s up with the tiny つ that keeps shwoing up in the middle of words?

Blue: The tiny つ means you should double the consonant that comes after it.

Yellow: How do you double a consonant? You can’t just hold the sound out longer like you do with a vowel.

Blue: It’s hard to explain. Think of it like adding a split-second pause right before the consonant.

Blue: For example, compare いか and いっかい

Yellow: I can’t really hear the difference…

Blue: There are a few examples in English as well. Like when you pronounce “midday” or “lamppost” as one word instead of two.

Yellow: I still can’t hear what you’re doing!

Let’s Program A JavaScript Game 1: Browser Games With JavaScript

Would You Like To Play A Game?

 

Our last Let’s Program was focused on some pretty serious AI techniques for solving pretty serious math problems. So this time around let’s take it easy and program a nice relaxing game.

 

Eh, who am I kidding. A well designed game is just as mathematically intense as your average AI. But the end product sure is a lot more fun!

 

Why A Browser Game?

 

If you’re anything like me, when you hear the word “videogame” you immediately think of a console or powerful computer running a big game like Skyrim or Final Fantasy. Tiny little browser games may not have even crossed your mind.

 

But don’t be too fast to look down on web browser games! Modern computer browsers have more power than most of the gaming systems I grew up with and some of the more elaborate browser games rival traditional games in terms of graphics, gameplay and content.

 

Browser games also benefit from a massive audience. Millions and millions of people may own gaming consoles and gaming PCs but the number of people who own web browsers is in the billions! So if you want to create a game that anyone, anywhere, can play browser games are the way to go. This is a big part of the reason that they are the king of casual games.

 

Not to say that they don’t have their downsides. Browsers games lack the power and size for many types of games. Skyrim could never have been built as a browser game, and even if it was no-one would want to wait the eight hours it took for that particular page.

 

But even if your end goal is to build the next Skyrim instead of the next Cookie Clicker you still might want to spend at least a little time playing with browser game programming. It’s a good learning experience and you might be surprised at just how much game you can fit into a small browser download.

 

The Rise of JavaScript And The War Against Flash

 

So we’ve decided to program a small game that can be inserted directly into a web page. Now how do we do that?

 

For years Flash was the most reliable way to include a game in a website. Flash is basically a program designed to run other programs and it let people enhance their websites with streaming video, animated menus and even entire games. It was hardly perfect and had definite issues with memory hogging and slowdown but it was very successful at letting people play online games without the normal mess of downloading and installing a separate program. They just visited a web page and Flash automatically loaded the game and started it up in the browser.

 

Today Flash is still one of, if not the most, popular way to build browser based games. Just visit a free gaming site like kongregate to see what I mean. Flash as far as the eye can see.

 

But in the last few years a new option for building browser games has arisen in the form of JavaScript.

 

JavaScript isn’t a new technology. It has been an important part of web browsers for a long long time. It offers a flexible scripting language that can interact directly with web pages, allowing programmers to build powerful interactive menus, perform efficient error checking and streamline page loading. Without JavaScript the Internet would be a much clunkier and user-unfriendly place.

 

But for all its power JavaScript was never really a good choice for game programming.

 

At least, not until a few years ago when a new HTML element called the “Canvas” was announced. The canvas is basically a big blank space that can be inserted into a web page and then controlled through JavaScript. A few lines of code is all it takes to fill a canvas with color or copy part of an image onto part of the canvas. And of course, if you repeatedly repaint the canvas you can create simple animations.

 

This was the last puzzle piece needed to build full JavaScript browser games. We can now use JavaScript to check for keyboard input, use JavaScript to simulate a game world and finally use JavaScript to draw that world to a canvas. And we can do all this using nothing but the browsers that people already own.

 

As a programmer, all you need in order to create one of these games is a simple text editor for writing your code and a browser for testing it in. No fancy tools required! In fact, that’s the main reason I chose JavaScript for this Let’s Program. Flash is a powerful tool but to really get the most out of it you need to buy some moderately expensive Adobe products.

 

So next week we’ll get this Let’s Program started by covering the basics of drawing on the HTML canvas.

Gengo Girls #2: Hiragana Hijinks

Genki Gengo Girls #2: Hiragana Hijinks

<< Previous Comic

Next Comic >>

Other special rules you should know:

  • Adding a small circle to an “H” symbol turns it into a “P” symbol. Ex: は= ha, but ぱ= pa
  • If you follow a symbol up with a vowel that has the same sound, you double the length of the the first symbol and ignore the vowel. Ex: かあ is “kaa” not “ka (pause) a”
  • You can also double “O” sounds by using the う symbol instead of the お symbol. Ex: おう is pronounced as a long “oh” sound, not “oh-ew”

Transcript

Yellow: They say the Japanese alphabet only has forty six letters, but when you count the special rules isn’t it more like a hundred?

Blue: What do you mean?

Yellow: Well, there’s the way you can add the ” symbol to a letter to change K sounds into G sounds or H into B or S into Z or T into D. That’s like adding twenty more letters!

Blue: I guess that’s true. がんばる is “ganbaru” not “kanharu”

Yellow: And don’t forget that you can throw in a tiny や, よ, or ゆ after another symbol to mix the sounds together. That has to be worth another dozen letters!

Blue: That’s true too. りゅう is “ryuu” instead of “riyuu”.

Yellow: Woah! You can actually pronounce りゅう?!

Yellow: It always comes out “ruu” or “riyuu” when I try…

Blue: My brother took me to the arcade a lot as a kid…

Gengo Girls #1: Minimum System Requirements

Genki Gengo Girls 1: Minimum System Requirements

<< Previous Comic

Next Comic >>

Here is a link to the Wikipedia article on hiragana. I just saved you something like twenty three key strokes. You’re welcome.

I personally found that the easiest way to memorize hiragana, and later katakana, was to split them up into groups of five based on what kind of sound they made. First I learned all the “vowel” sounds (あ い う え お) and then all the “K” sounds (か き く け こ) and so on.

Transcript

Blue: Today I’m going to be talking about the things you need to know to fully enjoy this comic.

Yellow: Another “talking through the fourth wall gag? We did that last time.

Blue: It’s not a gag. The audience needs to hear this.

Blue: First off, you’re going to need to know how to read hiragana. It’s a 46 letter Japanese alphabet where each symbol represents a one-syllable sound.

Blue: We’ll use hiragana to teach you how to pronounce new words.

Yellow: It might also be useful to learn katakana. It’s an alternate alphabet used mostly for foreign words.

Yellow: Shows up in manga sound effects a lot too!

Blue: Memorizing 46 symbols isn’t all that hard. Just make some flash cards or look for an online tutorial!

Blue: You can do this!

Yellow: There are even phone apps for learning hiragana!? Wish I had known that BEFORE making all those flash cards…