A Wee Tank Game

Community Forums/Showcase/A Wee Tank Game

Stevie G(Posted 2004) [#1]
Was messing about with this over the last few weeks. All graphics generated in code. If you want sound you'll need to add your own in the GAMEinit() function, and set SOUNDon to TRUE. No web space I'm afraid!

It's an ANALOGUE / MOUSE deathmatch for one or two players.

Analogues ... left analogue for movement, right for firing ala Super Smash TV. R3 drops / activates mines, P pauses, ESC to quit.

Mouse / Keyboard ... cursors to move, mouse to move Gun Target, LeftMouse to fire, RightMouse to drop/activate mine.

Use cursors and enter for menus or change all the keys to whatever at the top of the code.

If you trigger an explosion you will get points for anything killed as a result of any chain explosions.

Pick up a bonus and you keep it until dead.

Hud ...

Top bar is Life which will recharge up to a max of the power, both go down when hit, power only a fraction though. Your dead when life is 0. Bottom Bar is laser recharge, if 0 you can't fire. The more bullet bonuses you have the faster this is used up.

Bonuses ..

Tank Speed
Bullet Speed
Bullet Damage
Bullet Spread
Bullet Reload
Life Recharge
Shield
Mine

That's about it I think. Not really planning on expanding as meant to be very simple but feel free to give me feedback of any kind or maybe ideas for more features.

You can change the polycount on the graphics by using the Detail variable.

Here's a screenshot ..






GameCoder(Posted 2004) [#2]
I like this. all generated by code = impressive


sswift(Posted 2004) [#3]
Joystick only? Boo, hiss!

Can you post some screenshots at least?


Stevie G(Posted 2004) [#4]
@Swift I don't have WebSpace .. sorry! I could e-mail you one?


Binary_Moon(Posted 2004) [#5]
I think you should add alternate controls. A keyboard for movement and mouse for shooting should work fine - and can't be hard to add.

I, like many others, only have a game pad (Microsoft Sidewinder) and no analogue pad - in fact I would guess there aren't may people who have a game pad of any sort. I only bought mine for testing my own games.

That said I like the idea of creating an entire game through code and the menu looks ok...


sswift(Posted 2004) [#6]
Stevie:
That's okay, you don't need to. :-)


Stevie G(Posted 2004) [#7]
Em.. the Menu is terrible but I always hated doing that part of a game!!! Using both Analogues gives me full 360 control of the turret and the tracks - which was the whole idea of the game. I may change this if I get the time ..

Cheers
Stevie


electronin(Posted 2004) [#8]
Hey Stevie G,
If you want to post some screenshots, check this out: http://www.zippyimages.com


Paul "Taiphoz"(Posted 2004) [#9]
Stevie G is this public domain, would you mind if I used the code. ?

I wont if its not public domain, but I have to say its bloody good.

Anyway let me know, I wont make a move on it unless you say its ok first.


Bot Builder(Posted 2004) [#10]
Awesome game for being procedural!

Imagine what it'd be like with models and textures!

Anyway, the control scheme is hard for my joystick. at first all I could do is drive and adjust the X of the aim. I changed the code a bit to simply use the rudder on my joystick.


Stevie G(Posted 2004) [#11]
@ Electronin - I'll check this out.

@ Yavin - feel free to use any of it mate. I think the coding is pretty solid. If I just get a mention then that's fine by me. Forgot to mention that the difficulty is the same no matter what you choose.

If anyone fancies adding models / textures it'd be interesting to see what it looks like. Never did get round to using a modeller etc..

Stevie


Stevie G(Posted 2004) [#12]
@ Electronin - I can't seem to get a shot to display - just like you??


Pongo(Posted 2004) [#13]
Oh yea,... this is really similar to something I wanted to do a while back. Take a look at the bottom of the page here:

http://www.redgreenbob.com/proofs/pongo/main.htm

I'd be glad to make the tank available for this. (although this version does not have a seperate turret) Guess I'll make a new one.

This tank was also made available in the free model pack I offered a while back, but I've since taken it down. Maybe a mirror is still around. In anycase, I'll make a new version with turret if anyone wants.


Stevie G(Posted 2004) [#14]
Your page is down Pongo?


Pongo(Posted 2004) [#15]
Oops.

Nope. I just had a typo,... should be fixed now


Stevie G(Posted 2004) [#16]
Ah.. remember this one now Pongo - it's Gallus!!! This model WAS my inspiration for doing the game - I've got this saved somewhere with all the free tokomak models you gave us :) .

If you can be arsed making a new one with separate turret ? The only problem here is I don't have any texturing skills or aps , hence the use of vertex colors for differentiating each tank. I don't ask for much but if you're making it - could you make 4 with the same parts as mine in vertex primary colours?


Paul "Taiphoz"(Posted 2004) [#17]
Yeah me and MS also started work on something like this hence the reason id like to pick at your code, as its got some nice features in it.

I did a Combat Remake for my Uni project, this is what spurred me onto doing a 3D version in blitz.

I think im now going to finish it all off though as there seems to be some intrest in the genre.


Stevie G(Posted 2004) [#18]
Anyone got any links to the original 'Combat' game? Wouldn't mind a shifty.


Pongo(Posted 2004) [#19]
I'll make up a new version with turret. I actually already have one, but it was made for a rendering, so I need to take out some detail (around 20K polys right now)

Might take me a few days,... I've got plans for the weekend already


eBusiness(Posted 2004) [#20]
JoyKey 12, what do you expect? Clean it up a bit will ya?


eBusiness(Posted 2004) [#21]
Sorry, it's just a bit frustrating that you make a game that hardly anyone can play and then post it in the forum for the rest of us to glare at.


eBusiness(Posted 2004) [#22]
Here is a keyboard and mouse version, but 2 player doesn't work.


Kong(Posted 2004) [#23]
So you're complaining because you're too cheap to buy an analogue controller or adapter? I've never understood why computer users will drop hundreds on a video card or ram but the moment they need to buy a gamepad they whine.

Thanks for the code Stevie G it's good stuff.


eBusiness(Posted 2004) [#24]
My 2-axis 2-button joystick have so far worked fine for any game that I have played, but this game require a button 12 and a couple of other things.

Edit: And by the way, nice game :)


Stevie G(Posted 2004) [#25]
Thanks Ebusiness - not sure you needed another 500 lines of code to do that though. I was working on this too but I have to confess I liked your mouse targetting code so have included this - thankyou for taking the time :)

I've added a shortened version at the top of this thread where you can select the control type from the main menu.


eBusiness(Posted 2004) [#26]
You are welcome

I just got used to my own keysystem, it's good for flexibility, but I didn't reach that point ;)


Picklesworth(Posted 2004) [#27]
this is great stevie G! Much fun :D


dynaman(Posted 2004) [#28]
Very impressive, add the sound and you got a winner. (gonna be hard with just data statement though)


Picklesworth(Posted 2004) [#29]
Is it allright if I use this code to learn how to do online networking, level data files, and sound effects?


Stevie G(Posted 2004) [#30]
Fill your boots Mr P! It'd be good to know how you get on though.


eBusiness(Posted 2004) [#31]
Anyone asked for 'in-code' sound effects?


Picklesworth(Posted 2004) [#32]
woah ebusiness! that's cool! I had no idea you could do that with code!


eBusiness(Posted 2004) [#33]
Well, I just save a wav file and then load it , the problem was to make it sound like a gun. I still havn't got the right sound for a tank, this one is too much bang, and too little boom, but there are plenty of things to adjust, have a go.


Picklesworth(Posted 2004) [#34]
I think I will, it looks fairly straight-forward.


Stevie G(Posted 2004) [#35]
Jesus - thanks superb - I had no idea you could do this either!!! I'll have a play about but it looks way over my head - could you explain a bit about what your sending to the .wav file?

Would be good to get the whole thing done in code.

I'd quite like to add a few more powerups if anyone has any suggestions?

Cheers.


eBusiness(Posted 2004) [#36]
Just altered the code so that you can alter the lenght of the sound (Constant 'lenght' holds the value in 1/96000 seconds). I mix noise on different frequencies, each piece of noise is generated by setting a random value, "drawing a straight line" to the next random value located a certain distance (variable: 'rate'), and so forth. If the distance is big the tones will be deep, and if it's small the tones will be high. All these values I mix in the array 'sarr'. I multiply the numbers by a factor that are large for the middle frequences and small for outer (using sine). This: "*.99990^(b*rate)" make the sound fade. Generally, you should alter the way 'rate' and 'factor' are generated, and the number used in above quotation you can make larger to make the fading slower, or smaller to make the fading faster, 1=no fading.

Around the bottom of the code you will see this:
For a=0 To lenght
	If a<300 Then sarr(a)=sarr(a)*a/300.0
	If a>20000 Then sarr(a)=sarr(a)+.12*sarr(a-20000)
	WriteShort out,Int(sarr(a)*4000)
Next
The piece that write the generated data to the file, in the third line you can alter the volume (the volume might "overflow" if you set it too high). The second line generate eccho, 20000 is the interval from the origin of a piece till the eccho, .12 is the strenght of the eccho. The first line will prevent a click sound that the eccho would otherwise generate.

Good luck messing around with it :)


Stevie G(Posted 2004) [#37]
@eBusiness - Do you know what the 1st 40+ bytes represent - is it just standard to the wav format or have you just set it up to be specific to this sound effect?


eBusiness(Posted 2004) [#38]
Sorta half 'n' half, just copied from another file, this is 16 bit, mono, 96000 Hz (open some files with hex editors and you can figure the general system). Note that if you make the file too long the wav definition says that you shall split it up into some sort of chunks. Some programs will not play a file with too long chunks, others don't care (any eventual reason for this system is utterly outdated). I don't know how to do chunks, but if you got problems, you can save a headerless file and open it with a program like GoldWave, therefrom save it as a valid sound format.

By the way, is the sound making going well?


Stevie G(Posted 2004) [#39]
I've been messing around with it for a few hours and made some bizarre sounds but it's quite difficult getting an explosion sound. I used a low soundpitch once created which was better but can't seem to get the initial 'boom'.

I'm not suggesting for minute that you are the WAV meister but as you know far more than me ... I take it I can only do 'white' noise with this - how would I do something a bit more like picking up a key in Gauntlet noise?


eBusiness(Posted 2004) [#40]
Not shure, and I don't really know what sound you are after, but, you will probably need normal tones. A normal beep tone is just a sine curve:
For b=0 To lenght
sarr(b)=sarr(b)+Sin(b/200.0)
Next
You can make it fade like the boom sounds, and eventually tweak the curve to make it another kind of sound (the ^5, not shure exacly how it works):
For b=0 To lenght
sarr(b)=sarr(b)+Sin(b/200.0)^5*.9999^b
Next


Picklesworth(Posted 2004) [#41]
oops, already answered :D
Stevie G, can you please show me how to add an online multiplayer option right below the start option? (maybe just put a label where I should put my multiplayer code).


Stevie G(Posted 2004) [#42]
How about this ... just search for all instances of NET to see what I changed. See GAMEstart, NETGAMEstart etc.. Hope this helps you ;)




Picklesworth(Posted 2004) [#43]
okay thanks for that!