Jump to content

Photo

Pac_Man Eat n Run


56 replies to this topic

#26 bogax OFFLINE  

bogax

    Dragonstomper

  • 758 posts

Posted Sat Oct 15, 2016 2:29 PM

I doubt if the gosubs are much of a problem

 

I notice you're using return otherbank in several place where it looks like you don't need that

 

since the ghosts are moving slowly try increasing the velocity but only moving one ghost per frame



#27 Lewis2907 ONLINE  

Lewis2907

    Chopper Commander

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

Posted Sun Oct 16, 2016 4:53 PM

Bogax,

Thanks for the tips. I read that return otherbank and thisbank are faster than just return. I will look through the code to remove them where not needed.

For moving one ghost at a time. Is there any material to read up on that? I plan to look at the code some more tomorrow, thanks.

#28 bogax OFFLINE  

bogax

    Dragonstomper

  • 758 posts

Posted Mon Oct 17, 2016 7:48 PM

 
 rand&108 will produce one of 16 possible numbers
 0, 4, 8, 12, 32, 36, 40, 44, 64, 68, 72, 76, 96, 100, 104 or 108
 
 
 this shows a histogram for the numbers 0..31
 
 R# 0 Is just rand
 R# 1 is rand & 108
 R# 2 is rand & 109
 R# 3 is rand & 110 
 

Attached Files



#29 bogax OFFLINE  

bogax

    Dragonstomper

  • 758 posts

Posted Mon Oct 17, 2016 8:00 PM

Bogax,

Thanks for the tips. I read that return otherbank and thisbank are faster than just return. I will look through the code to remove them where not needed.

For moving one ghost at a time. Is there any material to read up on that? I plan to look at the code some more tomorrow, thanks.

 

you use return otherbank for the first four ghost routines in bank 5 but I think you only call them from bank 5

 

 

if you have a spare bit somewhere use it as a one bit frame counter

do two ghosts when it's 0 and the other two when it's 1 



#30 Lewis2907 ONLINE  

Lewis2907

    Chopper Commander

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

Posted Mon Oct 17, 2016 8:06 PM

Bogax,

If I'm tracking what you are saying. That the rand is wasting cycles and I should just go with a constant number to make the program run faster. I noticed if I turned off the fruit part the changing of rooms works better. If I turn off the ghosts of course it works a lot better.

#31 bogax OFFLINE  

bogax

    Dragonstomper

  • 758 posts

Posted Mon Oct 17, 2016 8:42 PM

Bogax,

If I'm tracking what you are saying. That the rand is wasting cycles and I should just go with a constant number to make the program run faster. I noticed if I turned off the fruit part the changing of rooms works better. If I turn off the ghosts of course it works a lot better.

 

more pointing out that they're not very evenly distributed

but I don't know what you want  



#32 Lewis2907 ONLINE  

Lewis2907

    Chopper Commander

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

Posted Thu Oct 20, 2016 12:54 PM

Bb Team,

 

Does anyone know a trick to shut off a gosub routine. Meaning When I go do " temp1 = room_shape[room] : goto draw_room_shape bank6" I want to shut off the "gosub __Ghost_Direction bank5" then after the room is drawn turn the "gosub __Ghost_Direction bank5" bank on. What I found is if I turn the ghost off and move around the rooms the scalines are correct. If I turn them on then scalines jump. If I can get past this part I should be about complete with the game. The finishing touches should be fairly easy to complete after that .  I can then use what I have learned from here to make the next homage game with 100 levels or rooms that I have in mind. Thanks again to everyone who has helped me with this game. 

 

Also I did try to use a bit and a variable to turn on/off the gosub. I couldn't get it to work.

 

__Main_Loop
  
   ; **********************************
   ; Pac_Man and Ghost Controls
   ;
   gosub __Ghost_Direction bank5
   gosub __Pac_Man_Controls bank3

  
   ;****************************************************************
   ;
   ;  Detrermines which maze to draw next
   ;
   if player0y = 6 then gosub go_north
   if player0x = 136 then gosub go_east
   if player0y = 160 then gosub go_south
   if player0x = 19 then gosub go_west
   goto __Skip_Rooms
 
