PROJECT: SpaceWar! - Release 2.5 (Added music, Title and Option screens) Now 12
epmoyer
Posts: 314
I have reorganized this thread so that this first posting will always contain the current status and code build.
Known Bugs:
None
Open Issues:
High Priority:
Refine shield behavior (ship/ship and ship/shot bounce)
Medium Priority:
Modify explosion particle distribution to a circular pattern with highest density nearest the origin.
Lower Priority:
Add remaining options: Hyperspace, BFG, partial damage model.
Properly handle dual death (wait for both players to sequence through explode, disappear, delay) before starting the next match (today next match starts as soon as first destroyed ship's death cycle is completed).
Possible other options:
Edge bounce (closed space instead of wrap around)
Handicap (vary starting number of ships for each player)
Controls:
' Two NES gamepads, or a gamepad and the keyboard ' Press START or <Spacebar> at the GAME OVER screen to return to the options menu. ' ' Player 0 Player 1 Function ' -------- ------------ ------------------------------------------------------------------------ ' LEFT LEFT or 'A' Rotate Left ' RIGHT RIGHT or 'D' Rotate Right ' UP UP or 'W' Shields ' DOWN DOWN or 'S' <unused> (Eventually hyperspace, or other special options trigger) ' A A or 'Y' Fire ' B B or 'G' Thrust ' ' The options screen is controlled by player 0's gamepad. Use UP/DOWN to choose, and A to toggle an option.
128K EEPROM File load Instructions
SpaceWar! Stores assets in the upper region of the Hydra EEPROM so its .eeprom file is 128K, and cannot be loaded using the standard Propeller IDE.
To load SpaceWar! You must use the Hydra Asset Manager (H.A.M.)
1) Download HAM 1.07 from here http://forums.parallax.com/attachment.php?attachmentid=0
(You can find it in the thread http://forums.parallax.com/showthread.php?p=628778 )
2) Place all the files from the HAM .zip into a directory together.
3) Power up and connect your Hydra.
4) Start HAM, and select your COM port.
5) Click "Load HAM Driver". A download/upload application will start on your Hydra (takes about 8 seconds).
6) Drag the 128K EEPROM file over the "Memory Map" pane in HAM.
7) Click "Upload to Hydra".
8) Click "OK" when the programming is complete
9) Your Hydra will reboot and the game will start automatically. The game is now loaded in EEPROM.
I have posted the SpaceWar! source code. In the .zip you'll find a file called "How to build SpaceWar from source.doc" which will instruct you on the most effective way to fish for bass in the Adirondacks. It might also, surprisingly, have a thing or two to say about building SpaceWar, um, from source.
Post Edited (epmoyer) : 8/2/2007 4:13:01 PM GMT
Comments
Andre'
I have been working on a version of SpaceWar for the Hydra platform and now that I have the first playable version up and running I thought I’d post it.
The code borrows heavily (polite for “flagrantly steals” [noparse]:)[/noparse] from Andre’s “SPACE_DEMO_001”. I have plans for many runtime options but at the moment the only one implemented is the ability to turn on and off the central black hole (hold “Start” on the player 0 controller).
At present the game only works with 2 attached controllers, which I know many Hydra users may not have. I tried to add keyboard control for player 2, but right now there’s not enough RAM left over for any of the standard keyboard drivers out there, so I either have to strip one down to bare bones, or wait until I free up some more RAM.
Currently the code uses the standard Parallax video drivers so it’s running with two 12K frame buffers at 4 color 192x256. I modified the driver slightly to free up some RAM by pulling out pieces I wasn’t using, but other than that it’s basically using the vanilla drivers.
I did some tests to see if I could get away with single buffering the video, but even though the graphics are sparse the spin code just can’t keep up with single buffered video so that option is out.
My current plan is to free up another 12K of code RAM by modifying the drivers to use a 2 color 192x256 model. If the color were super important to me, and it was worth the time, I could conceivably go to a sprite based model with a multi-cog renderer, but at the moment I’d rather focus on gameplay than on graphics, so I’m inclined to go the 2 color route. With an additional 12K freed up I’m hoping to have room enough for sound, an options configuration menu, player 2 keyboard support, and a host of game configuration options.
I’ve play tested the current version with a bunch of folks and it’s already very fun. I’m hoping to add configurable options for:
Inertial Shot Toggle
Hyperspace
Shields
Fuel
Partial Damage (thrusters, shields, hyperspace, rotation, cannon)
BFG
I’m not quite sure how the BFG will work, but around here we’re thinking it’s some kind of in-game randomly appearing pick-up which you have to acquire, fire, and get the heck out of the way of as it rips through somewhere around 50% of the screen. Of all the options it’s the one people seem most interested in seeing implemented, so it will probably come first. There’s probably room to fit it in before I go for the extra 12K, so perhaps I’ll tackle that next.
One of the interesting things that happened by accident is that I decided to add the ship’s inertia to the projectiles. It seemed like a good idea at the time, and matched what would happen in a real physical sense if firing a projectile weapon, but when I started play testing I realized that all the free flight space games of my youth don’t actually work that way! I kept it for now, because I think it’s interesting (and more challenging), but you’ll see what I mean when you rip past someone while facing sideways to let loose a barrage of shots that end up missing by a mile [noparse];)[/noparse] Ultimately inertial shots will be a player selectable option.
Share and enjoy!
Yes, there is no death animation/delay yet. The counters at the top of the screen showing the remaining ships are decremented appropriately, but the game just resets the player positions immediately for the next round. Again, just conserving code space until I can open up the 12K. There's also no ship/ship collision detection right now. I'll be adding that in too.
Yes, 1 bit black and white mode is where I'm headed. There's not already a 1-bit video conversion of the Parallax drivers out there that anyone is aware of, is there?
One thing that really annoyed me when coding is that the Parallax editor would often mess up my code block relationships when I used tab to indent large blocks of code. Given that Spin is so critically dependent on indentation, I think the editor should really be designed so that selecting a block of code and hitting TAB should never (ever ever ever!) modify the relative structural relationship of the selected code regardless of whatever the current tab stops etc. are set to. Likewise, hitting SHIFT-TAB should have the same constraint (up until the point where lines start to bang up against column zero).
I hate to see my tools shoot me in the foot. I can hit my foot quite well all by myself, thank you [noparse]:)[/noparse]
Post Edited (epmoyer) : 6/21/2007 1:32:56 AM GMT
I have alerted our senior software engineer about the alignment problem you described.··It appears that you are working in·Align edit mode, and the·loss of the relative indenting of your code is actually the Align feature working as it was designed to, but in a context where you don't want it to. He is looking into the feasability of making an "exception to the rule"· that would somehow detect the context.
We reccommend working in Insert mode, and toggling into Align mode only when you want to edit a single line without disturbing the alignment of your comments.· The Insert key cycles through Insert>Align>Overwrite edit modes, and Ctrl+Insert toggles between Insert and Align. (The mode you are in is displayed at the bottom of the Propeller Tool window, third box from the left.)
Do you have the Propeller Manual?· If not, you can download it for free here:
http://www.parallax.com/propeller/downloads.asp
The Edit Modes section begins on page 65.
Hope this helps,
-Stephanie Lindsay
Editor, Parallax Inc.
I believe you must be right! When the problem happened to be before I was in the middle of reorganizing a bunch of code and a lot of blocks got messed up long before I realized that the indentations had been altered. I was probably in align mode without realizing it. I have gone back and tried to replicate the problem and the only way i can get it to occur is by first switching into align mode.
I was aware of align mode before, but somehow I missed that I had inadvertently switched into it. I think it would be a good idea for the editor to ignore align mode when using the tab key to adjust multiple lines simultaneously, otherwise the potential to inadvertently wreck havoc on large blocks of code is immense.
Thanks for the help, and I apologize for whining about my own mistake! You folks have done an excellent job with the tools in general.
Post Edited (epmoyer) : 4/26/2007 9:42:25 PM GMT
I haven't updated the graphics driver yet, but the tv driver was the tricky part. I decided that rather than rewrite a whole 2 color tv driver I would modify the Parallax driver to drop into 2 color mode for the scan lines, and leave all the other code alone so I didn't have to mess with it. What hung me up for a long time is that switching color modes on the fly (from 2 bit to 1 bit) was a little dicey. I thought I had read somewhere that changes to vcfg would be buffered and not take effect until the next waitvid fired, but in practice what I found is that after a scan line I couldn't switch video modes after my last pixel-driving waitvid, but had to wait and do it immediately after the first front porch waitvid. I'll have to go read through all that again and make sure I didn't do something too wonky, but for the moment it works beautifully and I am up and running.
I originally tried to leave the video set for 4 color mode and just translate the video memory from a 1 bit to a 2 bit representation on the fly, but all the shifts and rotates took too long to fit in the available time between waitvids, so I went to a mode switching implementation instead.
Next I'll update the graphics driver, throw in a keyboard driver so that people without 2 gamepads can play, and kick out the next beta. After that I'll feature creep until I run out of memory [noparse]:)[/noparse]
Here's an underwhelming screenshot of the current driver. The stretching and segmentation is because the new TV driver is interpreting the current 2 bit images as 1 bit images, so everything is twice as wide as it should be, and different "colors" now appear as different 2 pixel sequences. Once I update the graphics driver all will be right with the world again.
I was thinking I might tile color a few regions of the screen. Everything that passes through those regions will get colored, including the ships and shots, so it would behave a lot like the old style color overlays used on vector games like rip-off in the 80's. I'll have to try it and see if it plays well or just seems stupid. Coloring the sun should be pretty safe, since by the time a ship or shot gets there it will die anyway.
Good stuff is coming....
Post Edited (epmoyer) : 5/2/2007 5:57:33 AM GMT
Andre'
The keyboard driver is now up and running (there wasn't room for it before with the 4 color model), so now Hydra owners without a second gamepad will be able to play.
I'll post a screen shot and a code dump later tonight with whatever features I manage to cram in between now and then.
I have only tested the new 2 color video drivers on a single LCD display, so please let me know if any of you have trouble running this new version on a particular type of TV or display.
Post Edited (epmoyer) : 5/3/2007 7:36:57 AM GMT
Ship explosion animations are in. Shields are functional. Fuel and shield gauges are functional. Sound driver is in (but not currently used). Options selection screen is almost ready to rock.
Andre'
This is the first "Release" quality version so far. We are out of Alpha/Beta !!!! We did a lot of play testing today, and I believe I've squashed all the bugs in this release.
This version requires Nick Sabalausky's excellent sound driver which is not public domain so it is not included in the .zip. You'll find it in your Hydra "...\Sources" directory as "NS_sound_drv_052_22khz_16bit.spin". In reality, the game makes very little sound at present (just a single "ping" when the option screen appears).
Sound effects are coming down the road some time, as are more game options and bouncing shield behavior.
Share and Enjoy.
Here is the current build state:
Post Edited (epmoyer) : 5/5/2007 10:31:49 PM GMT
It seems to freeze at GAME OVER though without accepting the start button. Also on the menu screen it'd be good to have individual presses for moving between menu options, or a slightly slower auto repeat. It's quite easy to skip two lines when you mean to do one.
Thanks for the feedback, folks! I'm glad it's fun; that's my main goal.
I took CardboardGuru's advice and changed the up/down controls in the menu so that they behave more nicely. Now it responds as it should, taking action on key down events and implementing a key repeat with delay.
I'm not sure the reason for the hang at the GAME OVER screen; although I suspect a potential bug in the pacing code. Let me know if anyone else experiences a game hang. I had lots of them while working on the pacing code, but there must be one lingering. I will go take another hard look at that code and see if I can make it any more robust.
here are the changes:
Time for bed! (long past time, actually. Where does it go [noparse];)[/noparse]
As before, this version requires Nick Sabalausky's excellent sound driver which is not public domain so it is not included in the .zip. You'll find it in your Hydra "...\Sources" directory as "NS_sound_drv_052_22khz_16bit.spin".
I'm running the new version now in banger mode right now so it's happily playing games by itself for a "burn in" verification test. So far its been up for about an hour with no hang. I'll post the update in a few hours when I'm convinced the new code is rock solid.
1.7 fixes the lingering pacing bug which would occasionally hang the game. This version has received about 5.5 hours of burn-in testing with no hangs or crashes, so it is very stable. I have been working to get it polished up for the updated CD Andre' is shipping out with new Hydra systems.
Enjoy!
As before, this version requires Nick Sabalausky's excellent sound driver which is not public domain so it is not included in the .zip. You'll find it in your Hydra "...\Sources" directory as "NS_sound_drv_052_22khz_16bit.spin".
Thanks for all your hard work. This is the one game that I really wanted to see revived. Sometime in the distant past it was a favorite on mine.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Everything in the world is purchased by labour; and our passions are the only causes of labor." -- David·Hume (1711-76)········
Aren't the button bits high when there's no controller (I got the kbd working by zeroing nes_buttons ...)?
Oh, and I had fun playing against my friend ^___^
I added keyboard control so that people with an out-of-the-box Hydra system could still play, but I have 2 controllers and I never tested with the second one removed. Duh!
Yes, with no controller inserted all the button bits go high, and you get 0xff when you read the controller. There is code in there to detect that state and ignore the controller if all the bits are set like this...
But I need to move it up between the
section and the
section.
Thanks for the catch! Too bad I didn't find it before Andre' cut the CD
I wrote a little VB app to convert black and white windows .bmp files into binary assets which could be loaded into HAM. The converter puts the files into a format which matches the 2 color Hydra bitmapped video format I am using. In spin I just call Nick's EEPROM driver and copy the bitmaps to the offscreen buffer, then copy them to the onscreen buffer after the EEPROM driver reports that the copy is complete.
Post Edited (epmoyer) : 5/16/2007 7:18:09 AM GMT
Also I see you use the sound driver, but there aren't any sounds (other then a beep when it starts up). I see the debug led change freq though, but I don't know if that is related to your sound setup or just something else.
I will look into the hang; I have done lots of testing on my system and I don't experience that problem, but in general I tend to have two controller's attached so it's probably related to the single controller issue. I will test that path tonight and see.
The debug led shows the pacing delay used to maintain a uniform frame rate. The LED is on whenever the pacing delay is active. You'll find that the fewer objects are on screen, the more it will glow. I'll probably comment it out with a debug flag in the next release just because it's a little distracting.
I put SpaceWar! on hold to write HDMF so I could add music to it, and I haven't gone back to finish composing the music since completing HDMF. It is coming... [noparse]:)[/noparse]
I'm also spending a bunch of time these days on a Full Color pixel based video driver for the E512K card. If that solution has a fast enough frame rate I'll release a full color version of SpaceWar! for the E512K.
Thanks for the feedback!
I also added a bunch of sound effects, but just as I was going to release a 2.2 beta version I found a nasty bug where all the sounds just go haywire and one of the ships goes crazy. Probably a stack overrun. I'll find the bug tomorrow and post an update.
Version 2.3 is released and can be found in the first entry in this thread. All future releases will be maintained in the first post entry.
Version 2.3 updates (since the last 1.8 release):
Fixed the GAME OVER hang when playing with no controller connected to the "Gamepad 1" port.
Disabled the pacing LED.
Added sound effects.
Fixed an array indexing bug on player shots which could cause the 5th shot fired by player 2 to corrupt memory.
Both gamepads can control the options screen
Post Edited (epmoyer) : 6/21/2007 1:56:09 AM GMT
Version 2.5 updates (since the last 2.3 release):
Added music
Added title screen
Added overlay screen graphics
This (and future) version now makes use of EEPROM assets (music and graphics) stored above the standard 32K EEPROM limit, and as such you need to use the Hydra Asset Manager (H.A.M.) to install it. Detailed instructions, along with the 2.5 binary, are in the first post of this thread.
The source is a little tricky to release in a version that you can build yourself due to the assets in upper EEPROM. I'll put a source release together in another day or so.
I'll also look into that possible bug you mentioned in the other thread.
As I don't have a hydra, I'd have to port it to work on hybrid ( joystick code and clock speed to 10Mhz ) so I'll have to wait for the source release.
Other than that, can't wait to see it Eric, looks great from the screenies I've seen.