Chinese Character Challenge – Update 1

After posting my Chinese character revision game on reddit I received some excellent feedback.

In the week since then I have been hard at work producing an updated version. Here is a link to the game for those that want to cut to the chase.

Note that I have further updated the game since writing this post and have now moved it to its own domain

Mandarin Mojo

First up, there are some things that remain undone.

1) Play an audio clip so you can hear the words. I simply haven’t gotten to this yet. I suspect it will be tricky but it is definitely on my to-do list.

2) Characters are randomly selected. There is no intelligence that prevents you from being asked about a particular character multiple times while another character gets missed.

3) Wrong answers are also randomly selected. There is no attempt to surround the correct answer with similar but incorrect characters.

4) The explosions flicker quite badly on Firefox despite displaying correctly in Chrome.

The following things are done.

1) You will now have an extra goblin in pursuit every 10 words/phrases. Hopefully this provides a little intensity boost as you progress.

2) A summary is provided of what you have got right and wrong. It simply lists every question in English, pinyin and the character(s) for you to look back on. Correct answers are in white, incorrect answers are in blue.

3) I changed the key you use to start your next round. This is to stop you accidentally starting a new round by already having your finger on the movement keys. Having a break between rounds is important now that there is the ability to look back on the question you got wrong.

4) Longer phrases were sometimes running off the edge of the game board. That should not happen anymore.

5) You can now choose to be supplied questions in English, pinyin or both.

6) Previously the same character would sometimes appear as both a correct and an incorrect answer. This should not happen anymore.

I think that is about it. Hopefully you enjoy it 🙂

Chinese Character Challenge – A Slightly Less Dull Way to Revise

Recently I was in at Moodle HQ and another programmer there was demonstrating a space game he made that extracted questions from a Moodle quiz. I believe this is it https://github.com/xow/moodle-mod_quizgame.

I began to think about various other kinds of games that could easily draw questions from a quiz. As I am making an attempt to learn to read Mandarin this seemed like a suitable starting point.

First, I trawled through my collection of past projects. I have a whole bunch of playable game prototypes just sitting there. No need to start from scratch if I don’t have to. I quickly settled on doing something with a game prototype called Endless Goblin.

Although I initially intended to pull data from a Moodle quiz I stumbled on a set of text files containing all of the characters I was interested in as well as their definitions. This made getting this information into Moodle then out of Moodle seem somewhat redundant. After all, I could just parse the text files so why bother with a whole learning management system. Directly parsing the text files is indeed what the game currently does. Moodle integration will have to wait for another day.

Once I had the parsing happening, which only required a small amount of massaging the files to fix inconsistencies, I suddenly had a large set of data available. All six HSK levels are available (what is HSK?) in both simplified and traditional characters. The user/player can choose whatever levels they want to review as well as their simplified Vs traditional preference.

Now, I’m certainly not claiming that this is a brilliant game. It is thoroughly repetitive and distinctly lacking in any sense of progress. It just endlessly feeds you English to Chinese character questions. Right now, it doesn’t even tell you what the correct answer was when you get a question wrong (although I may have fixed this by the time you read this). The game also has no ability to phrase questions the other way around, from Chinese character to English. It is however marginally more fun than grinding through characters in Memrise or Anki. At least it offers a bit of a break in the routine of revision.

There is a link to Chinese Character Challenge below. I am currently mulling ways to build a more complete game around character learning and revision.

Note that I have updated the game since writing this post and have now moved it to its own domain

Mandarin Mojo

The original prototype code is still available from https://github.com/andyjdavis/ChineseCharacterChallenge See the README.md on github for links to the sources of all of the assets that I have used.

A Bouncing Ball and Three.js

I have been experimenting with Three.js and, indirectly, webgl. Making the move from 2d to 3d has been interesting. It certainly is a whole new world.

Along with just messing around I have also been working my way through Udacity’s 3d graphics course which has been helpful.

I haven’t really produced anything of any great note. I do feel like I should however post what I have been tinkering with.

Right now all there is is a ball that you control. A and W move left and right. Holding space will make the ball bounce. Pressing W will toggle the lighting through red, green and blue. The platforms are either red, green, blue or white.

While the light is blue only blue and white platforms are visible. While the light is green only green or white platforms are visible. The platforms are always there, you just can’t always see the non-white platforms.

It is a somewhat interesting concept that I can see myself working on further. I need to come up with a few interesting puzzles that use the concept. If nothing else I quite like the disco effect created by rapidly toggling through the colors.

Bouncing Ball

December 1GAM – Alien Abductor

For December I finally ventured into the alleged “third dimension”. Or at least, sort of. This game is based around ray casting to create a pseudo 3d environment. It is an interesting approach that is actually surprisingly simple. I was pleasantly surprised by how straight forward the algorithms are.