go_north
   player0y = 154
   room = move_north[room]
   goto draw_room

go_east
   player0x = 20
   room = move_east[room]
   goto draw_room

go_south
   player0y = 6
   room = move_south[room]
   goto draw_room

go_west
   player0x = 133
   room = move_west[room]

draw_room   
   ; *************************************
   ; Location of fruits and palyfield detection
   ;
__Fruit_Location

   ; Apple
   player5:
   %0000010
   %0000100
   %0001100
   %0001100
   %0110110
   %1111111
   %1011111
   %1011111
   %1011111
   %0101110
   %0010100
   %1111111
   %1111111
end
   player5color:
   $00
   $00
   $00
   $B2
   $40
   $40
   $40
   $40
   $40
   $40
   $40
   $00
   $00
end

   ; Pear
   player6:
   %00000001
   %00000001
   %00000001
   %00000001
   %00000010
   %00011100
   %01111100
   %11111000
   %11111000
   %11111000
   %01110000
   %00000001
   %00000001
end
   player6color:
   $00
   $00
   $00
   $F0
   $F0
   $D2
   $D2
   $D2
   $D2
   $D2
   $D2
   $00
   $00
end

   ; Mushroom
   player7:
   %00000001
   %00000001
   %00000001
   %00111100
   %01101110
   %01111101
   %11011111
   %01110011
   %00001100
   %00011100
   %00011100
   %00000001
   %00000001
end
   player7color:
   $00
   $00
   $00
   $40
   $42
   $44
   $46
   $48
   $08
   $0A
   $0C
   $00
   $00
end
   ; used for room 12 to end game
   ; Jack_o_lantern
   player8:
   %00001100
   %01111110
   %10111011
   %10010011
   %11111111
   %10101011
   %01010110
   %00111100
end
   player8color:
   $B2
   $22
   $24
   $26
   $28
   $26
   $24
   $22
end

   P2_X = (player5x-8)/4 : P2_Y = (player5y)/8
   P3_X = (player6x-8)/4 : P3_Y = (player6y)/8
   P4_X = (player7x-8)/4 : P4_Y = (player7y)/8

   if Red_Ghost = 1 then player5y = 57 : player6y = 153 : player7y = 105 : goto __Skip_Fruit
   if Red_Ghost = 2 then player5y = 153 : player6y = 105 : player7y = 57 : goto __Skip_Fruit
   if Red_Ghost = 3 || 4 then player5y = 105 : player6y = 57 : player7y = 153 : goto __Skip_Fruit

__Skip_Fruit
   player6x = 23 : player7x = 56 : player5x = 83
   if pfread(P2_X,P2_Y) then goto __Fruit_Location
   if pfread(P3_X,P3_Y) then goto __Fruit_Location
   if pfread(P4_X,P4_Y) then goto __Fruit_Location

   ; ***************************************************************
   ;
   ; on..goto code provided by Bogax
   ; you have to get temp1 in what ever bank has room_shape
   ;
   temp1 = room_shape[room] : goto draw_room_shape bank6

__Skip_Rooms

Attached Files


Edited by Lewis2907, Thu Oct 20, 2016 3:55 PM.


#33 Lewis2907 ONLINE  

Lewis2907

    Chopper Commander

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

Posted Mon Oct 24, 2016 12:39 AM

