Archive for August, 2008

Platform game WIP post 1

August 22, 2008 1 comment

I’ve started writing a platform game. My feature list I’m aiming for is based on games like Mario and Sonic, so moving platforms, enemies you can kill by jumping on them. But I also want to put in more advanced features like wall climbing, swinging on ropes, large sprites, full screen graphical effects, etc….
The main problem you hit when writing a platform game is deciding how to structure the levels in memory. I’m going for a basic approach of using a 3 dimensional array.  The first two dimensions are the grid reference of the map tile, and the third is the type of tile. So map(3,4,0) would be the tile type at grid ref 3,4, and map(3,4,1) would be the collision type of that same tile. A value at map(5,8,2) is an object at that grid reference, right now I’ve got coins and alcohol workign as objects to pick up. Coins give you points where as alcohol bottles make the whole screen go wavy using a simple screen effect I came up with recently. I’ve almost finished deciding how to put in the enemies. As the enemies won’t be set in place at map coordinate, they will have starting coords, then move freely from that point, so enemies will exist outside of the map array as seperate objects of my enemy type. The enmy type contains fields to cover things like: movement speed, graphic name, behaviour, hit points, etc…. I’m hoping to be able to expand this to use it for RPG characters in a later game.
Anyway, back to the map editor, I’m going to try using a GUI module for blitz3d, there’s a number of free one’s available from the blitz website that look pretty good. I’ll want them to be able to access different tiles and objects for placing on the map. Currently it works by pressing the space bar to switch between tiles and objects, and then scrolling the mouse wheel to switch tiles or objects. REally I want a grid showing all the tiles so I can select tiles from there and also see all the objects and any other features to add to maps. Such as player starting places and enemies too. I also need to be able to specify level size, background graphics, weather effects, and any other settings for the level such as time limits and where doors lead to, the list is pretty endless. I think the main things is to get the basics working first, enough for a simple game to work, then add things to it one feature at a time, until I have a complex level editor. Of course the game has to be able to handle all these features fo the levels too, so any level loading code is shared betwene the level editor and the game using an include statement. This also makes it important to use the same variable names in both the editor and the game. I’ll be trying to share as much data as possible between the two actually as this will aid me in writing further games. Having seperate modules of code, which you can include in other code, is the first steps in writing a game framework, so I could have common code for menu screen, loading screens, options menu’s, controller config screens, that sort of thing. This way I can have several games all being written at once, and fixing a bug in one will fix the same bug in all the other games. Obviously a map editor would only be good for platform games or rpg’s, but other modules such as menu systems, title screens, options screens, would be transferrable over to any type of game. same goes for highscore tables and split screen multiplayer code too.

Obviously with a map editor, there’s no reason I could change my game code to be C++ based instead of Blitz, and keep the map editor written in Blitz, the only problem here would be that the map loading code would need to be re-written into C++ meaning changes to the map code would need to be written both in blitz and in C++.

Anyway, enough rambling, I’m off to go code something. I’m uploading a video fo my platform game tonight, so you can see how far I’ve got with it so far. I’ll also be doing a series of video tutorials on how I implemented different features in the game as I go along. The tuorials may take a while to appear though as I want to be happy with the code before I do a tutorial on it.

My youtube channel is:

%d bloggers like this: