Saturday, 29 April 2017

Teach Yourself Game Programming in 21 Days - Day 2

This second chapter is titled "The Components of a Complete Game: Mech War". It's a decent overall look at how complicated game development is, and how much hard work it takes to get there. André lists 20 steps that he had to work through. The game 'Mech War' is essentially a Space Invaders clone.


His paragraph about design is interesting, because it is quite the opposite from my own experience:

"Much of what a game programmer does boils down to being creative. Writing games isn't too terribly complex once the fundamentals have been grasped. The hard part about making games is thinking them up! I can't count the number of times I've sat at my desk and tried to think up the ultimate video game. Many times I'd find myself creating games that had already been done. This is the problem: there are so many games out there (literally, thousands) that coming up with a completely new one is hard to do. There are still about 50,000,000,000 good games to be written—they're just harder to come up with."

I think of game ideas all the time. Often I will think of quite detailed systems and worlds while I sleep; my main barrier is not being able to make these concepts a reality. I think of myself as a fairly competent programmer, but the large-scale planning needed to create a game on the scales I can imagine often eludes me. Not to mention the huge amount of hours needed to create all the content needed to fill games; I'm no artist, though I used to dabble in musical composition, so I usually abandon the majority of my ideas.

I do agree with his assessment that there are essentially no 'new' games left. Even today, games can quite easily be described in terms of "older game X with extra mechanic Y". Or "like X but with better graphics". This is largely the result of the gaming industry becoming big business; many companies are simply not willing to throw the giant sacks of cash that AAA game development requires without guaranteeing a return on investment. Thankfully, indie development has a great role in filling these unfilled niches.


The author notes that even this simple game, copied from another existing game, took 5 days to write. Interestingly, he indicates that 50 days should be enough to write a game "of shareware quality" which you could probably sell. In my own attempts at game development, I can't really endorse this figure, but it does sound reasonable with a concerted effort and using the latest tools.

Even though Mech War is simple, he structures its development in a way that would make sense for a much larger game; he provides for a configuration system (here used simply to store sound card settings), splits up his code into modules, writes a separate library to handle sound playback (a very annoying issue back in the DOS era) and so on.

All the sounds in the game are processed samples of his own voice. I remember doing this too, back when I played around with The Game Factory; nothing beats going 'tsh' or 'oof' into a microphone then hearing them in-game. André also claims that many professional games use the same method; I don't think this is as true today, with the amount of commercial sound-banks available.


There are many, many more details here about what was involved in Mech War's creation, but I don't want to give everything away here. This is another one of those chapters that doesn't involve any actual programming, so I mostly skimmed over it on this fifteen-hundredth reading. It's still useful, though. At the end the author mentions a 'challenge' to send him an improved version of the game; he'll pick a winner and send them a cheque for $100! Golly!

I think perhaps that challenge might have ended some time ago. However, it might be amusing if I can find the time to send him my own improvement at the end of this little project of mine.

One of the exercises for this chapter is "Think up an entire game. Write down a list of all the elements in your game, and all their interactions." Way ahead of you, André.

Friday, 28 April 2017

Teach Yourself Game Programming in 21 Days - Day 1

Welcome to Teach Yourself Game Programming in 21 Days! You're about to embark upon one of the most exciting and rewarding learning experiences you've ever had. Game programming is, without a doubt, one of the most difficult areas of computing to understand. However, it's also one of the most satisfyingand, with determination and patience, you will conquer it.



So begins this great book. The first chapter talks about video gaming history on home computers, going from those heady days when owning an Atari 800 made you the coolest kid on the block, right up to the cutting edge of the Intel 486. It's fun to look back into the past this way; it's particularly amusing to see the almost breathless way that André explains things that are considered mundane or even trite now, like the way "most PCs today have sound cards" or that games aim to hit "15-30 frames per second".