I think this is complete (well for what I am able to do). Please let me know if you find any errors like the scalines etc. I will try to fix them. I took Wallaby's idea and started to sprinkle drawscreen here and there. It fixed the problem from what I can see. As always I welcome feedback, tips and tricks etc to further my knowledge of Bb, thanks. 
 
   ;```````````````````````````````````````````````````````````````
   ;
   ;  Instructions:
   ; 
   ;  Use the Joystick to move PacMan
   ;  Use Selcet Switch to Pause Game
   ;  Use BW / Color Switch to bring up and close Map
   ;  Use switchleftb to set difficulty at titlescreen. "A" will have one life. "B" will have 3 lives
   ;  There are a total of 25 rooms to move around
   ;  You will start in one of 3 rooms in the lower left of the map
   ;  Future fixes: Better Mazes. More fruit to eat with sound when eating the fruit. 
   ;  Add a secret level if possible. This is based upon space in the banks.
   ;  Better Start, Game Over and End Game Screens
   ;  implement suggestion from the feedback and reviews.
 
 

Attached Files


Edited by Lewis2907, Mon Oct 24, 2016 2:03 AM.


#34 TrekMD OFFLINE  

TrekMD

    River Patroller

  • 3,470 posts
  • Location:Coral Gables, FL

Posted Mon Oct 24, 2016 11:05 AM

Cool, will be trying it out.



#35 Lewis2907 ONLINE  

Lewis2907

    Chopper Commander

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

Posted Sat Nov 4, 2017 5:07 PM

Well I have started to port the Pac_Man Ean n Run DPC version over to AFP Multisprite (Basically to play on the AFP). While in the initial stages. I ran into a problem. Should be simple, but maybe I am over thinking it or something or my eyes are tired. I know the sprite is currently upside down because I did a cut and past from DPC. My issue so far is that I can not get the sprite to move. I did some testing and notice if I put the gosub __Pac_Man_Controls bank3 in between "draw_room and temp1 = room_shape[room] : goto draw_room_shape bank6. The sprite will change directions but not move. 

 

draw_room   
   
   ; ***************************************************************
   ;
   ; on..goto code provided by Bogax
   ; you have to get temp1 in what ever bank has room_shape
   ;
   temp1 = room_shape[room] : goto draw_room_shape bank6

 

Hopefully someone can assist me in the minor glitch I have, thanks. 

 

****Edited****

 

Disregard help for now. Basically I have to teach myself the Multisprite Kernel.  Lessened learned so far from RT "http://www.randomter...s.html#pfread".It will be a while, but I am making progress, thanks. 

 

   ;***************************************************************
   ; If you are using the multisprite kernel, you can use a special pfread module,
   ; called pfread_msk.asm, made just for this kernel. It is not enabled by default.
   ; To enable it, you can use the include or inline command in a 2K or 4K game.
   ; For a bankswitched game, only the inline command will work, and the command must be placed in the last bank.
   ;
   inline pfread_msk.asm

Attached Files


Edited by Lewis2907, Sun Nov 5, 2017 5:27 PM.


#36 Lewis2907 ONLINE  

Lewis2907

    Chopper Commander

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

Posted Sun Nov 5, 2017 9:03 PM

Bb Team,

 

Okay I made some progress. The cut and paste method to a certain degree didn't work from DPC to Multisprite. I hit the same road block again with the pfread conversion. Hopefully someone has pfread for dummies. Hopefully someone can assist me me with the conversion of RT's code that I am using. (Currently won't play on the AFP only in Stella)

 

;```````````````````````````````````````````````````````````````
   ;  Converts player0 sprite coordinates and checks to see if
   ;  any playfield pixels are in the way.
   ;
   temp3 = (player0x-16)/4

   temp6 = (player0y-3)/8

 

From what I understand of the code.  Basically it aligns the sprite with the playfield exactly. I will continue to play with the number and try to make sense of what  SeaGtGruff posted at the below link:

 

http://atariage.com/...el#entry1561837

 

Thanks again if anyone can assist. Also some links to help me learn on my own would be helpful. 

Attached Files



#37 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Sun Nov 5, 2017 9:32 PM

I usually play with the conversion numbers until they work. It helps me to temporarily draw playfield pixels while moving the sprite to see if I have things lined up. When it seems to be perfect, I use those numbers.



#38 Lewis2907 ONLINE  

Lewis2907

    Chopper Commander

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

Posted Sun Nov 5, 2017 10:17 PM

RT,

 

