Archive for March, 2009

A Century!

According to my stats Caverns of Underkeep has been beaten 100 times!

And I’m still not one of them.

2 Comments

Response to Two Major Decisions to Make, Part 2 – Maps

The other question I was pondering with respect to my Indie RPG was how to deal with maps.

I thought that implementing an Ultima7 style continuously scrolling seamless map would be cool as there are not many tile-based RPGs that do that sort of thing. I even sketched out an algorithm that was based on a tree that would grow and store neighbouring maps in memory in order to stitch them together at render time, and I’m pretty confidant it would work quite well.

However, I’m not going to do it.

And the reason for that is because I’ve been thinking about the story line and other aspects of my game and it’s now going to be delivered in a series of episodes!

Having a seamless map kind of makes sense if you are planning a huge world, but as each episode is going to be its own game having the traditional style go to the edge of the map and load a new area makes more sense.

Delivering a series of episodes means smaller development cycles and a tighter focus per game. I think I’d rather play shorter games as I mentioned in Too Many Games to Play

Now that I’m done thinking about things, I can go forth and actually start producing some real work!

1 Comment

Response to Two Major Decisions to Make, Part 1 – The New Resolution

So a little over a week ago I posted about two fairly important decisions I had to make about my Indie RPG and after pontificating over a couple of hundreds of dozens of cups of tea, I’ve reached my decisions.

Decision One : The Resolution

Will be 1024×768 or 1024×700 in windowed mode – The extra 68 pixels in fullscreen mode will contain a little border graphic, the reason for a difference between windowed and full screen is because if you are playing on a laptop like mine and you only have 800 vertical pixels to play with and approx 80 of those are taken up by the taskbar and the application window, in order to fit the game on the screen, you have to cull some pixels.

This means that the game will look large enough to be played in windowed mode, so people won’t feel the need to go to full screen to get a more immersive experience and my old school pixel art won’t look all blurry when the game is played at non-native resolutions. Of course, if you were really old school you’d have a CRT monitor anyhow.

I may also offer a widescreen mode down the line, but I’m not promising anything at the moment.

1024×768 also allows me to have larger, easier to read text on the screen which is good for older more experienced people :)

The tilesize is going to remain at 32×32 at least for now. I’m going to make use of some stock art assets found around the internet and in the RPG Maker community for now so I can begin to piece togeather the game without having to fork up heaps for custom art assests straight away.

2 Comments

Too Many Games to Play

I’ve got a long queue of games that I would really like to get through. As many of these games are more than a couple of years old, it’s no wonder why I haven’t got one of the current generation consoles, or upgraded my PC to play newer titles.

The queue is looking something like this…

  1. Portal (Second time, with commentary)
  2. Half-Life 2 (and the rest of the Orange Box)
  3. Beyond Good and Evil
  4. Disgaea
  5. Kingdom Hearts (I & II)
  6. Digital Devil Saga II
  7. God of War I & II

And the list goes on, but we’ll probably start going into the list for 2010.

So who wants a shorter, tighter and more focused gaming experience? I often find myself wishing that games were shorter as I’m playing them so I can get to the end and on to the next thing.

I’m the same with books too, I look at books > 300 pages with just a tiny hint of suspicion.

No Comments

Two Major Decisions To Make

I haven’t got much actual programming on the game done this weekend because I’m faced with two rather major decisions to make before progressing too much further least I change my mind and have to undo a whole lotta work.

The first is whether or not to create the map a seamless world like in Ultima7 – I kinda want the game to be completely playable using only the mouse and to keep the player in the centre of the screen – Using the same mouse controls that are in Caverns of Underkeep

This becomes a little bit strange when the player comes to the edge of maps as I either A) Have to break this rule, or B) Add a lot of padding to the maps so the player doesn’t just see black tiles around the maps edges – This was ok for Caverns of Underkeep as the game takes place inside of a cave, but it looks a bit funny on maps that are supposed to take place in a forest.

So the decision to make is do I enforce padding on maps? Leave a border made up of black tiles? or make the overworld seemless?

Enforcing padding is more work when it comes to design maps, as it is time spent dolling up what are effectively non-play areas.

Seemless overworld is more upfront work for me (as I have to implement a cache tree of some kind to load and unload adjacent maps in order to hide load times.) But would scale alot better – And besides I don’t think there are many other old school style RPGs that do that kind of thing – With the exception Ultima7 already noted.

The second major decision is what kind of resolution to run in, which effects what size each individual tile should be, which effects the time and skill required to make good looking tiles, which increases my budget required to get the game finished.

Originally I planned to run in 800×600 – But I just fired up fullscreen mode on my 19″ LCD and it looked like complete arse due to the game not running at native resolution. I can’t even take a screenshot because this is a physical hardware problem due to the physical nature of LCDs – But you can reproduce the effect if you want, go find some perscription glasses for which you are not perscribed and wear them.

Many game developers will fix this by rendering at some fixed rate, say 800×600 and then scaling up to whatever the native resolution should be. Thats fine for anti-alised games or vector graphics games, but mine is very purposefully supposed to be pixel art and when you’re working with discrete pixels you don’t get nice scaling without distorting your image.

Adding to the complexity, there are widescreens, non-widescreens and crts, all running at various resolutions and each with various native resolutions, I have to come up with a solution that will not look like arse to one particular group and at the same time doesn’t compromise the entire look overall.

I’ll let you know what I decide when I decide.

3 Comments

Fun with C# and in-memory linq queries

Linq is probably one of my favoriate features of C# and to show you why here is a quick code demonstration.

Quite often you want to write some code that has to iterate over the collection; For example: Finding an element in a list of to see if it is present.

