My Hero Sandbox

[2010-Sep-20] Getting Somewhere!

Panda3D Superheroes!In the last dev diary, SuperSquad had been setup with 8 different meshes and it was possible to move them around with WASD controls. Tons of enhancements followed over the next few weeks:

Hero files

Added a whole subsystem to read "hero" files from a specific folder and use the information in them to know what mesh to load, etc. SuperSquad's hero files are at the moment, simple CSV files (delimited by ";" rather than ","). Still adding to this, but here's where it stands

As you can see, the hero files are quite familiar but not quite the same as FF's. Major differences include:

Superman , Flash, Green LanternCamera controls
Panda's default 3d camera control is, IMO, not usable for a RTS-style game. So code was written to make it closer to what you would expect. To be honest, I'm still not 100% happy with it, but it's getting there. It's patterned after FF, since I am so used to that, but with a few differences. Will continue tweaking this

Collisions
Panda supports collision handling of 3d objects (which is good - otherwise it would be quite the pain to write a game like this). Added a little code at each character's creation, so they would no longer walk through each other. Instead, they push each other around.

AI
It was now around April 18, 2009 and I decided to take the plunge into AI. The first time I had ever done anything in Python was way back in 2002 when I wrote a little mod for FF called EZ Danger Room. Basically, it made characters chase each other and make decisions like should I fly or not? I actually dug up my old EZ Danger Room code to look at how I had done it and believe it or not, I was able to adapt it to SuperSquad without too much of a hassle. (Did have to learn about Panda intervals first).

Suddenly, things were in motion for real as the enemy characters started running after your squad. Panda3D Heroes fight

A few more revisions later (we were up to SuperSquad 0.1.8 at this point), and the foes were intelligently deciding if they should fly (taking off  and landing on their own). One simple change later and suddenly your squad members could do everything the foes were doing. I'm making it sound easy, but there was plenty of hair-pulling to solve glitches and bugs (rotation issues, animations, etc.)

Clicking Characters
One simple thing you're goanna need to do for a game like this is to click stuff - click where you want to go, click someone to fight, click an object to pick up, etc. Panda fully supports this, but to do so, you start getting deep into the collision system. There's a whole section of the Panda manual on collision handlers that I'm only now starting to fully understand, but by version 0.2, I had added the ability to select a character by clicking them.

Melee
By May 2, 2009, I was sick of the characters chasing each just to say "hi", so I added basic melee. You could now punch foes by clicking on them and eventually even knock them out. Plenty of bugs, though:

It did use STR to calculate damage and you and your foe's AGL to calculate % chance to hit and subtracts damage from foe's HP correctly. So it was a major step forward. This is one of the times (it's happened a few times before and after as well), that Tommy famously remarked, "it's starting to feel like an actual game!"

Panda3D Heroes brawlWhen I code, I really make an effort to use as little code as possible (less code=less bugs is an old programmer's mantra). Also, always trying to write code so it can be reused. So I was very satisfied when just adding 1 line of code suddenly made the foes capable of fighting back!

Version 0.2.4 added basic flying melee. Tommy is hard at work as I write this to add some new animations to this, but the basic logic is fully functional.

BTW - our test scene, even now, is JLA vs. Avengers as those are the sample meshes and skins that Tommy made.

Maps
At this point (May 23, 2009), also added the concept of "map" files. These are plain text files that are read by a function in my code to create the scene. Obviously, they will be created by a still-to-be-made map editor eventually.

For now, I just created a quick map in Notepad:
#TERRAIN;name;model;pos;hpr;scale
#OBJECT;name;model;pos;hpr;scale
#SKYBOX;name;model;pos;hpr;scale
#LIGHT;name;type;color;pos;hpr
#HERO;name;model;pos;hpr;scale
#FOE;name;model;pos;hpr;scale
T;map;world;(0,0,0);(0,0,0);(1,1,1)
S;skybox;skybox;(0,0,0);(0,0,0);(800,1600,1000)
O;dustbin;dustbin;(30,20,0);(0,0,0);(1,1,1)
O;dustbin_lid;dustbin_lid;(30,20,13);(0,0,0);(1,1,1)
O;lamp_post;lamp_post;(20,20,0);(0,0,0);(1,1,1)
O;pave;paving_slab1;(0,0,0);(0,0,0);(1,1,1)
L;light_1;ambient;(0.3,0.3,0.3,1);(0,0,0);(0,0,0)
L;light_2;directional;(0.74,0.7,0.7,1);(0,0,0);(0.7,0.2,-0.2)
H;superman;superman;(100,0,0);(0,0,0);(1,1,1)
H;batman;batman;(75,0,0);(0,0,0);(1,1,1)
H;wonder woman;wonder woman;(50,0,0);(0,0,0);(1,1,1)
H;green lantern;green lantern;(25,0,0);(0,0,0);(1,1,1)
H;flash;flash;(0,0,0);(0,0,0);(1,1,1)
F;naked guy;male_basic;(100,-400,0);(0,0,0);(1,1,1)
F;hulk;hulk;(75,-400,0);(0,0,0);(1,1,1)
F;iron man;ironman_21;(50,-400,0);(0,0,0);(1,1,1)
F;captain america;captain america;(25,-400,0);(0,0,0);(1,1,1)
F;hawkeye;hawkeye;(0,-400,0);(0,0,0);(1,1,1)
F;thing;thing;(-25,-400,0);(0,0,0);(1,1,1)
Superman and Captain America combo
Movement Controls
Switched to point-and-click movement like a traditional RTS, which required more collision system code. WASD controls are still in there, though.

Pausing
Yeah, RTS games can be hard, so of course, a Pause feature had to be added. Not hard to do, but like much in Panda, you have to code it yourself.  Remember, it's an SDK , not a "game creator".

Skins
We definitely wanted for skins to work like they do in FF, where you can choose a skin folder for a model to use. This turned out to be quite tricky in Panda as models have multiple image files mapped to them, etc. Eventually, got some code working that did the trick and this is now called when loading your character, to set the skin to the folder specified in the hero file. On this page you can see an early test pic of the Supes model using Cap's skin. Doesn't look bad, actually...

ArtPanda3d Superheroes wiremesh
Throughout this, Tommy was creating tons of new animations (remember we wanted everything in the game to be original) and adding an occasional character to the roster. He also did lots of great research into Physics and LOD (level of detail). Things we may implement later.

Other stuff
After fixing all the melee issues, I added various miscellaneous features, usually just because I had just heard about them on the Panda forums. The picture at the left shows an option I added to show the scene in wireframe mode. I also added options to remove all textures from the scene, and take screenshots.

But Then....
It was now June 9, 2009, I had started to look at adding title and menu screens (no idea how to do it :) ). But then ... all work on SuperSquad stopped. Why?