Thanks. I was doing that as well (I think) just changing the number and just moving right to start with and so forth. Thanks again for all the help and page you maintain. 



#39 Lewis2907 ONLINE  

Lewis2907

    Chopper Commander

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

Posted Wed Nov 8, 2017 10:19 PM

Bb Team,

 

When moving left player0 will stop at the most left wall and that's about it. Otherwise runs over everything else on the playfield. I am currently testing going left. I think there is a correlation between the below codes and some math. I think I am missing the mark on where to make adjustments. Any insights or pointing in the right direction would be great. Thanks again to anyone who can help.   

 

   ;```````````````````````````````````````````````````````````````

   ; set screenheight and pixels
   pfheight=3
   const screenheight = 80

 

   ;```````````````````````````````````````````````````````````````
   ;  Converts player0 sprite coordinates and checks to see if
   ;  any playfield pixels are in the way.
   ;
   temp5 = (player0x-17)/4

   temp6 = (player0y)/8

 

   rs0

   playfield:
   ................
   XXXXXXXXXXXXXXXX
   X...............
   X...............
   X..XXX..XX......
   X..X............
   X..X............
   X..XXX..........
   ................
   ................
   X..XXX..........
   X..X............
   X..X............
   X..XXX..XX..XXX.
   X........X......
   X........X......
   X..XXX..XX..XXX.
   X..X............
   X..X............
   XXXXXXXXXXXXXXXX
end

 

  __Frame_LR_00

   player0:
   %01111100
   %11111110
   %11110000
   %11110000
   %11111110
   %11011110
   %01111100
end

Attached Files


Edited by Lewis2907, Wed Nov 8, 2017 10:20 PM.


#40 Lewis2907 ONLINE  

Lewis2907

    Chopper Commander

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

Posted Wed Dec 13, 2017 4:16 PM

Not sure if anyone can help me with this. I found a collision code that I do like and dosen't use a lot space up. I found it http://atariage.com/...ad#entry2242899(Credit to RT and Master_Programmer) for the code. I am able to do some things with the code in the Standard Kernel, but I can't get it to work correctly in the Multisprite Kernel. Any help as always would be greatly appreciated, thanks. 

Attached Files



#41 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Wed Dec 13, 2017 7:12 PM

Remember that the y-values are reversed when using pfread_msk.asm with the multisprite kernel.



#42 Lewis2907 ONLINE  

Lewis2907

    Chopper Commander

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

Posted Wed Dec 13, 2017 8:49 PM

RT, 

 

I'm not exactly sure what you mean by "y-values are reversed". I read that portion on andomterrain.com, but I still don't get it. Do you mean try reversing: !pfread(temp6,p0_y) to !pfread(p0_y,temp6)? Is there an example code somewhere in the forum to look at? Thanks. 



#43 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Wed Dec 13, 2017 10:04 PM

I'll grab the multisprite example program from the bB page tomorrow and add collision to it. I'm not exactly sure what it means, so I'll have to play around with it until I figure it out.



#44 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Fri Dec 15, 2017 7:14 AM

I'm still working on this, in case you want to know. It's just taking me longer than I hoped.



#45 Lewis2907 ONLINE  

Lewis2907

    Chopper Commander

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

Posted Fri Dec 15, 2017 9:44 AM

RT,

 

Thanks. I did continue to play with the code. I have boundaries, but I think it was a step closer to understanding pfread and the math involved for collision. Thanks again for the support and code. I think once I have this portion complete I can move on to porting this game over to FBP. 

Attached Files



#46 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Fri Dec 15, 2017 10:20 AM

Since pfpixel doesn't work with the Multisprite Kernel, I'm having a hard time figuring out which numbers to use. Have you thought about using DPC+? At least the numbers work:
 
randomterrain.com/atari-2600-memories-batari-basic-commands.html#maze_dpc



#47 Lewis2907 ONLINE  

Lewis2907

    Chopper Commander

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

Posted Fri Dec 15, 2017 10:28 AM

RT,

 