The book lists the basic genres of games as such:

  • First-Person, Three-Dimensional Walkthroughs like Doom, Blake Stone, etc.
  • Flying, Driving, or Spaceflight Simulations like Microsoft's Flight Simulator, Wing Commander, etc. "These games try to simulate something we can do in reality." I wonder how André would feel about the preponderance of Farming Simulator stuff these days.
  • Sports Games in 2- or 3-D; he doesn't name any here, but he does mention that "the most popular games are football and basketball."
  • Scrolling Adventure Games like Mario Brothers. 'Adventure' games! It still amazes me how much this word has changed in meaning over time.
  • Sideview Combat Games by which he means Street Fighter et al. "The factor that attracts most players to these kinds of games is the ability to project themselves into virtual warriors with super strength and abilities."
  • Role-Playing Fantasy Games in 2- or 3-D, again not naming any, only 'admitting' that he used to play Dungeons and Dragons back in the day.
I guess the largest missing genre here is Puzzle; a segment which has exploded through so-called 'casual gaming', something that would have been difficult to predict back in the 90s. The focus back then was on bigger and better - pushing the boundaries of tech, upgrading your PC every 6 months. The very idea of large parts of the industry jumping onto a low-powered portable machine is kind of weird, but it definitely worked.

Next is a fairly lengthy discussion about the architecture of a video game. It notes that everything happens in a big loop, so it's really important to make that loop run as fast as possible. I remember there being quite a few optimisation tips spread throughout the book, and plenty of advice to make you stay on the path. I think this really stuck with me; even though I mostly write websites and non-critical things these days, I still make notes about what could be improved and like to use profilers to get a feel of how fast my code actually runs.



Game Law: Don't mix game logic and graphics unless absolutely necessary. Try to keep rendering and computation separate.

This separation of concerns is a rather important part of programming in general. The separation of code into individually testable units means that it is possible to reason about their correctness. It also helps guarantee that later changes don't break any old code. This is something I've only really got into recently - although I've known about unit testing for a long time, I had no idea how good the tools for code coverage and static analysis had got. I think it's a fascinating way of learning more.

What Does the PC Offer as a Game Machine?
Today the PC is a formidable computer. You can bank on the following minimum hardware configuration as your base platform:
  • CPU: A 386 with two megabytes of RAM (with 486s being common)
  • Video Card: The VGA card is standard, with many PCs having a Super VGA card
  • Sound Card: A Sound Blaster- or Adlib-compatible sound card
  • Input Devices: All PCs have keyboards; many have mice, and—if the owner is a gamer—you can count on a joystick
What an amazing snapshot! It still blows my mind that these clever 90s programmers managed to wrest so much power out of a general-purpose machine, managing also to create some of the most memorable masterpieces in gaming history. The book also notes that you can also write games with this same level of hardware; this is something that is difficult to achieve today. Most Windows programming requires a powerful computer so you can load memory-hogging beasts like Visual Studio. Game programming with the latest engines is similarly demanding. Still, a commodity PC is enough to write indie games, and there are plenty of those around (lauded ones, too).

There is a worrying requirement in André's list, however. "You need a C compiler. I use Microsoft's C/C++ 7.0; if you have that one, we're completely in sync. Also, it would be to your advantage to have MASM 5.0 or higher." I've used Visual C, but this is older still, and it might be a pain to get hold of. Also, I'm using a 64-bit PC, so there could be further problems there.

The next line offers a potential way out. "If you're a Borland user, you'll have to make slight changes here and there. However, there shouldn't be a problem with code compiling under Borland's products." Ah, Borland (now Embarcadero)! My first experience with C programming was with Borland's venerable Turbo C package, also in the 90s. I also went on to use C++Builder once I got into visual stuff. I might still be able to find a copy of that lying around.



Lastly, there's a section about 'Being Creative'. This largely boils down to watching random fantasy and sci-fi movies for ideas. "If there's one game designer on Earth who hasn't seen all the Star Trek episodes, the Alien movies, and Real Genius a thousand times, I'd be surprised! So go out there and use other people's ideas as the seed of your own new idea." Probably decent advice for a programmer, we tend to be quite boring people.

So, there's no code in this chapter. However, each chapter does end with a list of quiz questions, some answered in the text, others requiring research. I won't bother to answer the questions (one is a bizarrely specific question about Real Genius) but I will attempt to do the exercises. One of them this time is "Play the game DOOM for a couple hours and see what can be done with a PC", so... see you later.

