Game Development Community

dev|Pro Game Development Curriculum

Warscale 79 - Covering large areas

by Guimo · 10/26/2010 (10:28 am) · 2 comments

www.spritekin.com/warscale/warscalelogo.jpg
Hi everybody!
Long time without a blog! I know a lot of you would like to see Warscale finished even if is just for me to stop blogging here. So let me tell you I'm a step closer to make your dreams come true.

The last weeks have been hard word as usual and unfortunately the wather here in Sydney has been crazy. So I was forced to stay at home mostly and of course that means getting beaten again an again against the floor by my superheroic son. It also means that while he sleeps and I finish rubbing my aching bones, I can work a little on Warscale.

Areas
You know when sometimes you program and develop 95% of the program but there is this 5% which is very very important but you deceive yourself thinking it is not. That is something like what happened with me this weeks. I really thought the spell system was solid, and I was able to take the game to a point where I can make complex selections with the spells and expanded the spell system with some tricky spells and I was happy.

But then, an important type of spell in any RPG are area spells. That is, spells which are placed in an area and then affect any unfortunate soul entering its area of effect.

Anyway, I knew I had a big problem when I found this function in my code:

function WSEffect::areaSpellAffectsUnit(%this, %unit) {
echo("**************************************************************************************");
echo(" Area effects determination is not yet defined ");
echo("**************************************************************************************");
return false;
}

Really... this means I previously observed the problem and said... naaaaaa... not today... and of course being a vital part of all the spell system, trying to add this feature when everything is already in place was like trying to stop a truck without brakes down a slope while drunk and with your hands tied to your back... and you are not driving the truck, you are on foot pushing and have no socks... I think you have the idea...

So, I had to solve the problem maybe not completely but well enough to make everything work in such a way which allows me to expand later. The final objective was to solve one of the most well known and typical spell for a wizard... a Wall of Fire!!!!

So I started by imagining a very simple spell, a fire column like this one:
www.spritekin.com/warscale/wsascreen79a.jpg
This is a nice spell, just one tile so no problems with complex shapes. The first step was creating a pick mechanism. I have improved the picking mechanism a lot but in order to support a wall of fire I was forced to make some initial fixes to the area selection algorithm.

The next step was to make a server side processing for the spell. An the problems started. I had to add support for tile lists in the spells so each spell knows which tiles are being under its area of effect. Not only that, for some spells, if the caster moved, I had to make the area to recompute. This is planned so later it will be easier to add spells like blessign auras for paladins. After that, knowing which units were affected by the area of effect was fairly simple.

Now the biggest problem. I really was dreaming movement would be as easy as chess, pick where you start, where your piece goes and the unit will dissapear from one point and appear in the final position. Obviously that behaviour will work for teleporting creatures only, for walking or flying creatures that behaviour would make the Wall of Fire I wanted to create just useless...

So the solution was to process step by step. Take the unit out of a tile, place it in the next tile in the path, then ask for spell effects which affect the unit, apply the effects, the move again and go on until the destination is reached.

I was forced to create new controlling events in order to manage when a creature enters or leaves a tile. In turn, if you analyze when moving in or out of a tile, then you can find when the unit is entering and leaving an area of effect. For each step in the unit path the areas are analyzed and every spell affecting the unit are checked. This brings very interesting possibilities, this is not yet implemented but now in theory is possible to code attacks of opportunity which will happen whenever an opponent unit moves out of your reach. Basically, if a unit runs, you are allowed to hit. This makes melee fights way more interesting but double so for the avatars.

Previously an avatar closed into combat against other avatar, the other player would simply flee away with no penalties, now if you try to flee the other avatar gets a free attack. Seems simple but it allows for a game mode I was looking for a long time which is the fast game mode. In a fast game each player has up to 15 seconds to make a single move, be it an attack, a move, a special ability or casting a spell. Once the action is done, the initiative is passed to the next creature in the list. So the game becomes way way faster for those souls like more action but you can also start in a tactical mode for those who like a strategy game.

But as usual the implementation of the event active movement required more and more hacking in so many levels. Enough to say I managed to make it work.

Wall of fire
So after implementing the column of fire the logical complement is the Wall of Fire.
www.spritekin.com/warscale/wsascreen79b.jpg
Both spells are similar except the wall of Fire extends in a line. Now this came into a math problem of transformations, rotations and adjusting to map coords. It also required more hacking but the result is this:
www.spritekin.com/warscale/wsascreen79c.jpg
The plan for this week
Area spells something great to have. Now I will focus on creating one more spell which is the Poison Cloud. This one will force me to implement an square area of effect. I had plans to create a lightning bolt spell but I will leave it for now.

The second thing to implement this week will be the attacks of opportunity. Once that is finished, I will implement the fast game mode in two styles, a normal mode (20 secs/move) and a fast mode (10 secs/move).

And testing of course. These are new features which will be all released at the same time.

Nothing else, have to go back to work. See you next issue with more boring stuff!!!

Good luck with your projects!
Guimo

P.S. Looks like my subscription to the Independent Game Festival is working fine. Judges have already connected and I have more players subscribed already. More on this later.


#1
10/27/2010 (12:20 am)
Best of luck with the IGF!..I'd love to see this game on steroids!

#2
10/29/2010 (10:16 pm)
Alright. Now I can see your progress.
1 particle ea for spells to get room for your datablocks.
The system up there looks intuitive and easy to use, and addictive.

I'm sure you will have just enough memory to avoid too many duplicate cards in your hand at once.

Poison clouds are a hoot. Awesome work!