Roger. I have a DPC+ "PacMan_N_Run" based off your game. I was trying to get some better collision for multusprite instead of the normal:

 

if collision (player0, playfield) then ....

 

Bogax, has a very good code at :http://atariage.com/forums/topic/213290-pfread-not-working/?hl=%2Bmsk_pf_rd+%2Bdemo#entry2772553 

 

msk_pf_rd_demo.bas, but his code is in asm (still trying to learn that). I thought about using his code and making changes, but the asm would be a challenge for me for player0 let alnoe 2-5. Thanks again for trying to get this to work. I will play with the code and look around the forum and see if I can find something to assit me, thanks. 



#48 Lewis2907 ONLINE  

Lewis2907

    Chopper Commander

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

Posted Sun Dec 17, 2017 10:26 AM

I decided to go with Bogax's code from:

 

Bogax, has a very good code at :http://atariage.com/...mo#entry2772553

 

I made some modifications based upon what I know / think is going on with the program. The program is set up to detect a pixel (I think). The collision is smooth to a point. Up and Left works based off of 1 pixel, hence the way I shaped the block to see where it collides with the wall.

 

Next / improvements:

 

Figure out how to bankswitch up to 32k or 32kSC to have more space

 

Have the Down and Right more detectable (Or the entire block for the standard 8*8 sprite)

 

Figure out "temp2 = ((SWCHA ^ $FF) & sf)/16 : sf = SWCHA" to make it move more freely vice 1 pixel at a time and/or at different speeds.

 

Thanks in advance if anyone can assit. I plan to work on this some more and see if I can get closer to the goal.

 

Attached Files



#49 Lewis2907 ONLINE  

Lewis2907

    Chopper Commander

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

Posted Tue Dec 19, 2017 3:00 PM

I made some progress with the Multisprite Collision Detection (using pfread for smooth collisions). 

 

***Updated***

 

There is a playfield to help with 8*8 detection and boundaries so the sprite will not go off screen. If it does the sprite does weird things. 

 

I added some more remarks to help explain what I am doing to the code to make it work.

 

Ability to move freely and not 1 pixel at a time. 

 

***Next / improvements***

 

Figure out how to bankswitch up to 32k or 32kSC to have more space.

 

Have the Down and Right more detectable (Or the entire block for the standard 8*8 sprite).

 

Figure out ho to adjust the player speeds. I have an idea (I think) to see if will work. 

 

I will work on it some more. Hopefully I am not going down the rabbit hole again. 

Attached Files


Edited by Lewis2907, Tue Dec 19, 2017 3:05 PM.


#50 Lewis2907 ONLINE  

Lewis2907

    Chopper Commander

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

Posted Wed Dec 20, 2017 3:35 PM

Batari Basic Team,

 

***Updated***

 

Figured out ho to adjust the player speeds. I have remarks in the program to explain what I did.

 

   ;***************************************************************
   ;
   ;  Don't move Left if pfpixel is in the way. (Works somewhat, 1 pixel)
   ;  Don't move left off screen. Boundry set.
   ;
   ;  To adjust the speed of the sprite .8 and .2 must = 1
   ;  The 1 is related to the "data dtbl" 0, 1, 1, 0"
   ;  Since you can't use fixed point math in the "data dbtl"
   ;  this is the only work around "I know of"
   ;
   if joy0left then _P0_L_R = _P0_L_R +.2
   if joy0left && temp1 then _P0_L_R = _P0_L_R +.8
   if player0x < 24 then player0x = player0x + 1

 

   drawscreen
   goto __Main_Loop

 

   data dtbl
   0, 1, -1, 0,
end

 

***Next / improvements***

 

Figure out how to bankswitch up to 32k or 32kSC to have more space. (Not sure of a way ahead on this.)

 

Have the Down and Right more detectable (Or the entire block for the standard 8*8 sprite). I think maybe reversing some of the code here and there. Basically just play with it. Not sure of a way ahead on this.

 

Add player 2-5. (probably the last item on the list to work)

 

Hopefully someone can assist with these. 

Attached Files






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users