Thursday, 27 April 2017

Teach Yourself Game Programming in 21 Days - Intro

Holy crap, I haven't posted here since January!

I was reminiscing about coding in the olden days with a colleague when I realised I still have lots of coding books lying around. One sprang to mind immediately; Teach Yourself Game Programming in 21 Days by André LaMothe. It's an excellent book, full of practical tips (for the time, anyway) and reasonably structured code. Its language of choice is C, though there are occasional bits of Assembly to speed things up.

After I dug it out of the pile, I was slightly saddened to find that the CD with all the supporting material is gone. That means I'll have a lot of typing to do, not to mention some graphics and sound files to create. My second problem is that, this being a book from 1994, it creates programs that are designed to be run in DOS. Not only will I need to use DOSBox (which I'm familiar with), I'll also need to find a C compiler that can create these olde binaries.

Despite all this, I've decided to go through the book and get as much of it running as I can. I'm not sure I'll be able to do it over three weeks like the title suggests, but I plan to document my journey on this blog and release all the code I end up writing in a public repository somewhere.

Note: the games contained therein use PCX and VOC files. When was the last time you saw one of those?

Sunday, 1 January 2017

Twenty Seventeen

As ever, Christmas has been kind to me. Though I must sound like a broken record by now, I am eternally grateful to my family, old and new, for giving me such welcome gifts.

I don't want to write a list of presents, but I will say there were a few games I'll be reporting on in this new year. There were also a bunch of Japanese import games I ordered a few weeks ago to be delivered to my in-laws' house for simplicity.

My resolutions from last year lay in tatters; such things have never really motivated me. I shall simply state that I will put more time toward learning Japanese (so I can play my imports comfortably) and creating a video game this year.

I did manage to beat a game on the plane to America, so I guess I'll be talking about that soon, though it is not one of my "picked by other people" series.

Thursday, 3 November 2016

#14: Dynasty Warriors 5

After a drought, a deluge!

Taking pity on me, Emily chose Dynasty Warriors 5 as the next game for me to beat. Accordingly, I've already played through one character's story and started another for good measure.

DW5 is somewhere of a middle ground between the new, extremely easy titles and the ridiculously difficult ones like DW3. This is mainly the result of more rapid weapon acquisition and missile weapons not knocking you over. Having a bodyguard around with which to activate Double Musou is also very useful. I think this is also the last in the series to have the bow as an alternate weapon?

Killing ludicrous hordes of Chinese guys is as fun as ever. They're perhaps a little more aggressive than before, which means you usually have to at least consider the possibility that you'll get knocked out of combos; the counterattack move is often a sure bet. As for officers, their AI seems the same, though for some reason, weapon clashes seem to happen more frequently. However, everyone still says "Cow Cow".

These minor changes between iteration really make me want to put together some kind of document describing exactly how the Musou series have progressed. I spy another Google spreadsheet or two in my future.

In other news, I've started work on a fairly simple roguelike game written in Game Maker Studio. It's quite a new experience, though it bears some similarity to The Games Factory, which I used decades ago. I have other game projects, but it has been difficult to work up enthusiasm for them because there is so much left to do. Hopefully, learning a new environment/language will give me the impetus to finish a game for once.

Saturday, 29 October 2016

#13: Sherlock Holmes: Crimes & Punishments

I'm very sorry that I haven't posted any updates recently! Life has been hectic and great and awful, and also I'm bad at writing blog posts regularly.

About a month ago, TrueAchievements started the second run of their Ultimate Head to Head contest, an event which pits pairs of gamers against each other in a race to get as many achievements from a list neither of them have. As soon as I saw it mentioned, I joined, then promptly forgot to do anything about it. When the contest started, I felt a complete idiot, as I realised it had picked about half of the list from the Xbox One games I couldn't play, but owned thanks to Games With Gold. There was a way to fix this before the contest began.

In the first week, my opponent was apologetic but destroyed me. Thankfully, the first four rounds were not knockout style, and it was my birthday coming up, so my father-in-law felt pity on me and sent an Xbox One my way! From then on, I could complete properly, which was amazing up until I lost my first knockout round. Oh well. Next year.

