Army Guys...Again

Blitz3D Forums/Blitz3D Programming/Army Guys...Again

Doggie(Posted 2004) [#1]
OK. I've knocked together a basic animated sprite walking around in a simple world. The deal is the sprite is always facing towards the players eyeview so the animation is not correct based on where you are standing. I tried using 4 sprites at 45 degree angles but you can see all 4 sprites at the same time no matter what I tried to do for spriteviewmode.
So, since the basic code is provided and all the anim strips you should need for 4 directions, I'd be much obliged if someone knows how to successfully code a 3d sprite.

Thank ya kindly
get the zip file here
http://home.comcast.net/~d.inman/BEEKEEP.ZIP


Rook Zimbabwe(Posted 2004) [#2]
There was a basic game making tutorial that had what I think you seek... You had to download the tuts and the images etc.

Radius65 wrote the thing. I don't seem to have a copy. Maybe someone else does??? :]
-Rook


jfk EO-11110(Posted 2004) [#3]
Not absolutely sure if I get this right, let's see: You have animation strips that look ok when played on a canvas, but don't fit in the landscape when they face towards the camera from any position?
You need to set the spriteviremode in a way that it won't turn the sprite towards the camera. If this doesn't work for some reason, think about using a quad instead (quads are the better choice for your task IMHO since sprites do not support fog, and I guess fog would be nice on a battlefield)

Once you can freely rotate your sprite/quad, simply rotate it to 0,entityYaw(camera)-90,0. Maybe it's not -90, but +90 instead, check it out.

Just a though, sorry, cannot try your zip, this machine doesn't support 3D :/


Doggie(Posted 2004) [#4]
That's pretty close. The sprite needs to have at least 3 different animations, one for when it's viewed from behind, one from in front and one from a side view so that when the sprite is walking a certain direction it will be displaying the correct animation as seen from whatever angle it is seen. Make sense? Problem is, when I use three seperate sprites, one facing north(front view)one facing south(behind view) and one from the side when the sprite is viewed from any angle you can still see the other sprites, kind of like making those 45 degree angle trees some people use. All in all I think this is a lost cause. Matty pointed me to some Quad code, but I never got it to work and it's a lot more complicated than what I need.
I'm wondering if i just go ahead and use MD2s how big a hit I'll take if I have armies over a hundred joes or so?

Obviously, I've been playing a lot of Codemasters "Soldiers: Heroes of WW2" and "C&C Generals"
(Which has a great WW2 Mod called Blitzkrieg II"

Thanks


slenkar(Posted 2004) [#5]
I couldnt get your demo to work - it said entity does not exist


jfk EO-11110(Posted 2004) [#6]
You simply need more than 4 animation strips for this! Cause it is possible to display the right animation, but then when you alter from strip 1 to strip 2 and you have only 4 strips for 360 degrees, this will look worse. This is only a "cost of ram" thing. Calculate how much you want to invest and produce as many strips as possible. Id' suggest 16 Strips for the 360 degrees, but maybe 8 will also work pretty good.

If you once have your animation strip, all you have to do is to use Atan2 to get the relative angle between the camera and the soldier, divide it trough a value that gives you the number of the right strip to display, simply texture the quad or sprite with that strip and there you go.

I don't know how you created the animation stips, but if you are using a true 3D Model and simply grab a serie of renders, then it will be easy to make strips from more sides.

Simply create a pivot in the center of the scene, parent the camera to it, move the camera away from the center, so it will render the entire soldier (who's standing in the center as well), then use something like

for i#=0 to 359 step 22.5
rotateentity piv,0,i,0
; render the animation strip
next


Doggie(Posted 2004) [#7]
Oh yeah, I always forget that PKZIP truncates anything over 8 places.
OK. Rename the one that's named WA955 etc to walk.bmp and change the sprite load to the same name. Then rename walk~1 to walkingnorth.bmp and then the code will run.


Doggie(Posted 2004) [#8]
Well JFK, that's it in a nutshell(funny how many things can fit in a nutshell)so the deal is what uses more memory? Sprites done like this or MD2s? If the sprites with 8 views actually save considerable memory than it'd be worthwhile since the little army guy sprites I want to use will be small enough that detail is unimportant so long as you can tell they're army guys.
Someone could easily produce a program that would load a 3d animated model and then take the pics needed from the angles need and output animstrips. So, if the memory issue is in line then here's a project that would be well received. I know it's within your reach to program such a beast(though I kinda doubt you'd have the time) and I could probably pull it off too except it'd take me a lot longer to sort out. Anyways, Please give me your advice on whether or not this 3d sprite system would beat out using shrunken MD2s.

Thanks


Vorderman(Posted 2004) [#9]
OK, check this one out Doggie -
http://www.jameskett.dsl.pipex.com/splatterfest.zip

It uses a single surface system with variable UVs to fake 3d sprites, and seems pretty fast - my PC can cope with about 1500 guys walking around OK.

Hope it's of some use to you!


Doggie(Posted 2004) [#10]
Dude! Where've you been with this? Yes. This is exactly what I need. And it's uncomplicated enough I can probably port it into my usual game format. ooWah!
I had 10,000(not a typo) sprites on screen at once. Needless to say, the mouse was rendered useless and they updated about every hour on the hour but at 1,000 to 2,000 mark they're crawling all over the place.

Thanks.


ZombieWoof(Posted 2004) [#11]
very kewl idea -- I think you just solved my problem with using high-poly character models from Poser !!!


Vorderman(Posted 2004) [#12]
Glad it was useful - I meant to use it for a sort of Doom-style blasting game (hence the filename!) but never got around to it. Seems a shame to leave the code sat there on my HD doing nothing.

I think a hundred or so enemies should be enough for any game, let alone 1 or 2 thousand. Once they were all firing and attacking and moving in an intelligent manner (or just homing in) it would be absolute mayhem.

I think it would need to be changed to implement different enemy types - you might need one surface for each enemy type, which is possible as there aren't many types, or perhaps a really really big bitmap containing all the sprites, which sounds like a bad idea to me.

Keep us posted with your progress.


Synchronist(Posted 2004) [#13]
Most excellent! Solved a problem for me as well. Thx!

Please excuse silly question but could this technique be used to render the sprites over say, a textured mesh surface? I'm used to dealing in either all 3D or all 2D, never tried mixing the two before.


Doggie(Posted 2004) [#14]
@ Vorderman . Thanks again. I've now got a start on my game.
Just got to figure out a few more things than it;s just "grunt" work putting it all together.



Synchronist(Posted 2004) [#15]
@Doggie; let us know how you get on with your project, eh? You and I are working along similar lines... (except I'm doing a different theme)


Vorderman(Posted 2004) [#16]
Wow, looks like Omaha beach! I like it. Can you mow them down as they charge up the beach, or is it an entirely different sort of game?


Banshee(Posted 2004) [#17]
OOooooo,,... yeah, this is just crying out for area of effect weaponry ! Let me at em !


jfk EO-11110(Posted 2004) [#18]
Yeah, looks great, Doggie. No more "one man army" then :) Very promising work.


Doggie(Posted 2004) [#19]
Hehe...Well, really it's just the sprites from the splatterfest code running around in circles on a terraed terrain. It's going to be awhile before I have anything to demo, and the end product might not be anything like this(but probably pretty close or better) My major task at the moment is writing some functions to control the sprite behavior. All things in time. Lots of time.


_PJ_(Posted 2004) [#20]
Hmm Just how do you get a landscape terrain and skybox like that???

My artistic talent isnt exactly diabolical, but I just cant gewt stuff to look at all half-decent


Vorderman(Posted 2004) [#21]

(but probably pretty close or better)



I fail to see how you can possibly improve upon my splatterfest code... :)


Stevie G(Posted 2004) [#22]
Nice vorderman - is that guy ripped from the original? You got all the rest .. always fancied recreating a huge battle - ala ROTK ??


Vorderman(Posted 2004) [#23]
do you mean the original doom? I think he is the shotgun guy from Doom2, although I didn't have Doom so I don't know if he was in that also.

But yes, he was ripped from Doom2.

I have all the others also - if you do a google search for "Doom sprites" or similar they are all available for download in full character sheets with all the anim frames. You just need to set them out in equal size blocks to make the animation work.

I particularly like the way the Mancubus' guts spill out when you shoot it...