Shop OBEX P1 Docs P2 Docs Learn Events
Wanted to see stars, got snow... — Parallax Forums

Wanted to see stars, got snow...

Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
edited 2010-02-09 19:11 in Propeller 1
I thought I'd see if Doug's 8x8 driver could be pushed again to create a starfield effect
for a space shoot'em of some sort..

After a few minutes of wanting to see stars, all I'm seeing is falling snow.
It's a neat effect, but.. Oh well. (Sorta that way outside tonight too!)

I thought I'd post this revision because I know there are a couple other
people who are seeking beginner game examples.

I'll be working on this idea more, and perhaps a game will evolve as well.

Suggestions welcome. [noparse]:)[/noparse]

OBC

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?

Visit the: The Propeller Pages @ Warranty Void.

Comments

  • trodosstrodoss Posts: 577
    edited 2010-01-04 15:47
    @OBC,

    Looks like snow, or, if it was green, maybe "The Matrix."· Maybe you could save the code for a screen saver later [noparse];)[/noparse]

    There are several different ways to achieve a scrolling starfield.· Are you planning on including other 'background elements' (such as planets/planet surfaces/large ships, etc.), or are you just planning on having a few stars scrolling right to left at random vertical position?·

    If you are wanting just a few stars randomly appearing, and varying their Y position and possibly their speed, you could manage them in a 'pseudo structure.'· When the Y position is 0, then randomly select a new Y position and speed.· That might work the best in a clear/redraw display strategy that you would use with Potato_Text.




    Post Edited (trodoss) : 1/4/2010 10:42:29 PM GMT
  • trodosstrodoss Posts: 577
    edited 2010-01-04 16:51
    Attached is an example with the 'pseudo-structure' handling the backdrop redraw.

    [noparse][[/noparse]Edit:] In order to try to explain how the code works, I added additional·comments.· If it makes it more difficult to understand, my apologies.· My hope is though that it makes it easier.

    --trodoss

    Post Edited (trodoss) : 1/4/2010 10:42:07 PM GMT
  • trodosstrodoss Posts: 577
    edited 2010-01-04 19:47
    @OBC,
    I changed the .Zip in my previous post, which provides additional explanation of the 'pseudo structure'·being used. Many thanks to Baggers for showing how to use the technique!

    --trodoss

    Post Edited (trodoss) : 1/4/2010 10:42:46 PM GMT
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-01-05 04:15
    Nice tutorial!

    It shouldn't take too much to convert this to a vertical scroller either.

    Thanks!

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • trodosstrodoss Posts: 577
    edited 2010-01-19 21:27
    @OBC,

    Did your 'space shoot-em up' concept ever get started, or did you get "stuck" on a particular area (or concept)?· Just curious.·

    --trodoss

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Game(s) Mythic Flight (0.9)
    Utilities Font Editors (AIGeneric, Potato_Text, etc.)
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-01-20 03:43
    I haven't had a chance to continue..

    Got hammered last week "other" stuff.. I'm almost done playing catch-up with everything else, so
    I can get both the Chicago expo tied down, my two projects done for the Propeller contest, then
    return to the game kit. [noparse]:)[/noparse]

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • trodosstrodoss Posts: 577
    edited 2010-01-20 15:31
    @OBC,
    Ok, just checking (in case you needed some info/etc.) Sounds like you have more than enough to work on.

    I have quite a few 'loose ends' as well (update the FontGenerator, etc.) I have also been tinkering with SPI SRAM (23K256) for a few apps. Certianly comes in handy for buffering.

    I will see if I can come up with another annoted example of a 'scrolling background' to add as well. Obviously there are any number of ways it can be done [noparse];)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Game(s) Mythic Flight (0.9)
    Utilities Font Editors (AIGeneric, Potato_Text, etc.)
  • trodosstrodoss Posts: 577
    edited 2010-02-01 23:06
    @OBC,

    Attached is another start at a demo (single character moving around the screen).· If you think it is worth the time, I could document it fully.· Also, if you can let me know what is easy/hard to understand about it, it would be appreciated.· I am trying to make the example(s) as simple as possible (sacraficing efficiency for ease of use/understanding).·

    Thanks,

    --trodoss

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Game(s) Mythic Flight (0.9)
    Utilities Font Editors (AIGeneric, Potato_Text, etc.)
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-02-01 23:57
    Thanks! Adding this to my list to look at tonight. [noparse]:)[/noparse]

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • trodosstrodoss Posts: 577
    edited 2010-02-03 22:02
    @OBC,
    I updated the previously posted code:

    - Uses Potato_Text-like font (so one could actually look at the .spin character definition)

    - Changed the DAT section so the map is "viewable" (took out the $20, ...)

    - Added/changed descriptions

    Ideas?· Thoughts?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Game(s) Mythic Flight
    Utilities Font Editors (AIGeneric, Potato_Text, etc.)

    Post Edited (trodoss) : 2/4/2010 9:50:16 PM GMT
    555 x 342 - 8K
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-02-08 01:11
    Super slick!

    Yes, an easy example indeed!

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • trodosstrodoss Posts: 577
    edited 2010-02-08 01:48
    @OBC,
    Hopefully it is useful.

    From my experience with Spin, I encountered issues such as:
    code indention
    long-alignment of VARiables
    finding a "structure equivalent" (kind of covered)

    Would having further explanation of these be beneficial, or is pointing someone to the "Getting Started and Key Thread Index" (http://forums.parallax.com/forums/default.aspx?f=25&m=335240)
    a better solution?

    I am working on a "part 2" to this example (adding monsters), but have not posted it yet.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Game(s) Mythic Flight
    Utilities Font Editors (AIGeneric, Potato_Text, etc.)
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-02-08 02:58
    Some see Zelda... While others can only see dot eaters...

    Here's a little modification of your link code.. [noparse]:)[/noparse]

    Should I finish it?

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • trodosstrodoss Posts: 577
    edited 2010-02-08 03:13
    @OBC,
    Looks like you are off to a great start!
    Definitely try to finish it, if you have the time.

    If I keep going with the "demo" code, I might end up with a passable Zelda clone. If...Zelda had it been made on maybe the 2600 [noparse];)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Game(s) Mythic Flight
    Utilities Font Editors (AIGeneric, Potato_Text, etc.)
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-02-08 04:08
    Dang it!

    Now you've got me hooked again.. [noparse]:)[/noparse] <smirk>

    The board is looking good now, not sure how I'll handle the dots yet.. [noparse]:)[/noparse]

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • trodosstrodoss Posts: 577
    edited 2010-02-08 17:34
    @OBC,
    I posted a slightly altered version of the code, so that pellets can get 'munched'
    Primarily, I changed the following:
    PRI DrawMap | ptr, x, y
        ptr := @mapinfo
        repeat x from 1 to 21
           repeat y from 1 to 19 'width
              'determine the color based on the character:
              '       $20 = empty space
              '  $2E (".")= pellet
              '$60 to $7F = maze walls 
              case byte[noparse][[/noparse]ptr]
                 $20      : text.PokeChar(x,y,COLOR_YELLOW,COLOR_BLACK, byte[noparse][[/noparse]ptr])
                 $2E      : text.PokeChar(x,y,COLOR_WHITE,COLOR_BLACK, byte[noparse][[/noparse]ptr])
                 $60..$7F : text.PokeChar(x,y,COLOR_BROWN,COLOR_BLACK, byte[noparse][[/noparse]ptr])         
              ptr++
    

    The "DrawMap" routine was changed so that the 'Pellets' can get drawn as part of the background.· You could add the 'Power Pellets' the same way (with another character)
    PRI CheckMove (move_x, move_y) | blocked
        blocked := true
        'test the specific character
        case text.PeekChar(move_x , move_y)
          'Empty Space
          $20      : blocked := false
          'Pellet
          $2E      : blocked := false
                    'since we know we have 'hit' a pellet,
                    'we can set the position to 'space' and
                    'add to the score
                    MunchPellet(move_x, move_y) 
          'hit a wall
          $60..$7F : blocked := true    
        return blocked
    


    The "CheckMove" routine was changed so that it tests for 'hitting' a pellet.· When a pellet is encountered, "MunchPellet" is called to remove this from the map.
    PRI MunchPellet (x, y) | ptr
       ptr := @mapinfo
       
       'find the map position in the map information
       '(we subtract 1 from the x and the y, since
       'the data is 0-based
       ptr += ((x-1) * 19) + (y-1)
       
       'set the map info to space character
       byte[noparse][[/noparse]ptr] := $20
    

    ·"MunchPellet" is pretty self-explanitory.· It is where the pellet is removed from the background map.· You could add to the score here/make a sound when the pellet is "munched."

    Hopefully this is enough to get you going.· Next you might want to add your "score" display, and maybe draw your "Power Pellets."

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Game(s) Mythic Flight
    Utilities Font Editors (AIGeneric, Potato_Text, etc.)
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-02-08 18:51
    Cool! Pacman by committee.. [noparse]:)[/noparse] sweet!

    Something to look forward to tonight after work!


    Edit: Quick peek at the code..

    I forgot that the DAT section was read once at startup.
    Yes, that does make it easy to place the dots in the map.
    For some reason my brain was telling me that DAT was set in stone.


    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.

    Post Edited (Oldbitcollector) : 2/8/2010 6:56:46 PM GMT
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-02-08 18:55
    @Ahle2:

    Could you help with some "WAKA WAKA" sounds using SIDcog? [noparse]:)[/noparse]

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-02-09 01:58
    Pacman update

    Ghosts added.. (don't move yet)
    Power pellets added (Ghosts turn blue for a short period of time)
    Pellet count added. Game resets but pellets don't re-appear. (Can DAT be re-read?)

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • trodosstrodoss Posts: 577
    edited 2010-02-09 02:31
    @OBC,
    Great progress!

    If you are wanting the pellets to 're-appear,' what you could do is read the map into an array and use that instead of accessing the DAT area directly. That way you are working off of a copy instead of the original data.

    You could also have multiple maps (levels) and have a 'level pointer,' so you could skip ahead to the next level. If you used that scheme you would not necessarily have to 'reset' (or you could load a particular level into the array--your choice).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Game(s) Mythic Flight
    Utilities Font Editors (AIGeneric, Potato_Text, etc.)
  • trodosstrodoss Posts: 577
    edited 2010-02-09 04:50
    @OBC,
    since the procedures DrawBaddie1, DrawBaddie2, DrawBaddie3, and DrawBaddie4 all share very similar code, you could 'roll them up' into a single procedure.

    Something like:
    PRI DrawBaddie(baddie_x, baddie_y, baddie_color, timer) | offset
    
        if timer > ghosttime
    
        'offset := player_dir + player_step
           text.PokeChar(baddie_x , baddie_y, baddie_color,COLOR_BLACK,$2D)
    
        if timer < ghosttime
            text.PokeChar(baddie_x , baddie_y, COLOR_BLUE,COLOR_BLACK,$2D)
    
    



    ---The following is merely a suggestion: Feel free to disregard---
    You might put thought to how you are can manage 'like' data. Ghosts currently have the following "like data":
    Current X Position
    Current Y Position

    ...and you may want to add later:
    Current Action (Moving North, Moving South, Moving East, Moving West)
    Current State (Alive, Chomped/Dead)

    You can have VAR space declared for each entity, or you could set up a "Pseudo Structure" to manage this data.
    The advantage of a "Pseudo Strucutre" would be that you could loop from 1 to MAX_BADDIES, and handle your drawing or movement all in one loop.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Game(s) Mythic Flight
    Utilities Font Editors (AIGeneric, Potato_Text, etc.)
  • trodosstrodoss Posts: 577
    edited 2010-02-09 19:03
    @OBC,
    Posted a version with the level data being copied into an array (this version does not have the other above mentioned changes in it).

    Hopefully it helps you along.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Game(s) Mythic Flight
    Utilities Font Editors (AIGeneric, Potato_Text, etc.)
  • trodosstrodoss Posts: 577
    edited 2010-02-09 19:11
    If you decide to have multiple levels, you could change the PRI LoadLevel to the following:
    PRI LoadLevel (level) | offset
       offset := @mapinfo
     
       'if this is not the first level, calculate a new offset
       if level > 1
          offset += (level-1) * MAP_SIZE_BYTES
    
       bytemove(@maparray, offset, MAP_SIZE_BYTES)
    

    ·in your DAT section you would have the first level, followed immediately by the next level under·the same 'mapinfo' label.

    Or, you could always load level data from files defined on an SD card (like you were planning on implementing in your "LOADRUNNER" project).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Game(s) Mythic Flight
    Utilities Font Editors (AIGeneric, Potato_Text, etc.)

    Post Edited (trodoss) : 2/9/2010 7:18:07 PM GMT
Sign In or Register to comment.