Anyway, this significant lead up explains why the next of my Games Beaten in 2016 is Sherlock Holmes: Crimes & Punishments. An adventure game, it follows six cases more-or-less inspired by the original Doyle stories.

From the beginning, it is clear that the developers have a great deal of respect for the source material. The environments feel real; every room and outside area is strewn with beautiful stuff. Dialogue is of the time, characters are reasonable, progression is natural. The game is fully voice acted, and while it is sometimes a little repetitive, the interactions between Holmes and Watson are genuinely funny and made me chuckle a few times. In short, it's everything I miss when I'm playing Ace Attorney. Things make sense in this game.

Unfortunately, it's also a little bit too easy. There are frequent mini-games which test your reflexes or accuracy, but they are skippable with no other penalty than potentially missing out on some achievements. You don't have to make any intelligent choices in dialogue. The game's deduction system, which is otherwise an excellent way to visualise what is supposedly happening in Sherlock's head, never requires you to actually know what you're talking about. An interesting twist is that the game does allow you to make the wrong conclusion for each case. Some of these are more believable than others, but the common thread is that you can reach them without finding all the pertinent clues.

Overall, I found it a pleasant experience, but not a mind-blowing one. I'd love to see a game which uses a similar engine but with more in-depth dialogue and more ways to be 'wrong'. Definitely worth the price of free which I got it for.

You might be wondering why this post isn't about Nocturne or Motocross Madness. Well, for some reason the latter has been removed from the online store, so I can't play it. I'll ask Emily to roll me another game. As for Nocturne, uh... maybe one day.

Saturday, 6 August 2016

#12: Astonishia Story

Sometimes, when I visit used game shops, I like to pick stuff off the shelves simply because I've never heard of it. It doesn't hurt if they only cost a few pounds. This game is one of those.

Astonishia Story for the PSP is actually a remake of some 90s Korean PC RPG. Amusingly, the title screen specifically bills it as an "easy RPG for beginners". If you were expecting an experience akin to Final Fantasy Mystic Quest, you might be slightly confused. This game has a tactical battle system like Fire Emblem. It's closer to Shining Force in execution, though, as all the characters will get their turn according to their speed, rather than each side taking turns. There's also an elemental system which I honestly could not understand the effects of, despite the manual explaining it.

So, the story starts off in a rather standard manner. You're a knight, you're protecting a convoy, it gets attacked, everyone except you dies, etc. The entire rest of the game is spent trying to get this for-some-reason-important staff back from the guys who stole it. One of the last things you do in this game is pick it up and leave. In-between these two events, you are drawn into a series of vaguely-related side-quests with a cast of almost two-dimensional characters. Instead of going the route where you slowly build up your strength and get to know how well you can proceed through experience, Astonishia Story instead constantly throws people at you then takes them away a dungeon or two later.

Infuriatingly, the developers knew they were making a thoroughly average game and decided to try and spice it up with (ugh) humour. This takes many forms, though usually the slapstick kind. At one point some shady character offers you a hacked item, and if you accept, some guy appears and punishes you for not playing the game properly. Between this ill-fated attempt to make me smile and the consistently dreadful translation, it doesn't win many points on this front.

The graphics are generally not bad, late-SNES/early-PS1 in appearance. There are a few scripted fight sequences which are done with care. The music is pretty bad.

Now, about that "easy RPG" thing. While it's true that the game is not particularly complicated, it has a difficulty curve like a roller-coaster. Partially this was because of my usual unease about using consumable items, but the main problem is spell-casting enemies. On any given turn, they could walk up to you and smack you on the head with a stick for five damage, or cast any number of bizarrely spelt/named spells and hit everybody for three hundred. It's maddening! The last boss gauntlet is the pinnacle of this, which necessitated many resets. There were also a number of boss fights which require whittling down over the course of perhaps half an hour.

As you might be able to tell, I don't think it's a very good game. Thankfully, the battle system is fine and the menus are nice and responsive, so it goes on my "speedrun this when I'm retired and I have no cares or worries" pile.

My next two games to beat are Shin Megami Tensei III: Nocturne (might take me a while) and Motocross Madness (haha avatar racing game). Woo!