Shop OBEX P1 Docs P2 Docs Learn Events
PROJECT: SpaceWar! - Release 2.5 (Added music, Title and Option screens) Now 12 — Parallax Forums

PROJECT: SpaceWar! - Release 2.5 (Added music, Title and Option screens) Now 12

epmoyerepmoyer Posts: 314
edited 2008-07-20 09:37 in Propeller 1
ss_spacewar_main.bmpss_spacewar_menu.bmpss_spacewar_action.bmp

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
«1

Comments

  • AndreLAndreL Posts: 1,004
    edited 2007-04-26 08:04
    Very cool, just tried it. When I shoot the other player, it just resets me? You know also, you might try the 1-bit black and white mode, better to have 2x as much memory than a few colors. That way you can finish the game. Plus the original Space War! was of course b/w anyway.


    Andre'
  • epmoyerepmoyer Posts: 314
    edited 2007-04-26 14:36
    [noparse][[/noparse]NOTE: I reorganized this thread to make the first posting always contain the current status and the current version. I needed a place to put the original first posting, so I moved it here (to posting 3). The original posting 3 follows the dashed line below.]

    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.

    spacewar.jpg

    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
  • Steph LindsaySteph Lindsay Posts: 767
    edited 2007-04-26 18:08
    Hello epmoyer,

    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.
  • epmoyerepmoyer Posts: 314
    edited 2007-04-26 21:16
    Stephanie,

    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
  • Steph LindsaySteph Lindsay Posts: 767
    edited 2007-04-26 23:52
    I'm glad to hear that really was the problem!· Jeff (Sr. Software Engineer) will be posting on this thread when he has a fix figured out.· No worries about the "whining" - ·we do want the tools to work well and all feedback is valuable to us!
  • epmoyerepmoyer Posts: 314
    edited 2007-05-02 05:52
    Woohooo! I just got my 2 color TV driver hack working! A giant leap, uh, backward, for mankind! The practical upshot is that my video buffer pages will drop from 12K each to 6K each, freeing up 12K for code, which will be plenty of space to hold all the game features I want to add.

    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.

    spacewar_bw.jpg

    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
  • AndreLAndreL Posts: 1,004
    edited 2007-05-02 06:11
    Cool, see what you can get done this week, so I can put it on the next rev of the CD.

    Andre'
  • epmoyerepmoyer Posts: 314
    edited 2007-05-03 02:48
    Double WooHoo! I got the 2 color graphics driver working much faster than I had expected! The video pages are now 6K each so there is tons of room for features now.

    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.
  • epmoyerepmoyer Posts: 314
    edited 2007-05-03 07:17
    SpaceWar Alpha 014 Released

    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.

    spacewar_014.jpg

    ' CONTROLS: Two NES gamepads, or a gamepad and the keyboard
    '           Hold 'Start' on gamepad 0 at boot/reset to disable black hole
    '           Reset to start a new game
    '
    '           Player 0    Player 1       Function 
    '           --------    ------------   ------------------------------------------------------------------------
    '           LEFT        LEFT  or 'A'   Rotate Left
    '           RIGHT       RIGHT or 'D'   Rotate Right
    '           UP          UP    or 'W'   Shields       (Currently have no effect)
    '           DOWN        DOWN  or 'S'   <unused>      (Eventually hyperspace, or other special options trigger)
    '           A           A     or 'Y'   Fire
    '           B           B     or 'G'   Thrust
    '                                                  
    '
    ' //////////////////////////////////////////////////////////////////////
    '
    '  Revision History
    '
    '  Rev  Date      Description
    '  ---  --------  ---------------------------------------------------
    '  011  04-13-07  First playable release.
    '  013  04-25-07  Release for first upload.
    '  014  05-01-07  Migrate to 2 color video driver to open up 12K of code space.
    '                 Add keyboard control for player 1
    '                 Fix pacing so that frame rate is consistent regardless of the processing overhead
    '                   within a given frame.
    '                 Add shield animation.
    '                 Add explode, disappear, delay sequencing to player death.
    '                 Use temporary debug graphic ('x') for exploding ship.
    '                 Add ship/ship collision detection.
    '                 Add shield functionality (against shot/ship and ship/ship).
    '                 Show shield energy, and deplete as used.
    '                 Shrink shots to single pixels.        
    '
    '  This game is still in the alpha stage, so there are still a number of open issues.
    '                                            
    '  Open Issues:
    '     Add explosion animation (currently shows an 'x' for debug)
    '     Properly handle dual death (wait for both players to sequence through explode, disappear, delay) before
    '       starting the next match
    '     Refine shield behavior (ship/ship and ship/shot bounce)
    '     Add sound
    '     Add Options selection screen
    '     Add remaining options      
    '     Possible other options:
    '       Edge bounce (closed space instead of wrap around)
    '       Handicap (vary starting number of ships for each player)  
    '     Change central star/black hole animation
    
    

    Post Edited (epmoyer) : 5/3/2007 7:36:57 AM GMT
  • epmoyerepmoyer Posts: 314
    edited 2007-05-04 17:59
    Made lots of progress last night. Will post the latest rev this evening.

    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.
  • AndreLAndreL Posts: 1,004
    edited 2007-05-05 00:08
    Cool. I am going to build the CD on monday/tuesday then send it out to parallax for manufacturing later in the week. So we will see what you get done by then!

    Andre'
  • epmoyerepmoyer Posts: 314
    edited 2007-05-05 22:25
    Version 015 is in the can!

    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.

    spacewar_015a.jpg

    spacewar_015b.jpg

    Here is the current build state:
    ' //////////////////////////////////////////////////////////////////////
    ' TITLE: EPM_SpaceWar_015.SPIN - Free flight space battle
    '
    ' DESCRIPTION:
    '          Based on the orinial PDP-1 SpaceWar! by Steve "Slug" Russell, Martin "Shag" Graetz and Wayne Wiitanen,
    '          with modifications based on other implementations, and whatever struck my fancy.
    '          SpaceWar! was hacked relentlessly by the development community in its day.  Feel free to 
    '          continue the tradition and hack away!  Send me your cool mods and I'll work them into
    '          the main release.
    '
    ' AUTHOR:  Eric Moyer
    '          Monumental thanks to Andre' LaMothe, for creating "SPACE_DEMO_001", on which
    '          this game is based.
    '
    ' UPDATES: Search the Parallax forums at http://forums.parallax.com for the latest version.
    '          As of this time, releases are being posted to the thread:
    '             http://forums.parallax.com/forums/default.aspx?f=33&m=187691   
    '
    ' 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.
    '
    ' HACKING: If you want to hack SpaceWar!, start by turning on DEBUG__SHOW_PACING_OVERRUNS. If your processing
    '          overhead overruns the alloted frame rate a white square will appear in the upper right hand corner
    '          for each overrun frame.
    '
    '          If you want to monitor a variable, turn on DEBUG__SHOW_WATCH_VARIABLES and set watchval_fixed or 
    '          watchval_int (for fixed point and integer values) in the main execution loop somewhere.  Monitoring
    '          will slow down the frame rate a bit.
    '                                                                   
    '
    ' //////////////////////////////////////////////////////////////////////
    '
    '  Revision History
    '
    '  Rev  Date      Description
    '  ---  --------  ---------------------------------------------------
    '  011  04-13-07  First playable release.
    '  013  04-25-07  Release for first upload.
    '  014  05-01-07  Migrate to 2 color video driver to open up 12K of code space.
    '                 Add keyboard control for player 1.
    '                 Fix pacing so that frame rate is consistent regardless of the processing overhead
    '                   within a given frame.
    '                 Add shield animation.
    '                 Add explode, disappear, delay sequencing to player death.
    '                 Use temporary debug graphic ('x') for exploding ship.
    '                 Add ship/ship collision detection.
    '                 Add shield functionality (against shot/ship and ship/ship).
    '                 Show shield energy, and deplete as used.
    '                 Shrink shots to single pixels.
    '  015  05-05-07  Add Nick Sabalausky's sound driver (not using any sounds yet though).
    '                 Add fuel tracking and display fuel gauge.
    '                 Cleanup/optimize player stats display code.
    '                 Implement explosion particle animation.
    '                 Modify pacing so that waitcnt() call is bypassed whenever game frames run
    '                    over their allotted time.
    '                 Add options screen, and change gameflow so next match can be started
    '                    without resetting the console.
    '                 Implement option flags for all currently supported options.
    '                 Move origination point of shots to nose of ship (was center).
    '                 Use fixed point math for shield and fuel tracking to avoid a costly divide when
    '                    rendering the gauges.
    '                 Swapped shield/fuel so shields are the dashed line.
    '                 Offset thrust drawing to rear of ships.
    '                *Temporarily disable shot/shield bounce code (not ready yet).
    '                 Fix pacing calculation to correct pacing hang
    '                 Fix bug where shield or fuel could run negative                   
    '                                        
    '  Open Issues:  
    '     High Priority:
    '       Refine shield behavior (ship/ship and ship/shot bounce)
    '       Change player 1 ship graphic
    '
    '     Medium Priority:
    '       Add sound effects.
    '       Modify explosion particle distribution to a circular pattern with highest density nearest the origin.
    '       Pacing is currently dropped whenever the system counter gets near its wrap-around point.
    ' 
    '     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
    '
    '       Possible other options:
    '         Edge bounce (closed space instead of wrap around)
    '         Handicap (vary starting number of ships for each player)  
    '         Change central star/black hole animation
    '
    '
    ' //////////////////////////////////////////////////////////////////////
    
    

    Post Edited (epmoyer) : 5/5/2007 10:31:49 PM GMT
  • CardboardGuruCardboardGuru Posts: 443
    edited 2007-05-06 03:15
    Nice one Eric! That's really come together. Love the particle effects with momentum and gravity, esp when you explode. Damn hard game to play though.

    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.
  • potatoheadpotatohead Posts: 10,261
    edited 2007-05-07 03:36
    I'll second that. This is a fun game!
  • epmoyerepmoyer Posts: 314
    edited 2007-05-07 07:24
    Version 1.6 is complete

    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:
    '  016  05-06-07  Code some of BFG for testing (not ready for release yet).
    '                 Add debug mode.
    '                 Change option menu up/down behavior to work on keydown event, and to autorepeat.
    '                 Change default options, and make non-intertial shots the default setting.
    '                 Increase the velocity of non-inertial shots.
    '                 Change black hole animation    
    
    




    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".
  • epmoyerepmoyer Posts: 314
    edited 2007-05-07 16:00
    I found the pacing bug! On the way into work this morning it dawned on me that pacing could still occasionally hang if the system counter were in just the right place. I have implemented a new foolproof (HAHAHA!!!! no really, get up off the floor, it's embarrassing) pacing algorithm and a random input banger test.

    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.
  • epmoyerepmoyer Posts: 314
    edited 2007-05-07 21:29
    Version 1.7 has "Gone Gold"

    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!

    '  017  05-07-07  Revise pacing algorithm - found a flaw in the old one.
    '                 Light debug LED during pacing delay.
    '                 Add test monkey.
    '                *DEBUG__SHOW_PACING_OVERRUNS is temporarily non-functional.  Will fix when I port
    '                   the new pacing algorithm to assembly where it belongs.     
    
    



    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".
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2007-05-08 16:29
    epmoyer,
    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)········
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • Jasper_MJasper_M Posts: 222
    edited 2007-05-15 17:51
    Keyboard seems to work only if second NES controller is plugged in:

    player_nes_buttons := (nes_buttons >> 8)& $ff
    ...
    player_nes_buttons[noparse][[/noparse]PLAYER_1]|=CONSTANT(NES_UP)
    
    



    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 ^___^
  • epmoyerepmoyer Posts: 314
    edited 2007-05-15 18:21
    Oh man, you are correct!!!!! How embarrassing!

    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...

    ' Check that player's controller is inserted
    if(player_nes_buttons[noparse][[/noparse]player_index] & $ff == $ff)
      player_nes_buttons[noparse][[/noparse]player_index] := 0
    



    But I need to move it up between the

    '//// Read NES controller buttons
    



    section and the

    '//// Process keyboard keys
    



    section.

    Thanks for the catch! Too bad I didn't find it before Andre' cut the CD sad.gif
  • epmoyerepmoyer Posts: 314
    edited 2007-05-16 06:59
    Here is version 1.8, which fixes the keyboard problem (keyboard input now works when there is no gamepad 1 attached).
  • epmoyerepmoyer Posts: 314
    edited 2007-05-16 07:07
    I've been working with the Hydra Asset Manager (HAM) to store both music and graphics assets in the unused space above 32K in the Hydra EEPROM. Here are some screenshots of the new title and options screen. The version in the corner says 1.8, but this is really the (unreleased) 1.9 build. Future release builds will come with instructions and data sets for loading the EEPROM using HAM, since the space above 32K cannot be loaded using the propeller IDE.

    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.

    sw_19_screen1.JPG

    sw_19_screen2.JPG

    Post Edited (epmoyer) : 5/16/2007 7:18:09 AM GMT
  • JT CookJT Cook Posts: 487
    edited 2007-06-19 17:55
    I just got around to trying 1.8 and found out that after you finish a game it hangs. Hitting both start on controller 1 and space on the keyboard will not do anything and will just stay at the press start screen(after you complete a game).

    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.
  • epmoyerepmoyer Posts: 314
    edited 2007-06-19 19:38
    I had included the sound driver to evaluate space constraints, but yes 1.8 has no sound effects yet (other than the single ping at startup).

    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!
  • epmoyerepmoyer Posts: 314
    edited 2007-06-20 07:21
    I fixed the game over hang, and it did turn out to be related to playing with just one controller.

    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.
  • epmoyerepmoyer Posts: 314
    edited 2007-06-21 01:46
    Well after a good night's rest and some time away from the problem I plopped down this evening and found last nights annoying bug in 5 minutes. Sometimes you just have to go to sleep [noparse]:)[/noparse]

    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
  • epmoyerepmoyer Posts: 314
    edited 2007-06-21 07:05
    Version 2.5 has been released.

    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.
  • epmoyerepmoyer Posts: 314
    edited 2007-07-31 02:31
    I updated the screen shots on the main archive post (i.e. the first post in this thread) to use digital screen grabs taken with J T Cook's digital screen grab utility. Just had to mod the code a smidge to get it working with my 2 color video driver. Thanks JT!
  • JT CookJT Cook Posts: 487
    edited 2007-08-01 02:28
    I'm glad someone besides me has got some use out of it smile.gif· tho I still need to download the newest version of your game. I haven't tried it yet since it was upgraded over 32k.
    I'll also look into that possible bug you mentioned in the other thread.
  • BaggersBaggers Posts: 3,019
    edited 2007-08-01 07:34
    Same here, as JTCook, I've not tried since it went large [noparse]:([/noparse]
    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.
Sign In or Register to comment.