Due to time constraints I took a short cut by working through a tutorial to get the basics done. Creating pseudo 3D games with HTML 5 canvas and raycasting. That got me as far as having a big room that you could walk around in. Not very exciting.

To make the world a little more interesting I brought in the map generator from a previous project, Ascent pt 1.

I had to figure out the logic to add critters to my world. Once I understood how the ray casting worked, adding non-wall entities wasn’t particularly difficult. A little high school math is all that is involved. That said, my logic for determining whether an alien is actually visible onscreen is somewhat glitchy. If I have time in the future I will revisit it and try to iron out some of the bugs.

The aliens themselves are created by me based on the creatures depicted on ceramic tile coasters created by one of my sisters in law.

The game is called “Alien Abductor”. Your task is to roam around a large structure collecting aliens who are going about their business. The fate of the aliens post collection is left as an exercise for the reader.

Here it is. Alien Abductor.

November 1GAM – Five Man Team

Given that it is still October, it is perhaps premature to be releasing a game for November. However this project came together rather quickly so I saw no need to delay. Plus my December project is quite ambitious and will coincide with a time of year that is rife with interruptions so I thought it best to leave myself some contingency time.

My November project is a simple top down real time strategy game called Five Man Team. I did consider naming it Five Person Team or similar but it just didn’t have the same ring to it.

In a series of matches you face an opponent who is leading a team of five units that are identical to your own. Both the computer and yourself have the same units, the same rules are applied to you and you have absolutely no advantages or disadvantages over the computer opponent.

You control the unit’s movements but not their firing. I did actually have code in there at one point to allow the player to set targets but then you get odd situations where a unit is ignoring incoming fire while trying to chase down some fleeing target and it just felt more and more like you were controlling mindless automatons who did not care if they died, which you essentially are but there’s no need to highlight that.

The shots fired by units are most accurate when the unit is stationary. They become less accurate if they are moving. They are less accurate again if they are moving while firing at a target off to their side. They are really really inaccurate if they are moving while firing at a target behind them. To figure out the direction of the target versus the direction of movement I used dot products.

This has the unfortunate side effect that the best strategy is to “dig in” by clustering your units together and sitting and waiting for enemy units to wander into range. This seems quite realistic from what I know of modern warfare. Better to be the guy hunkered down in the defensive position than the guy charging into a hail of gunfire. This kind of sit and wait, sentry duty simulator style of play just isn’t particularly fun. To make this a better game I would need to either add some reason for the player to have to move or tilt the odds, perhaps by having a small team facing waves of attackers.

I did have plans to implement both obstacles and A* path finding to allow the units to negotiate those obstacles. I’ve implemented an A* algorithm in Java but never in Javascript. The reason for abandoning this idea is primarily excitement about my December project. I am drawn like a moth to a flame to things I have not implemented previously.

So, finally, here is the game. Hopefully someone out there enjoys it if only for a few minutes.Five Man Team

The code (such as it is) is available on github.

October 1GAM – Endless Goblin

A while back I happened upon a great tutorial from Lost Decade Games about making a simple HTML 5 game. It’s a simple tutorial but I wanted to have a play with it to make sure I wasn’t missing anything obvious about this HTML 5 business.

A few days of sporadic tinkering later and I’ve got something mildly entertaining (I think). The code is completely unrecognizable. Basically all that remains is the hero, the goblin and the background graphics.

I called it Endless Goblin because, well, it needed a name and Endless Goblin struck me as kind of amusing.

It’s pretty crapulent as a game. It desperately needs some variety among the enemies and probably some pick ups. Different weapons and what not. The collision detection with the fireballs is also a little bit dicey. I do however now have a bit of a framework should I decide to come back and have a more serious go at making an “arena” style game.

Anyhow, I’ve probably talked it down enough. Play Endless Goblin

The git repository is at https://github.com/andyjdavis/EndlessGoblin

The fireball animation is from http://opengameart.org/content/fireball-spell

The explosion animation is from http://opengameart.org/content/explosion

September 1GAM – Ascent Part 1

This month I’ve cheated a little. Although I’m passing it off a game its more a of a playable prototype. Truth be told this is the beginnings of a much larger and more ambitious project. Initially I had grand plans about getting that whole project done in a month but I quickly realized that that wasn’t realistic if I wanted to keep my job, keep my wife, make some progress in my other projects and also get some sleep and maintain a basic level of personal hygiene.

One fairly cool feature that I did get done is the automatic generation of the cave structures. The code is based on a tutorial on gamedev.tutsplus.com. It’s pretty neat. Partly because it provides some replay value and partly because it spared me the task of manually creating levels.

It’s possible for the cave generation process to create a system of multiple caves that are completely independent ie not connected at all. To make sure that the player is not being placed in a cave with no possible path to the exit I’m doing a non-recursive flood fill. If the exit and the player do not cohabit the same cave the level is thrown away and regenerated. Simple but not super efficient.

