PROJECT: Battlez0wned
mpark
Posts: 1,305
Here's the source for Battlez0wned. Most of it was thrown together in a week, so as you might imagine it needs improvement in several areas. However, being the kind of person I am (i.e., lazy, short attention span) I doubt I'll do much more work on it. I'd really like to see this become a group project, where people make improvements and then post their changes here so we can all benefit.
Requirements:
I assume most of you have only one Hydra, so I've defined a constant SOLO = true. You can control either your tank or the enemy tank. Hold down START to control the enemy. It's not a solo game (yet), but at least you can play around with it, shoot yourself, etc.
If you have two Hydras (anyone?), hook them up with phone cord. Change SOLO = true to SOLO = false and download to both Hydras. It might take a few rounds of resets, but eventually both screens will say "HYDRA BATTLEZ0WNED" and one will say "PRESS START". Now you and a friend can blow each other up.
As I said, I really hope some of you will help make the program better. Over the next few days I'll try to post some notes on the code to explain what the heck it's doing (stuff I really should have put in comments); meanwhile, please post questions as they come to you.
Here's are some things people might work on:
Attached: Battlez0wned.spin and a cut-down version of graphics_drv. You'll need to supply gamepad_drv from the Hydra sources.
Requirements:
- Hydra
- NTSC TV
- game pad
- Optional: another Hydra, another NTSC TV, another game pad
I assume most of you have only one Hydra, so I've defined a constant SOLO = true. You can control either your tank or the enemy tank. Hold down START to control the enemy. It's not a solo game (yet), but at least you can play around with it, shoot yourself, etc.
If you have two Hydras (anyone?), hook them up with phone cord. Change SOLO = true to SOLO = false and download to both Hydras. It might take a few rounds of resets, but eventually both screens will say "HYDRA BATTLEZ0WNED" and one will say "PRESS START". Now you and a friend can blow each other up.
As I said, I really hope some of you will help make the program better. Over the next few days I'll try to post some notes on the code to explain what the heck it's doing (stuff I really should have put in comments); meanwhile, please post questions as they come to you.
Here's are some things people might work on:
- sound
- single-player vs AI (Baggers, I'm looking at you)
- more robust network: the code to determine which machine is the master does not work reliably; also, there is no error-detection or -correction.
- general code clean-up and refactoring
- better graphics: low priority, because it's OK as-is IMHO, but there's room for improvement
Attached: Battlez0wned.spin and a cut-down version of graphics_drv. You'll need to supply gamepad_drv from the Hydra sources.
Comments
You'll also need
gamepad_drv_001
tv_drv_010
I believe these can now be distributed as they were included in the "HYDRA_Demos_Source_Teaser"
under Fun in the object exchange. (Please correct me if I'm wrong Andre.)
Also it should be noted that to compile you will need to make sure that your Propeller tool is up-to-date.
I couldn't get 1.05.5 to compile the source, but 1.05.7 worked perfectly.
Do you mind a Proto/Demo port of this?
Oldbitcollector
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Buttons . . . check. Dials . . . check. Switches . . . check. Little colored lights . . . check.
— Calvin, of 'Calvin and Hobbes.
I don't mind a Proto/Demo port at all. You all are free to modify (and hopefully improve) the program. Go nuts. All I ask is that you please consider posting your modified versions to share with the rest of us.
I'll try to get the keyboard working next...
Thanks mpark, the little spin I learned so far was mainly by trying to get all the games you guys made to run on my board.
I was thinking of doing some rewrite of the gamedrv file to handle the keyboard..
(If I can find enough memory...) This way any game using that would be easily adaptable.
Kudos for good use of almost every long!
Oldbitcollector
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Buttons . . . check. Dials . . . check. Switches . . . check. Little colored lights . . . check.
— Calvin, of 'Calvin and Hobbes.
gamepad_drv_001
tv_drv_010
The former is 50 lines of code and only useful if you have hydra, and the later is the parallax video driver which is public domain.
Andre'
I just got the game up and running on my frankenstein-Proto/Hydra tonight.. Sweet!
You've motivated me into building some hydra-net connections..
Shame we don't have some more memory for Harrison's TCP driver, then we could
get in some head-to-head play over the Internet. [noparse]:)[/noparse]
Oldbitcollector
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Buttons . . . check. Dials . . . check. Switches . . . check. Little colored lights . . . check.
— Calvin, of 'Calvin and Hobbes.
In case you're wondering about that "A" at the top of the screen, it indicates the steering mode. Pressing SELECT toggles steering between mode A and mode B. In mode A, pressing LEFT causes the tank to turn CCW when viewed from above, whether it's stationary, moving forward, or moving in reverse. Mode B is the same except for reversing, when LEFT turns the tank CW.
Steering mode B had never crossed my mind until I played Atari's online Battlezone: games.atari.com/playgames/arcade/battlezone/battlezone_400.jsp. Something felt strange and I finally realized that it reverses turn direction when reversing (i.e., what I call mode .
I grabbed a couple of guys at work and had them drive around in Atari BZ. One of them found reversing completely natural, the other thought it was completely wrong. In talking with them about it, it appears that if you're thinking in terms of aiming the crosshairs, mode A is correct, but if you're thinking more about steering the tank like a car, then mode B is better.
So I went home and added the A/B option (I should have used my colleagues' initials: D/T). I hoped to do a little survey at NWCGE to see what people preferred but there was too much other stuff going on. People just played in mode A. It only makes a difference when backing up, and that hardly happens anyway.
But try it both ways; I'd be interested to hear what you prefer.
Maybe one of you enterprising types will build a two-stick controller for independent tread control and make the question moot.
You really shouldn't say things like that to people like me! Doggoneit! Another project added to my list!
game_drv_002 (A two atari stick tank control)
The sick part is that I should be able to hang it off the same pins I used for my original Atari stick driver (Demo/Hydra VGA head) to make it work.
Oldbitcollector
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Buttons . . . check. Dials . . . check. Switches . . . check. Little colored lights . . . check.
— Calvin, of 'Calvin and Hobbes.
if pad&NES_UP and pad&(NES_UP<<8)
'handle forward
if pad&NES_DOWN and pad&(NES_DOWN<<8)
'handle reverse
if pad&NES_DOWN and pad&(NES_UP<<8)
'handle left
if pad&NES_UP and pad&(NES_DOWN<<8)
'handle right
Baggers.
Then, I can get to work on AI.
Post Edited (mpark) : 10/7/2007 12:36:29 AM GMT
That's cool that you got to show it off at the expo! It must have been fun to have people come by and play with it.
Apparently you and I keep our LCDs set to similar brightness levels. I was working on BZ with a·5"·LCD, but for the show I got some "real" TVs and when I first saw BZ on a CRT I was a bit shocked at the difference. I had to tone down a lot of things in the code. And turn up the brightness on the LCD.
·
As you can see, there are three Spin/graphics cog pairs. One pair is responsible for drawing the mountain background, the second pair draws the tank, and the third draws everything else. At one point I had them all working concurrently, but there would be obvious drawing order errors (such as mountains appearing to be in front of a cube). So now the tank-drawing and everything-else-drawing cog-pairs wait until the background-drawing cog-pair is done. There are still drawing order errors among the cubes and pyramids and tanks, but since they are all the same shade of green, you can't tell! Of course when things are hit and start to flash you might see lines crossing on top where they should be under, but for the most part it·looks fine.
However,·this means that a maximum of two Spin/graphics cog pairs are working concurrently, so what I should have done is have one cog pair do the background and the tank, thereby freeing up a pair of cogs. If you need more cogs, that's what you should do. You just have to arrange things so that the everything-else drawing starts when the tank-drawing does. Or for faster drawing·you could keep the third cog pair and have it draw half the non-tank objects.
I think it's pretty cool that multiple instances of the Graphics object can work together. I had feared that they would interfere with each other when drawing to the screen, but at least in this case, with the·sparse "vector graphics" look, everything works OK.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Oldbitcollector
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Buttons . . . check. Dials . . . check. Switches . . . check. Little colored lights . . . check.
— Calvin, of 'Calvin and Hobbes.
Should have posted here earlier. I've created a VGA version of BZ. It supports 640x480 (4 colour), or up to 1024x768 (2 colour).
See the thread http://forums.parallax.com/forums/default.aspx?f=33&m=286151
I'd really like someone who has access to two Hydras to let me know if the multi-player mode works ok.
Ross.
I've included the two missing files (gamepad_drv_001, and tv_drv_010)
since they are free to distribute. (Thanks Andre!)
You'll still need the NES controller on p3,p4,p5,p6 just like the Hydra.
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Getting started with a Propeller Protoboard?
Check out: Introduction to the Proboard & Propeller Cookbook 1.4
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card connected? - PropDOS