Welcome back ... at the end of the last installment,
Tommyman had discovered plutonium ... that is, he'd successfully
converted one of his meshes to Panda format.
A flurry of
activity occurred over the next several days as we poured over
the Panda documentation and learned all we could.
Tommyman converted more meshes and started adding animations. He
gushed over the capabilities of the Panda engine - bump maps,
blending animations, half-body animations, sharing animations
among meshes. All things that we knew FF couldn't do, but could
be achieved with Panda.
I started looking at how to code
this thing. The Panda documentation is all online and I just
started working through the introductory tutorial. In 2 minutes
and using only Notepad, I had a panda walking across the screen.
Something I hadn't done in 2 years with other game engines.
Tommy threw his Hulk and Thing
meshes into one of the Panda sample programs. It was great fun
discovering how easily we were seeing amazing things on screen.
I played around with the code that controlled camera movement to
make it work more like FF.
Tommy and I both set out to
start building our dream superhero games, agreeing to share art
assets (which was very nice of him as I had none :) ), and help
learn the coding side (ah, I can help there ... :) )
As
I think he's stated elsewhere, his was more action-oriented,
i.e. Marvel Ultimate Alliance or even fighting-game like. Mine
was Super Squad, more like Freedom Force,
RTS-style. Remember, I had designed all this in my head as a
turn-based game years ago. FF just made me see how a real-time
version could work.
FILE- MAIN.PY
from supersquad import *This code also requires a supersquad.py file which I created:
loadMap("world")
hulk = loadChar("hulk", (0,0,0), .5,.5,.5)
thing = loadChar("thing", (5,5,5), .5,.5,.5)
run()
FILE- SUPERSQUAD.PY
import direct.directbase.DirectStartMy thought was to write a library of functions (supersquad.py) that "issue" files would call.
from direct.showbase.ShowBaseGlobal import *
from direct.interval.IntervalGlobal import *
from direct.gui.DirectGui import *
from direct.showbase import DirectObject
from direct.actor import Actor
from direct.task import Task
from pandac.PandaModules import *
from direct.showbase.PythonUtil import *
import random, sys, os, math, glob
def loadMap(mesh, pos=(0,0,0), hpr=(0,0,0), scale=(1.00,1.00,1.00)):
print "Loading model: " + mesh
map = loader.loadModel("art/objects/" + mesh + "/" + mesh)
map.setPos(pos)
map.setHpr(hpr)
map.setScale(scale)
map.reparentTo(render)
return map
def loadChar(hero, pos= (0,0,0),h=0,p=0, r=0, scale=(1.00,1.00,1.00)):
char = Actor.Actor("art/characters/" + hero + "/" + hero)
char.setPos(pos)
char.setHpr(h,p,r)
char.setScale(scale)
char.reparentTo(render)
return char
I'm kinda embarrassed to post this as it doesn't do much - just makes 2 characters appear on a flat map. Plus, it is quite sloppy code (too many imports, too many parameters as I would learn). Still it showed me that I could start getting the hang of this. I quickly added loading of animation files and a moveTo function to get these dudes moving around.
Around this time, Tommy went Panda-exclusive (stopped doing FF stuff for a
while) as he was learning how to best export meshes and creating all-new
geometry, animations and skins. We agreed that we wanted everything in the game to be
original, that is created for the game itself. We didn't know if there would
ever be a finished game, of course, but we wanted it to be something we had done.
That being said, moddability, was (and still is) high on the list of things to
deliver. We want people to do stuff with it in the future.
I quickly did a new version of Supersquad that
read little text files (i.e. "hero files") from a folder and used the
information in them (name, mesh, skin, stats) to know how to load a
character and their animations.
I added WASD controls to walk
around, put up little portraits (can't click em, but they look cool),
and you could press the number keys 1-8 to choose which squad member to
control. Yes 1-8! Unlike FF, I wanted there to be the possibility of
having big squads. A 7-man Justice League needed to be possible, dammit!
You can see the fateful initial screenshot of the original lineup to
the right! As you can see, Tommy had converted more meshes and
animations.
And it was now April 11, 2009. The first week of
Panda excitement had come to an end.