Game Development Community

dev|Pro Game Development Curriculum

Warscale - Coding frenzy

by Guimo · 03/18/2008 (9:09 pm) · 1 comments

When I started writing these blogs I had already programmed many features of Warscale. I had the database and master server up and running. The Network architecture organized. The Login procedure working. Even the game room creation was working.

But then, I noticed that in order to start a battle I had to define the armies for the players. And that required to define the different objects in my game like creatures and spells. And each one of them should have certain properties. Creatures required a name, mana cost, hitpoints, mana recovery, attack, defense, damage, movement types and ranges, special abilities and so on. And Spells required areas of effects, targetting filters, effect resolution and to solve how was everything going to work.

This Torque version of Warscale is fairly more advanced than the one I programmed as a prototype with my engine. Having learned something from my previous version, I knew that some kind of creature/spell editor was required. Being a fan of Dungeons&Dragons and Magic The Gathering (MTG) I wanted the game to be faster than playing MTG Online but also to bring some complex elements to the mix so that the game could be easilly enhanced. But how to know the scope of the editor if I wasnt sure about the attributes on the creatures? How was I going to handle a magic items... how to define a fireball, a vorpal sword, a paladins aura, regeneration?

Obviously there was a list of the attributes I wanted to handle in the game... but the distance from what you want to handle to how to handle them is usually a large one.

The common sense told me that I should start programming step by step. But again, my experience with the previous version taught me that this kind of approach leads to write and rewrite and reorganize and delete code. This cries about time being lost and time is the most valuable asset for any Indie. An hour you spend coding is an hour you are not there with your family.

So I decided for another approach. Code... code... code... dont test... dont debug... assume your code is fine and keep coding. In my head I had my objective and I had the list of features written down. So just keep coding and fixing issues in the fly. Maybe compile from time to time just to check for syntax errors but keep fleshing your game.

The first step was to define the game structures and the classes that would be required. I made a rough sketch in a paper and wrote the scripts that would be required to create those objects separating them in appropiate cs files. Then I coded the basic relations between the objects. A battle requires a map and players, and the players have spells, so create their stacks, and hands and used lists. Then the game will start and you will need to shuffle the stacks, deal spells to each avatar. Then the avatars want to play a spell so how to place a unit in board and so on... On this first step I only used prototypes. I didnt even coded those functions because I knew many of them were going to change in the end. After that, when the functions locked in place and their parameters and behaviour was defined I started to flesh them out. How to handle path finding, how to filter the speel targets, how to add them and delete from the game map, how to invoke an spell.

So, I have been coding in my free time for the last three weeks and now I can see the light. The game logic is almost finished. There are still a lot of features to implement but the object structures are almost finished and everything is fixed in its right place. Now I know which data I need to pass through the network and which actions to execute on each event. Now I know which attributes are required for each creature and spell and I have them working smoothly... at least at theorical level because I havent tested them yet.

You know... I feel like Dr Frankenstein with his monster laying there, waiting to be wakened up.

I feel that I have saved a lot of time by doing this. Now I can write the object editors (50% finished as I write this) and I know which attributes I must include in order to handle each spell, creature or item. And believe me if I tell you that my initial attribute list has increased a lot. But I know how everything will interact and if I need to rewrite something I feel it will be just a minor change.

As a downside, I dont have any screenshot to show... :)

I like this. I still see a couple of weeks of programming before reaching a point where I can start the debugging, but I feel really sure of my final destination. I think I will keep writing everything this way.

Luck!
Guimo

#1
03/19/2008 (4:50 pm)
Wow, sounds like you really know what you're doing. Hope I can hit the same marks.