For a program I’m working on at my day job, I decided to implement a rule that says each account must have at least one user who has admin rights for the account, and here is some code that checks that condition.

(Note to self: Find good code formatting plug-in for wordpress)

bool AtLeastOneAdmin = false;
foreach(User u in Users)
{
        if (u.isAdmin)
        {
                AtLeastOneAdmin = true;
                break;
        }
}

Pretty straightforward, Now lets write the same code using Linq:

Bool AtLeastOneAdmin = (from u in users where u.isAdmin == true select u).Count() > 0;

That does the exact same thing and only takes up one line of code!

No Comments

Embarassing Code

Like any art – As we game programmers grow in our skills and abilities more often that not we can look at our past projects and be embarrassed at some of our ideas and implementations.

Most people don’t get to look at your code, unless you’ve released open source software of course. Infact, I’ve heard a good reason to make your project open source is just because other people can look at it, for that reason alone, you are compelled to make it good.

I’ve had a few “what the hell was I thinking?” moments which each of my finished games, and that’s just the finished ones. Some of the unfinished projects that never saw the light of day had horrendous ideas – like that time I tried to implement my own scripting language and parser in VB 6 with a whole lot of select statements and if-then-else trees that ended up wider than the Mississippi.

I would still like to program my own scriping language (or Domain Specific Language or DSL as all the cool kids are calling them these days.) But now at least I know it’s a difficult problem that involves a lot of Hardcore Computer Science™

So here are a few things in my finished projects that I implemented bady

  1. Star Cars – My first serious attempt at becoming an independant game developer was a 3D arcade title that I no longer advertise on this site due to vista incompatabilities and requiring a hardware transform and lighting supported video card. It had this had a really long, really complex collision detection algorithm that got to the point where I didn’t actually know how it worked. It got that way by me trying to solve the problem, attempting a solution, where-in the implementation would cover 80% of the cases, then I would just hack it until it worked. There was one edge case that I could never figure out – It turned out that it was easier to change the level mesh, than try to debug that horrible code.
  2. Caverns of Underkeep – Most of the design decisions for Caverns of Underkeep turned out very well, infact most of the game engine structure is being ported to my current project, but there is one part of the code thats just downright bad. And that’s how I implemented the modal dialogs – I did this weird thing where I would put the gamestate into a “modal mode” and all events would be routed from the active game state into the modal dialog class and then I would poll an object until its value was non-null which would return the gamestate back into its normal state, passing the newly created object back to the client gamestate – Don’t worry if you didn’t follow that, it’s kinda hard to explain without pictures and flow charts and things, which kind of illustrates my point. Now this method worked, but it was stupidly complex, my new method of rendering modal dialogs is to do a hit detection against GUI elements before they can process events, and simply masking the background so only the dialogs elements are exposed to the hit detection.
  3. Attack of the Meeplings – Originally Attack of the Meeplings was going to have powerups and I had this cool idea for a spread gun, unfortunately I couldn’t track down a bug in my code that was not allowing for symmetric vectors for the bullet paths, ie if v is a vector then v mirrored would not have an angle symmetric with v which gave it this lopsided look – I played with this for a day before just giving up and cutting the idea of powerups. I think it had something to do with the location of the centre pixel of the bullet, the spawn location of the bullet relative to the player, and the fact that I was rendering at discrete values (ie pixels) on the screen. Really this problem shouldn’t have been all that hard to solve, but I decided at the time it just wasn’t worth it to fix.

1 Comment

rQuest – End of Febuary Update

No screenies this month, and possibly not for a wee while – I’ve mainly been writing code.

This month I worked more on the level editor – You can now place monsters in a map and edit the walkable areas (as well as set tiles to have a default walk/no-walk flag, which pretty much means you don’t have to set no-walk areas at all…)

I also did more work on the C++ game engine side of things. Most of the engine is a port of the Java class structure from Caverns of Underkeep – With some improvements and refactorings and taking into account that this game is going to be more data-driven.

So at the beginning of the month I did what I almost never do and wrote a class diagram on a scrap piece of paper, showing inheritance trees and associations between objects, I’m sure my diagram doesn’t follow the UML spec what-so-ever, but it was helpful enough for me to start fleshing out the header files, and providing some basic implementation for the classes that I was going to be working with.

The feature that took me the longest to implement was remembering how to load data in C++ and convert it into some meaningful structures that the game can use. This turned out to be a pain, Esp. as I use non-null terminated strings of arbitrary length in many places – And I’ve mainly been working with garbage collected languages for the last 3 or 4 years.

So I spent quite a while in the debugger that day.

For example:

  • When reading a file do I use .read() or .get() on an input stream. Which method increments the read position pointer automatically and which one doesn’t? (Hint: The first one I used didn’t.)
  • If I create an object on the stack and then add it to a collection, what happens when the object goes out of scope? (Does it make a difference if it is a value type? Should I declare it on the heap? Should I store a pointer or a copy?)
  • Why aren’t variables initalised to reasonable values, such as NULL for objects and 0 for value types?
  • How do I create a dynamic multi-dimensional array that I can resize? (Hint: ObjectName **myArray) – And how am I supposed to clean up the memory when I resize it?
  • Why are strings such a pain? How can I easily convert from char * myCharString to String myString? And back again?

So it probably took me about an hour to write the save/load map functions in the C# map editor and about 8 hours to write the equivalent feature in the C++ engine. (Too be fair, if I used C++  instead of C# every day at my day job, I’m sure the converse would be the case.)

That said, the C++ engine can now display maps created in the C# map editor, which is pretty cool.

Next month will probably be working on UI components and maybe getting some basic AI/Combat in place.

2 Comments