Jump to content

Photo

Pac_Man Eat n Run


38 replies to this topic

#1 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • 137 posts
  • Location:Senatobia, MS

Posted Thu Sep 22, 2016 4:53 PM

Thanks to RT and atari2600land's Batarti Man! plus the other stuff I found online at Bb. I have been working on Pac_Man Eat n Run homage to the Pac Man Table Top version around 1981.

 

   ;```````````````````````````````````````````````````````````````
   ;
   ;  Instructions / What works
   ; 
   ;  Use the joystick to move around
   ;  Use Selcet Switch to Pause Game
   ;  Use BW / Color Switch to bring up and close Map

   ;  Center room (room 12) is a blackout room

   ;  Pac_Man safe house in the middle. Since there are no power pellets you use the ghost house to hide from them

   ;  Glide along the walls to find the exit. You can use the map, but trying to recall the exit with out the map may show your memory skill

 

   ;  Furtue plans if possible once I learn more

   ;  Use joystick button to (WIP)stop sprite from running or change background music  Music is also another formiable challenge in its self

   ;  Make a titlescreen using the titlescreen kernel. I still don't fully understand it. Would help if there was a you tube video or something

   ;  improve the mazes

   ;  increase the speed of the ghosts as you get closer to the finish (room 12)

   ;  more than just one man. Give the player 3 to start with and a bonus man at a certain score

 

Any ideas or comments are always welcome. I'm not as good as some other programmer's I have seen on here. But I will try to incorporate what I can, thanks. 

 

 

 

The YouTube Table Top PacMan Video is located here.

Attached Files


Edited by CPUWIZ, Sun Nov 5, 2017 9:33 PM.


#2 tschak909 OFFLINE  

tschak909

    Stargunner

  • 1,844 posts
  • Location:USA

Posted Thu Sep 22, 2016 9:14 PM

oooogh! duuude, you need to get your scanline count down and rock solid stable, right now, you're rippling somewhere between 270 to 276 scanlines (when you should be at 262), and it's causing the screen to jitter.

 

-Thom



#3 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Thu Sep 22, 2016 10:28 PM

tschak909,

Thanks. I'm not exactly sure what you mean by scanlines. I will research tomorrow and try to make some changes.

#4 wallaby OFFLINE  

wallaby

    Chopper Commander

  • 100 posts

Posted Thu Sep 22, 2016 10:29 PM

I've been adding an extra "drawscreen" calls in problem areas in my game. It seems to fix the problem most of the time, but what is the best practice?

 

I have a situation where the game loops an indeterminate number of times and it could take longer or shorter. Do I just sprinkle more "drawscreen" in there, or do I actually have to let the kernel cycle through to the next frame on its own?



#5 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Thu Sep 22, 2016 10:51 PM

Not sure if this the answer. But just a glance of what found it seems to be the pfline to make it go over 262. So I'm thinking maybe switching to pixel may work. Also that using Stella only may or may not catch flicker and screen jitter. Just a thought unless someone who knows more can explain it.

#6 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 28,229 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Thu Sep 22, 2016 11:13 PM

Related links:

 

atariage.com/forums/topic/181081-keeping-track-of-the-scanline-count-with-stella/

 

randomterrain.com/atari-2600-memories-batari-basic-commands.html#timing



#7 Papa OFFLINE  

Papa

    Dragonstomper

  • 751 posts

Posted Fri Sep 23, 2016 7:30 AM

Very cool game!  Bravo!

 

On the rippin' arsed scanline count I would say to go in where a massive amount of gosubs are happening (all over the place really), and maybe make a loop with a timer inside (for instance, on the 'game over' screen where gosubs grab the graphics for each segment).  When they come back with their data it's pushing into the display time.  A continuous, counter driven loop would take away the burden of so many gosubs.  I've only briefly scanned over this and am really just grabbing at what pops up immediately and that's WOAH GOSUB into the NIIIIIIGHT!!

 

Really neat and seemingly iconic BASIC style reminiscent of old programming books.  KEWL...  (I'm a caveman.)



#8 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Fri Sep 23, 2016 9:53 AM

Very cool game!  Bravo!

 

On the rippin' arsed scanline count I would say to go in where a massive amount of gosubs are happening (all over the place really), and maybe make a loop with a timer inside (for instance, on the 'game over' screen where gosubs grab the graphics for each segment).  When they come back with their data it's pushing into the display time.  A continuous, counter driven loop would take away the burden of so many gosubs.  I've only briefly scanned over this and am really just grabbing at what pops up immediately and that's WOAH GOSUB into the NIIIIIIGHT!!

 

Really neat and seemingly iconic BASIC style reminiscent of old programming books.  KEWL...  (I'm a caveman.)

Papa,

 

Thanks for the tips. I have been looking at what you post and they well above what I can accomplish. I'm still not there yet. I just started Bb last Oct 2015 while I was in Afghanistan. I have came a long ways but still have more to learn. As for the BASIC style you are correct. I learned how to use Basic on the old Apple II by doing CTRL ALT BREAK and some of the old school LOGO. I understand now what everyone is saying about the gosubs I have and I plan to go back and read what RT sent as well. 

 

Not sure if someone could make a "video" on how to make simple title screens and or music. I am more a visual person than reading when it becomes more detailed. I'm still learning that as well which is hinder some progress on the next homage game I am working on.



#9 bogax OFFLINE  

bogax

    Dragonstomper

  • 715 posts

Posted Fri Sep 23, 2016 6:09 PM

Papa,

 

Thanks for the tips. I have been looking at what you post and they well above what I can accomplish. I'm still not there yet. I just started Bb last Oct 2015 while I was in Afghanistan. I have came a long ways but still have more to learn. As for the BASIC style you are correct. I learned how to use Basic on the old Apple II by doing CTRL ALT BREAK and some of the old school LOGO. I understand now what everyone is saying about the gosubs I have and I plan to go back and read what RT sent as well. 

 

Not sure if someone could make a "video" on how to make simple title screens and or music. I am more a visual person than reading when it becomes more detailed. I'm still learning that as well which is hinder some progress on the next homage game I am working on.

 

 

you don't necessarily have to avoid gosubs but you will want to avoid switching banks if you don't have to

you've got a string of gosubs to bank6

__Return_From_Map 
   gosub draw_room
   gosub __PacMan_Color bank6
   gosub __Red_Ghost_Color bank6 
   gosub __Pink_Ghost_Color bank6 
   gosub __Blue_Ghost_Color bank6
   gosub __Orange_Ghost_Color bank5 
   player9y = 250 ; Map PacMan off Screen

don't do that

 

jump into bank6 do your gosubs (and specify "thisbank" for both gosubs and returns) and then jump bank

 

bank switches cost

 

 

having said that, there's other things you could do to speed up your code


Edited by bogax, Fri Sep 23, 2016 6:12 PM.


#10 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Wed Oct 5, 2016 3:56 PM

Thanks for the tips. I brought the scanlines down from 270 to 276. I hit 263 to 265 when I try to exit the screen. if someone can assit me with some of the gosubs that would be great. If not I will go back to the open concept.

 

I did make some improvements:

 

1. 3 lives to start with or use the left switch at the titles screen to start with one.

2. The Fruit shouldn't hit the playfield and be on different horizontal lines to reduce flicker.

3. The game over screen is better but mimics the start screen (WIP).

4. The game can now end in room 12 by getting the jack-o-lantern. 

5. Freed up more space in the banks

 

Future improvements:

 

1. To reduce the scanlines 

2. Better Gameover / Ending the Game Screen

3. Learn the title screen

4. Learn Music for the gameover and ending game screen

5. Learn more Bb. This will lead into what I have in mind to make next. That will be a challenge in it's self. 

 

As always I welcome any and all commnets, thanks.

Attached Files



#11 5-11under OFFLINE  

5-11under

    River Patroller

  • 3,249 posts
  • Location:Ontario, Canada

Posted Wed Oct 5, 2016 3:59 PM

Any pictures for the lazy and/or incapable?



#12 nanochess OFFLINE  

nanochess

    River Patroller

  • 4,890 posts
  • Coding something good
  • Location:Mexico City

Posted Wed Oct 5, 2016 4:31 PM

Any pictures for the lazy and/or incapable?

 

Here you go:

 

default.bas.png default.bas_1.png default.bas_2.png default.bas_3.png default.bas_4.png default.bas_5.png



#13 Kiwi OFFLINE  

Kiwi

    Stargunner

  • 1,409 posts

Posted Wed Oct 5, 2016 5:40 PM

I made a gifeo of the game in action, there are 2 play throughs:

 

PacnRun.gif - click to animate.

 

I really love the concept of exploring, eating a few fruit, and then nudge the wall to proceed to the next room.  The game is pretty buggy and wonder why no fruits are not appearing when I go through more than 2 rooms. 


Edited by Kiwi, Wed Oct 5, 2016 5:41 PM.


#14 Mr SQL OFFLINE  

Mr SQL

    Stargunner

  • 1,748 posts

Posted Fri Oct 7, 2016 9:15 AM

Cool Pacman game, I like the different theme :) 

 

Plays like Pacman mixed with Pitfall and Adventure!



#15 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Fri Oct 7, 2016 3:51 PM

Thanks. I am still trying to figure out a way to stop the scalines. I did fix the fruit issue and made better mazes. Also working on a few other things for this game. But all the praise should go to Random Terrain, Atari2600land and a few others as I used their code and merged it together to make this game.

#16 bogax OFFLINE  

bogax

    Dragonstomper

  • 715 posts

Posted Fri Oct 7, 2016 6:28 PM

Thanks. I am still trying to figure out a way to stop the scalines. I did fix the fruit issue and made better mazes. Also working on a few other things for this game. But all the praise should go to Random Terrain, Atari2600land and a few others as I used their code and merged it together to make this game.

 

 

 
 
  there are some odd things about your code
 
  the first odd thing is that you waste time (and code) on all those if tests
 
  edit: oops you do go to those labels
        fixed the example 
 
  suppose you're in room 1
  you don't call any of those labels from anywhere so the only way to get
  to a test for room 1 is to fall through all those if tests
  but you goto __Exit_Return after the first block of ifs so
  how will you ever get to the if room = 1 test if you're in room 1?
 
  in the third block of ifs you test player0x > 130 except for room 8 where it's
  132 is that what you meant to do?
 
  you do something only if player0x = 76 || player0y = 82
  so why not test for that and bug out if they fail, and not spend time (and code)
  on tests you don't need?
 
 
 
__Pac_Man_Exit_Top
   if room = 0 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 4 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 5 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 6 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 7 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 8 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 9 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 10 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 11 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 13 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 14 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 15 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 18 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 19 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   goto __Exit_Return
 
__Pac_Man_Exit_Bottom
   if room = 15 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 14 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 16 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 24 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 21 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 19 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 18 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 5 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 10 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 9 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 11 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
 
   ; Set CTRLPF so light sprite moves behind playfield. using 9 moves player9 behind the playfield.
   if room = 12 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom  
   goto __Exit_Return
 
__Pac_Man_Exit_Right
   if room = 0 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 1 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 3 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 6 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 7 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 8 && player0x = 132 && player0y = 82 then goto __Unblock_Right
   if room = 13 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 16 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 17 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 18 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 19 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 20 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 21 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 22 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   goto __Exit_Return
 
__Pac_Man_Exit_Left
   if room = 1 && player0x < 21 && player0y = 82 then goto __Unblock_Left  
   if room = 2 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 4 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 5 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 6 && player0x < 21 && player0y = 82 then goto __Unblock_Left  
   if room = 7 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 14 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 15 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 16 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 18 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 17 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 20 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 21 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 22 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 24 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 23 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   goto __Exit_Return
 
 
  here's some example code (I don't promise it's right)
  I put flags in a look up table for the room test
  the room test(s) only happen after determining that the other
  conditions are met
  (I've asssumed that the room 8 player0x-unblock_right test was ment to be 130)
 
  temp1 = exit_flags[room]
  if player0x <> 76 || player0y >= 15 then  skip_to_Exit_Return
  temp1 = exit_flags[room] : if temp1{0} then goto __Unblock_Top  
  goto __Exit_Return
 
__Pac_Man_Exit_Bottom
  if player0x <> 76 || player0y <= 140 then  skip_to_Exit_Return
  temp1 = exit_flags[room] : if temp1{1} then goto __Unblock_Bottom  
 
skip_to_Exit_Return
  goto __Exit_Return
 
__Pac_Man_Exit_Right
  if player0y <> 82 || player0x >= 130 then skip_to_Exit_Return 
  temp1 = exit_flags[room] : if temp1{2} then goto __Unblock_Right  
  goto __Exit_Return
 
__Pac_Man_Exit_Left
  if player0y <> 82 || player0x >= 21 then skip_to_Exit_Return 
  temp1 = exit_flags[room] : if temp1{3} then goto __Unblock_Left  
  goto __Exit_Return
 
  data exit_flags
  %00000101, %00001100, %00001000, %00001100, %00001001, %00001001, %00001101, %00001101, %00000101, %00000011, %00000011, %00000011
  %00000010, %00000101, %00001011, %00001011, %00001110, %00001100, %00001111, %00000111, %00001100, %00001110, %00001100, %00001000
  %00001010
end
 
 
 
 
 
  for this block of code
  I'd suggest you jump into bank6 and use an on..goto statement
  to select the draw_room_shape routine  
  it will take much less code and less time
 
  if you can save room you can fit more in a bank and not have to waste
  time doing bank switches
 
 
   if room_shape[room] <> 12 then gosub __Pac_Man_Playfield_Colors bank6
 
   if room_shape[room] = 0 then goto draw_room_shape_0 bank6 
   if room_shape[room] = 1 then goto draw_room_shape_1 bank6
   if room_shape[room] = 2 then goto draw_room_shape_2 bank6
   if room_shape[room] = 3 then goto draw_room_shape_3 bank6
   if room_shape[room] = 4 then goto draw_room_shape_4 bank6
   if room_shape[room] = 5 then goto draw_room_shape_5 bank6
   if room_shape[room] = 6 then goto draw_room_shape_6 bank6
   if room_shape[room] = 7 then goto draw_room_shape_7 bank6
   if room_shape[room] = 8 then goto draw_room_shape_8 bank6
   if room_shape[room] = 9 then goto draw_room_shape_9 bank6
   if room_shape[room] = 10 then goto draw_room_shape_10 bank6
   if room_shape[room] = 11 then goto draw_room_shape_11 bank6
   if room_shape[room] = 12 then goto draw_room_shape_12 bank6
   if room_shape[room] = 13 then goto draw_room_shape_13 bank6
   if room_shape[room] = 14 then goto draw_room_shape_14 bank6
   if room_shape[room] = 15 then goto draw_room_shape_15 bank6
   if room_shape[room] = 16 then goto draw_room_shape_16 bank6
   if room_shape[room] = 17 then goto draw_room_shape_17 bank6
   if room_shape[room] = 18 then goto draw_room_shape_18 bank6
   if room_shape[room] = 19 then goto draw_room_shape_19 bank6
   if room_shape[room] = 20 then goto draw_room_shape_20 bank6
   if room_shape[room] = 21 then goto draw_room_shape_21 bank6
   if room_shape[room] = 22 then goto draw_room_shape_22 bank6
   if room_shape[room] = 23 then goto draw_room_shape_23 bank6
   if room_shape[room] = 24 then goto draw_room_shape_24 bank6

Edited by bogax, Sun Oct 9, 2016 1:37 PM.


#17 PFL OFFLINE  

PFL

    Dragonstomper

  • 802 posts
  • Location:Advanced Tech and Research Institute

Posted Sun Oct 9, 2016 1:09 PM

This looks great!  I really, really hope you keep working at it and manage to iron out all the bugs.  Good luck. :)



#18 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Wed Oct 12, 2016 7:28 PM


 
 
 
 
  there are some odd things about your code
 
  the first odd thing is that you waste time (and code) on all those if tests
 
  edit: oops you do go to those labels
        fixed the example 
 
  suppose you're in room 1
  you don't call any of those labels from anywhere so the only way to get
  to a test for room 1 is to fall through all those if tests
  but you goto __Exit_Return after the first block of ifs so
  how will you ever get to the if room = 1 test if you're in room 1?
 
  in the third block of ifs you test player0x > 130 except for room 8 where it's
  132 is that what you meant to do?
 
  you do something only if player0x = 76 || player0y = 82
  so why not test for that and bug out if they fail, and not spend time (and code)
  on tests you don't need?
 
 

 
__Pac_Man_Exit_Top
   if room = 0 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 4 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 5 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 6 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 7 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 8 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 9 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 10 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 11 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 13 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 14 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 15 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 18 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 19 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   goto __Exit_Return
 
__Pac_Man_Exit_Bottom
   if room = 15 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 14 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 16 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 24 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 21 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 19 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 18 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 5 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 10 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 9 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 11 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
 
   ; Set CTRLPF so light sprite moves behind playfield. using 9 moves player9 behind the playfield.
   if room = 12 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom  
   goto __Exit_Return
 
__Pac_Man_Exit_Right
   if room = 0 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 1 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 3 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 6 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 7 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 8 && player0x = 132 && player0y = 82 then goto __Unblock_Right
   if room = 13 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 16 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 17 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 18 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 19 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 20 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 21 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 22 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   goto __Exit_Return
 
__Pac_Man_Exit_Left
   if room = 1 && player0x < 21 && player0y = 82 then goto __Unblock_Left  
   if room = 2 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 4 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 5 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 6 && player0x < 21 && player0y = 82 then goto __Unblock_Left  
   if room = 7 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 14 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 15 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 16 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 18 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 17 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 20 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 21 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 22 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 24 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 23 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   goto __Exit_Return
 
 
  here's some example code (I don't promise it's right)
  I put flags in a look up table for the room test
  the room test(s) only happen after determining that the other
  conditions are met
  (I've asssumed that the room 8 player0x-unblock_right test was ment to be 130)
 
  temp1 = exit_flags[room]
  if player0x <> 76 || player0y >= 15 then  skip_to_Exit_Return
  temp1 = exit_flags[room] : if temp1{0} then goto __Unblock_Top  
  goto __Exit_Return
 
__Pac_Man_Exit_Bottom
  if player0x <> 76 || player0y <= 140 then  skip_to_Exit_Return
  temp1 = exit_flags[room] : if temp1{1} then goto __Unblock_Bottom  
 
skip_to_Exit_Return
  goto __Exit_Return
 
__Pac_Man_Exit_Right
  if player0y <> 82 || player0x >= 130 then skip_to_Exit_Return 
  temp1 = exit_flags[room] : if temp1{2} then goto __Unblock_Right  
  goto __Exit_Return
 
__Pac_Man_Exit_Left
  if player0y <> 82 || player0x >= 21 then skip_to_Exit_Return 
  temp1 = exit_flags[room] : if temp1{3} then goto __Unblock_Left  
  goto __Exit_Return
 
  data exit_flags
  %00000101, %00001100, %00001000, %00001100, %00001001, %00001001, %00001101, %00001101, %00000101, %00000011, %00000011, %00000011
  %00000010, %00000101, %00001011, %00001011, %00001110, %00001100, %00001111, %00000111, %00001100, %00001110, %00001100, %00001000
  %00001010
end
 
 
 
 
 
  for this block of code
  I'd suggest you jump into bank6 and use an on..goto statement
  to select the draw_room_shape routine  
  it will take much less code and less time
 
  if you can save room you can fit more in a bank and not have to waste
  time doing bank switches
 
 
   if room_shape[room] <> 12 then gosub __Pac_Man_Playfield_Colors bank6
 
   if room_shape[room] = 0 then goto draw_room_shape_0 bank6 
   if room_shape[room] = 1 then goto draw_room_shape_1 bank6
   if room_shape[room] = 2 then goto draw_room_shape_2 bank6
   if room_shape[room] = 3 then goto draw_room_shape_3 bank6
   if room_shape[room] = 4 then goto draw_room_shape_4 bank6
   if room_shape[room] = 5 then goto draw_room_shape_5 bank6
   if room_shape[room] = 6 then goto draw_room_shape_6 bank6
   if room_shape[room] = 7 then goto draw_room_shape_7 bank6
   if room_shape[room] = 8 then goto draw_room_shape_8 bank6
   if room_shape[room] = 9 then goto draw_room_shape_9 bank6
   if room_shape[room] = 10 then goto draw_room_shape_10 bank6
   if room_shape[room] = 11 then goto draw_room_shape_11 bank6
   if room_shape[room] = 12 then goto draw_room_shape_12 bank6
   if room_shape[room] = 13 then goto draw_room_shape_13 bank6
   if room_shape[room] = 14 then goto draw_room_shape_14 bank6
   if room_shape[room] = 15 then goto draw_room_shape_15 bank6
   if room_shape[room] = 16 then goto draw_room_shape_16 bank6
   if room_shape[room] = 17 then goto draw_room_shape_17 bank6
   if room_shape[room] = 18 then goto draw_room_shape_18 bank6
   if room_shape[room] = 19 then goto draw_room_shape_19 bank6
   if room_shape[room] = 20 then goto draw_room_shape_20 bank6
   if room_shape[room] = 21 then goto draw_room_shape_21 bank6
   if room_shape[room] = 22 then goto draw_room_shape_22 bank6
   if room_shape[room] = 23 then goto draw_room_shape_23 bank6
   if room_shape[room] = 24 then goto draw_room_shape_24 bank6


#19 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Wed Oct 12, 2016 7:31 PM

Bogax,

Thanks. I am playing with the code you gave me. I think I understand the data part you did. The first part works but the rest of the code doesn't. I'm editing it and playing with to see if I can get it to work. Then I will move on to the on gosub. With more space I can move player0 info back into bank2 to reduce time on the gosub. Thanks again for the code. I will try a few more days on this portion. If I can't get it I will ask for help, thanks.

#20 PFL OFFLINE  

PFL

    Dragonstomper

  • 802 posts
  • Location:Advanced Tech and Research Institute

Posted Thu Oct 13, 2016 11:11 AM

Again, best of luck with this game.  I really like the core idea here.  It reminds me a lot of a cross between KC Munchkin and World's Biggest Pac-Man... Which is no bad thing in my book! :)



#21 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Fri Oct 14, 2016 12:32 PM

Does anyone have any ideas on how I can use the on...goto statement that Bogax is referring to. I looked at RT Basic Commands page, I was unable to apply it here. For what I have it might be a little too much for me. If someone can get me started I might be able to learn what is needed and move on. I was able to adapt the "exit flags" that Bogax gave me. Attached are my latest edits to the game. I changed the Red Ghost to same as the other 3 so I can create more complex mazes later. This way the red ghost won't get stuck. Fruit should be in the proper place. I need to add some more code as it tends to get stuck in the playfield every once in a while. You should be able to complete the game. When changing rooms the scanlines go up. Hopefully I can work that issue out. I have a few other plans once I work these out  to complete the game at the level of Bb I know. As always comments and suggestions are welcomed, thanks. 

 

   ;****************************************************************
   ;
   ;  Check Exit Boundries
   ;  temp1 codes provided by Bogax. Adapt if possible for the movement to other rooms

 

  temp1 = exit_flags[room]
  ; Pac_Man_Exit_Top
  if player0x = 76 || player0y = 10 then pfpixel 15 0 on : pfpixel 16 0 on
  if player0y > 11 then pfpixel 15 0 on : pfpixel 16 0 on : goto __Skip1
  if player0x < 74 || player0x > 78 then pfpixel 15 0 on : pfpixel 16 0 on : goto __Skip1
  temp1 = exit_flags[room] : if temp1{0} then goto __Unblock_Top

__Skip1
  ; Pac_Man_Exit_Bottom
  if player0x = 76 || player0y = 152 then pfpixel 15 21 on : pfpixel 16 21 on
  if player0y < 150 then pfpixel 15 21 on : pfpixel 16 21 on : goto __Skip2
  if player0x < 74 || player0x > 78 then pfpixel 15 21 on : pfpixel 16 21 on : goto __Skip2
  temp1 = exit_flags[room] : if temp1{1} then goto __Unblock_Bottom 

__Skip2
  ; Pac_Man_Exit_Right
  if player0y < 80 || player0y > 84 then pfvline 31 10 11 on : goto __Skip3
  if player0x < 130 then pfvline 31 10 11 on : goto __Skip3
  temp1 = exit_flags[room] : if temp1{2} then goto __Unblock_Right

__Skip3 
  ; Pac_Man_Exit_Left
  if player0x > 22 then pfvline 0 10 11 on : goto __Exit_Return
  if player0y < 80 || player0y > 84 then pfvline 0 10 11 on : goto __Exit_Return
  temp1 = exit_flags[room] : if temp1{3} then goto __Unblock_Left
  goto __Exit_Return

 

   ;****************************************************************
   ;
   ;  Exit Boundries
   ;  Seems like the data references each room is based upon bank6 

   ;  %00000101 is room 0 with top and right exits

   ;  %00001100 is room 1 with left and right exits

   ;  %00001000 is room 2 with just a left exit

   ;  %00001111 is room 18 with all four exits

  data exit_flags
  %00000101, %00001100, %00001000, %00001100, %00001001, %00001001, %00001101, %00001101, %00000101, %00000011, %00000011, %00000011
  %00000010, %00000101, %00001011, %00001011, %00001110, %00001100, %00001111, %00000111, %00001100, %00001110, %00001100, %00001000
  %00001010
end

__Unblock_Top
   ; top exit open (Works)
   if player0x = 76 && player0y < 15 then pfpixel 15 0 off : pfpixel 16 0 off
   goto __Exit_Return

__Unblock_Bottom
   ; bottom exit open (Works)
   if player0x = 76 || player0y > 152 then pfpixel 15 21 off : pfpixel 16 21 off
   goto __Exit_Return

__Unblock_Right
   ; right exit open (Works)
   if player0y = 82 || player0x = 132 then pfvline 31 10 11 off
   goto __Exit_Return

__Unblock_Left
   ; left exit open (Works)
   if player0y = 82 || player0x <= 21 then pfvline 0 10 11 off
 
__Exit_Return

Attached Files


Edited by Lewis2907, Fri Oct 14, 2016 12:37 PM.


#22 bogax OFFLINE  

bogax

    Dragonstomper

  • 715 posts

Posted Fri Oct 14, 2016 7:19 PM

it would be something like
 
  ; you have to get temp1 in what ever bank has room_shape
  temp1 = room_shape[room] : goto draw_room_shape bank6
 
then in bank6
 
draw_room_shape
  on temp1 goto rs0 rs1 rs2 rs3 rs4 rs5 rs6 rs7 rs8 rs9 rs10 rs11 rs12 rs13 rs14 rs15 rs16 rs17 rs18 rs19 rs20 rs21 rs22 rs23 rs24
 
I used rs instead of draw_room_shape because
there's a limit to how much you can put on a line
if you just have to you can break the line up
or there are ways to put/use the addresses (labels) in data statements
which involves microscopic amounts of asm
 
I'd just use short labels if possible
 
you could have up to 256 labels in two data statements and data statements can span multiple lines
 
temp2 is right after temp1
 
the jmp( ) instuction  takes the low byte of its target from the location specified (in this case temp1)
and the high byte from the following location
 
bB prepends a "." to labels in the asm it emits
 
 > specifies the high byte of the (two byte) label, < specifies the low byte
 
so one way to use data statements would be
 
 temp2 = labelhi[temp1] : temp1 = labello[temp1]
 
 asm
 jmp(temp1)
end
 
 
 data labelhi
 >.draw_room_shape_0, 
 >.draw_room_shape_1,
 >.draw_room_shape_2,
 (etc)
 .
 .
 >.draw_room_shape_24,
end
 
 data labello
 <.draw_room_shape_0, 
 <.draw_room_shape_1,
 <.draw_room_shape_2,
 (etc)
 .
 .
 <.draw_room_shape_24,
end

Edited by bogax, Fri Oct 14, 2016 8:57 PM.


#23 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Sat Oct 15, 2016 12:58 AM

 

it would be something like
 
  ; you have to get temp1 in what ever bank has room_shape
  temp1 = room_shape[room] : goto draw_room_shape bank6
 
then in bank6
 
draw_room_shape
  on temp1 goto rs0 rs1 rs2 rs3 rs4 rs5 rs6 rs7 rs8 rs9 rs10 rs11 rs12 rs13 rs14 rs15 rs16 rs17 rs18 rs19 rs20 rs21 rs22 rs23 rs24
 
I used rs instead of draw_room_shape because
there's a limit to how much you can put on a line
if you just have to you can break the line up
or there are ways to put/use the addresses (labels) in data statements
which involves microscopic amounts of asm
 
I'd just use short labels if possible
 
you could have up to 256 labels in two data statements and data statements can span multiple lines
 
temp2 is right after temp1
 
the jmp( ) instuction  takes the low byte of its target from the location specified (in this case temp1)
and the high byte from the following location
 
bB prepends a "." to labels in the asm it emits
 
 > specifies the high byte of the (two byte) label, < specifies the low byte
 
so one way to use data statements would be
 
 temp2 = labelhi[temp1] : temp1 = labello[temp1]
 
 asm
 jmp(temp1)
end
 
 
 data labelhi
 >.draw_room_shape_0, 
 >.draw_room_shape_1,
 >.draw_room_shape_2,
 (etc)
 .
 .
 >.draw_room_shape_24,
end
 
 data labello
 <.draw_room_shape_0, 
 <.draw_room_shape_1,
 <.draw_room_shape_2,
 (etc)
 .
 .
 <.draw_room_shape_24,
end

 

Bogax,

 

Thanks for the code. It worked. I did move some other stuff around to free up space. I also fixed the end game in room 12. I had several issues there. I think I got it fixed from my test of playing the game. I figured out where my scanline issue is so far. It's where I use "gosub __Ghost_Direction bank5" if I turn that off and just use pacman alone there is no issue changing rooms. I am fairly sure that is where my issue are with all the gosub's I have in bank5 for the ghost AI. I'm still working on a way to compress it and use less gosubs there. 

 

   ; **********************************
   ; Red / Shawdow AI Movements
   ;
   if Red_Ghost = 1 then gosub __Red_Ghost_Right : pfhline 15 12 16 on ; safe house
   if Red_Ghost = 2 then gosub __Red_Ghost_Left : pfhline 15 12 16 off ; safe house
   if Red_Ghost = 3 then gosub __Red_Ghost_Up
   if Red_Ghost = 4 then gosub __Red_Ghost_Down

 

   ; **********************************
   ; Pinky / Speedy AI Movements
   ;
   if Pink_Ghost = 1 then gosub __Pink_Ghost_Right
   if Pink_Ghost = 2 then gosub __Pink_Ghost_Left : pfhline 15 12 16 off ; safe house
   if Pink_Ghost = 3 then gosub __Pink_Ghost_Up
   if Pink_Ghost = 4 then gosub __Pink_Ghost_Down : pfhline 15 12 16 on ; safe house

 

   ; **********************************
   ; Blue / Bashful AI Movements
   ;
   if Blue_Ghost = 1 then gosub __Blue_Ghost_Right
   if Blue_Ghost = 2 then gosub __Blue_Ghost_Left
   if Blue_Ghost = 3 then gosub __Blue_Ghost_Up
   if Blue_Ghost = 4 then gosub __Blue_Ghost_Down

 

   ; **********************************
   ; Orange / Pokey AI Movements
   ;
   if Orange_Ghost = 1 then gosub __Orange_Ghost_Right
   if Orange_Ghost = 2 then gosub __Orange_Ghost_Left
   if Orange_Ghost = 3 then gosub __Orange_Ghost_Up
   if Orange_Ghost = 4 then gosub __Orange_Ghost_Down
   return otherbank

 

  More code below to reflect the calls from above.

 

Thanks again for the codes that you have shared. They have helped me brainstorm on what I am planing to make next.  I am going to try and make 100 rooms if possible once I get this game complete to help build up more of my Bb knowledge. Hopefully you or someone who has some time can compress Bank5 Ghost AI into a cleaner code or point me in the right direction and I can work on figuring it out, thanks. 

Attached Files


Edited by Lewis2907, Sat Oct 15, 2016 1:02 AM.


#24 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 28,229 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Sat Oct 15, 2016 8:54 AM

It won't help you right now, but I'll try to make a DPC+ example program with 4 ghosts within the first half of 2017.



#25 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Sat Oct 15, 2016 9:20 AM

RT,

Thanks. I used your pfread and other parts of your program to make the other 4 move around. I will look at the code maybe Monday or so to see if can compress it or something to reduce the gosubs. Hopefully the stuff I am posting will help other newbies like myself when making a game with Bb.




1 user(s) are browsing this forum

0 members, 1 guests, 0 anonymous users