To provide a little bit of challenge the cave is populated by UFOs who charge the player. Right now their AI is abysmal. This will definitely be improved. I haven’t had much experience with game AI but now is as good a time as any to learn.

I think that’s pretty much it. I still have a few more months to go before I have completed my twelve month run in One Game a Month. Many months ago I made a commitment to produce something every month for one whole year and I intend to stick to it. However my attention is increasingly being drawn to projects like this one that I intend to revisit after the year is up. Projects where I can see the potential to make something I can really be proud of. For the rest of 2013 I’ll be sticking to the one game a month format but after that I’m looking forward to picking a larger project and sinking my teeth into something more substantial.

Oh yeah, the game… Here you go. Ascent Part 1.

Credits

The art, music and sound effects are not my creations.

The fighter and UFO graphics are from Open Game Art.

The UFO attack noise and the explosion noise are from Freesound.

The music is from Incompotech.com

August 1GAM – Run Block Run

Another month, another game. I figure it was about time I tried my hand at an endless runner. It’s implemented in Javascript/HTML5. Its a pretty simple game called Run Block Run.

Run Block Run is very simple to play. There’s only one button involved. J to jump. At first you can only jump once. After a minute you can double jump. After two minutes you can triple jump and so on up to five.

There were no major headaches with this. The usual collision detection bugs to iron out but nothing major. There’s no music or artwork to load which avoids one common source of issues, downloading and managing files.

I took a slightly novel approach to development. First, I built each major visual element as a standalone project. Once that was done all I had to do was gaffer tape the whole thing together. Here are links to the individual components.

https://github.com/andyjdavis/javascript-jumping-block
https://github.com/andyjdavis/javascript-sidescroll-starfield
https://github.com/andyjdavis/javascript-skyline

This style of development worked quite well and helped me focus on completing one thing before moving on. Otherwise I’m inclined to hop around. Ultimately the work still gets done but taking it piece by piece certainly gave me a strong sense of getting stuff done.

Now that its finished, to be honest, I’m not particularly happy with how this turned out. I feel like my projects are progressively becoming more polished but I just don’t feel like Run Block Run is actually that much fun. I don’t actually play endless runners much so maybe that’s the issue. Don’t try to make a game you wouldn’t normally play yourself.

You can play it on New Grounds, Game Jolt or Kongregate.

Things to discuss before you get married

As a way to learn node.js and to get familiar with Heroku I recently built 99thingstodiscuss.com. Its a simple piece of software that randomly outputs a topic for conversation between two prospective partners.

It works fine on a desktop but is primarily meant for mobile devices which is why it looks rather sparse.

It was a good learning experience and, in my opinion, its easy to leap into marriage without having had serious conversations about important topics. Learning new technologies and solving relationship problems. Look at me go.

Things to talk about before you get married

July 1GAM – Mine Runner

Another month, another game. This time it’s a Boulder Dash style game called Mine Runner.

I previously posted a prototype version of the game and attempted to find an artist to collaborate with (the prototype post). That was completely unsuccessful and I was forced to press on using free resources available on the net.

Before I dive into what I learned I feel like I should just cut to the chase. Here is the game.

Mine Runner is now playable on several other sites.
Mine Runner on New Grounds
Mine Runner on Kongregate
Mine Runner on Game Jolt

 

Credits
All programming, writing and anything not specifically mentioned below was done by me.

The dirt image is by Axolotl and is available from http://opengameart.org/content/dirt

The diamond image is by Sekulus and is available from http://opengameart.org/content/diamond-icon

The boulder and brick images are by thomaswp and is available from http://opengameart.org/content/2d-object-pack

The monster is by qubodup and is available from http://opengameart.org/content/16px-neon-minimal-mages-monsters-powers-and-dirt

The three characters are modified versions of characters by “/usr/share”. The originals are available from http://opengameart.org/content/16×16-8-bit-rpg-character-set

The death sound is http://soundbible.com/992-Right-Cross.html

The rock fall sound is http://soundbible.com/1120-Bounce.html

The music is from http://www.soundempire.com/

What did I learn?
In a Pygame platformer that I made previously I stored my map data as a small image file, a png specifically. Determining what is contained in each tile of the level is simply a matter of retrieving the pixel data from the image.

To get this to work in Javascript it appears to be necessary to draw the image to an off screen canvas. A slight annoyance. I spent a bunch of time convinced there must be a way to directly retrieve pixel data from the loaded image but apparently not.

I also ran into this curious message. “Unable to get image data from canvas because the canvas has been tainted by cross-origin data” This is because I was loading the web page from a local file path but the image was being loaded (apparently) via a web style URL. Simply switching from accessing the page via the local file system to accessing it via http://localhost/blah made the browser happy.

I’m quite happy with how it turned out. It’s not a long game. Hopefully it’s challenging. I tried to inject a little humour and to introduce a more relate-able story line. Have fun 🙂