Game Development Community

dev|Pro Game Development Curriculum

Warscale 78 - Particular Problems

by Guimo · 10/10/2010 (12:14 am) · 3 comments

www.spritekin.com/warscale/warscalelogo.jpg
Hi everybody!
My wife left me... now I don't know what to dooooo...

Ok ok, lets not dramatize, her company sent ser to Chile for two weeks and she will jump to Peru on the weekend to visit parents and friends in a blitzkrieg-style family reunion.

Of course that leaves me in charge of my house and my 3.5 old son. I have to leave and pick him up from the child care every day. Cook, clean the house, etc and of course go to work. The modern househusband.

Now, I love playing with my son and reading him his bedtime story. But sometimes... lets say if when he is older he asks me why he has no brothers I will tell him 'It's your fault son...'.

Anyway, after my son goes to sleep, and given I have no wife to tell me to take out the garbage I got lots of free time, and thats good for Warscale. By the way, one of my theories is that if no men existed in the world but just women, then all the cities would be a huge dumpster as there would be noone to take out the garbage.

So I have long wanted to solve a problem with the gameplay which is really important in a strategy game and is tracing your path. But I think I need to go to the basics first.

Movement spells
A friend, old time board and card gamer, is helping me with a lot of things. One of his suggestions was to make some small spells like this one:

www.spritekin.com/warscale/wsascreen78a.jpg
Now to be honest I thought, what a waste of effort. Push a creature one space? What for? To make you feel like a Jedi?

But I was intrigued so I decided to implement it.

How wrong I was. To say it was difficult would be an understatement. This innocent spell forced me to hack even more things into the game logic than I thought possible. The good thing is that it helped me debug so many things I'm completely glad I did. The art here is from Michael Yatskar of Sleeping Paint.

Small ir elemental
So I usually create one creature based on each ability and in this case for me, the obvious creature for a pushing ability would be an air elemental.
www.spritekin.com/warscale/wsascreen78b.jpg
I have always loved Elementals in the D&D games so I was delighted to try. The first problem was to get a nice elemental, but in the RTS creature pack from Ori Cohen there is a stoneman. Now the only problem with that model pack is that it uses 3DMax and I got no license for that. So I decided to hack the file... I hope TorquePowered won't open a lawsuit given I'm reversin engineering the files.

Anyway, I found that the material information in a DTS file is saved at the end of the file including file names and the blending modes. Open the file in a binary editor. Is quite easy to find the texture handle (in this case base.stoneman) and you will notice right after the texture name there is a small 'g' for normal opaque textures, but that letter is a G for transparent textures. I chaged that value and it worked! The engine will now use alpha for the texture. Other texture modes (self illumination, etc) have a different value but they are easy to peek, just try it, export something in different texture modes then look at this letter.

Now, that said, I really need to export the model in other styles. Hope someone here can give me a hand with this.

Particles
The second part on implementing the air elemental were the particles. I really wanted something like a tornado but all the solutions were just too complex and requires too many particles for my taste. So I went for a simple smoke-like emitter. I really wanted to implement something like a particle atractor which is something missing in the TGE but I can live without that.

So I went and created this small smoke effect for the air elemental. It works with TGE 1.5 and AFX 1.02. I dont know if it will work on any other engine.
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// Warscale Effectrons
// Based in code fund somewhere in the GarageGames website, can't remember the original post.
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//

// style numbers
$WSSelectronStyle_Tornado = 51;

//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// Flat web Selectron

datablock ParticleData(TornadoParticleData_P)
{
   //allowLighting = true;
   dragCoefficient = 5.0;
   windCoefficient = 0.0;
   gravityCoefficient = -0.6;
   inheritedVelFactor = 0.0;
   constantAcceleration = 3.0;
   lifetimeMS = 900;
   lifetimeVarianceMS = 300;
   spinSpeed = 5.0;
   spinRandomMin = -50.0;
   spinRandomMax = 50.0;
   useInvAlpha = true;
   animateTexture = false;
   //framesPerSec = 1;

   textureName = "warscale/data/shapes/particles/smoke";
   //animTexName = "";

   // Interpolation variables
   colors[0] = "1 1 1 0.1";
   colors[1] = "1 1 1 0.8";
   colors[2] = "1 1 1 0.3";
   colors[3] = "1 1 1 0";
   sizes[0] = 0.1;
   sizes[1] = 0.2;
   sizes[2] = 1.2;
   sizes[3] = 1.8;
   times[0] = 0.0;
   times[1] = 0.1;
   times[2] = 0.8;
   times[3] = 1.0;
};

datablock ParticleEmitterData(TornadoEmitterData_E)
{
   ejectionPeriodMS = 70;
   periodVarianceMS = 0;
   ejectionVelocity = 1;
   velocityVariance = 1;
   ejectionOffset = 0;

   thetaMin = 0;
   thetaMax = 30;

   phiReferenceVel = 720;
   phiVariance = 180;
   overrideAdvance = false;
   particles = "TornadoParticleData_P";
};

//A basic offset
datablock afxXM_LocalOffsetData(Tornado_offset_XM)
{
  localOffset = "0 0 0";
};

// Tornado wrapper
datablock afxEffectWrapperData(Tornado_EW)
{
  effect = TornadoEmitterData_E;
  delay    = 0;
  constraint = "target";
  //posConstraint = "target";
  lifetime = $AFX::INFINITE_TIME; //7200;
  xfmModifiers[0] = Tornado_offset_XM;

};


datablock afxEffectronData(TornadoEffectron)
{
  duration = $AFX::INFINITE_TIME;
  addEffect = Tornado_EW;
  execOnNewClients=true;
};

Invoke this effectron and set the constraint on the target creature. The result looks like this:

www.spritekin.com/warscale/wsascreen78c.jpg
Now, I liked the result, so I went and implemented a similar solution for the Hell Hunter which you can see behind the air elemental. Looks nice in my opinion. The fire and tornado effects emit particles at a relatively slow rate, so they won't take much render time.


Path
Rght now, when you start your movement, warscale paints every position you are allowed to move. What it won't paint is the path the unit will take. This may be quite dangerous if in the path you find a Wall of fire.

On the other hand, I may implement an algorithm to move around dangerous tiles, but indeed, in a changing environment, the definition of 'dangerous' can be quite ambiguous. Indeed you may even want to go through the dangerous area on purpose.

So, the simple solution is to be able to paint a path through the walking area so the player can pick how to move at any time. The code is working fine but I have no time to make a video. Two weeks have passed since my wife left and we are just now two hours to her arrival. I need to clean the house so she won't find that large debauchery.


The plan for this week
I will create the column of fire and wall of fire. Both are static spells which remain in place and burn creature entering their space. This will be hard work.

Luck!
Guimo

#1
10/10/2010 (11:04 am)
I really dig this project. nice to see your progressing Guimo.

One thing, that itched my eye though. It looks as if the wind emitter is ground up, my suggestion would be to have it 'mid-model' down, that way the density of the air would look more compact from top to down, as its current look makes its waist too transparent compared to 'foot level'.

Maybe its the field glow thats tricking me, anyways. good work and keep up the spirit.

PS: That persistent wall and entering burn creature thing, theres already a afxa spell 'ring of fire' doing that
#2
10/10/2010 (12:12 pm)
Thanks Christian!
The purpose was to simulate a tornado so I guess the vortex should be at the bottom but I understand your suggestion. Indeed it was my intention to do that with the water elemental so that the particles look like a waterfall.

I'm using TGE so unfortunately AFXA is not an option.
Luck!
#3
10/12/2010 (4:06 pm)
Love seeing the regular updates to this. :)