Jump to content
IGNORED

Lyra the Tenrec (CURRENTLY: Open-Beta)


Recommended Posts

21 hours ago, ZippyOasys said:

Now to deal with the elephant in the room, which is the jank platform collisions.

 

With regarding the collisions, it often helps to have additional test points added for different parts of the sprite. Testing every part of course is not possible, but having a few key points near particular parts of the sprite are very useful.  For instance having a point nearer the top of the sprite, or even right above the sprite,  would make the platforms more solid and prevent you from jumping up through them.  Having them near the sides do similarly for horizontal collisions.

 

 

  • Like 1
Link to comment
Share on other sites

48 minutes ago, Mord said:

With regarding the collisions, it often helps to have additional test points added for different parts of the sprite. Testing every part of course is not possible, but having a few key points near particular parts of the sprite are very useful.  For instance having a point nearer the top of the sprite, or even right above the sprite,  would make the platforms more solid and prevent you from jumping up through them.  Having them near the sides do similarly for horizontal collisions.

 

 

Here's the collision code. What should I fix?

Quote
  rem ** see what character is underneath the hero...
 
    rem ** convert sprite coordinates to character coordinates...
    mytemp1=(herox+4)/8 ; rem 16 is our zoneheight
    mytemp2=heroy/16    ; rem 8 is 160A character width, but x2 for doublewide
    mytemp2=mytemp2+1   ; rem the block under our feet
 
    rem ** ... then make sure we don't try to read/write
    rem ** off-screen memory...
    if mytemp1>19 || mytemp2>11 then goto falling
 
    rem ** ...then read the character!
    herochar=peekchar(screendata,mytemp1,mytemp2,20,12)
 
    rem ** check if hero is on a block...
    if herochar=2 then pokechar screendata mytemp1 mytemp2 20 12 2
 
    rem ** check if hero is on a gem
    if herochar=6 then pokechar screendata mytemp1 mytemp2 20 12 0:herochar=0:score0=score0+25:ssc1=ssc1-1:playsfx sfx_advpickup

 

Link to comment
Share on other sites

On 12/10/2023 at 5:44 PM, ZippyOasys said:

@saxmeister Here's my rough platform collision code. It's a primitive way. But it kinda got the job done.

Feel free to make some improvments to the code.

 

Greetings @ZippyOasys, I have been tied up with work and moving, so I have not had an opportunity to look over your code. I'll try to as I enter the holiday season and take some time off.

Don't let the haters get you down. Working on games, especially as a sideline hobby, is supposed to be fun. We are not professional development houses with teams of coders and designers. Do what you do and enjoy it! I'm looking forward to seeing your game in all of its glory. It looks (and sounds) great already! Keep it up!

  • Like 1
Link to comment
Share on other sites

On 12/13/2023 at 12:50 AM, KrunchyTC said:

I hope this won't be your last 7800 game, I love games with cute animal characters! And I hope to see you become more ambitious with future titles! :D

I'm sure it wouldn't be. I already have ideas for a side-scrolling platformer as well as a pinball/breakout hybrid.

  • Like 5
Link to comment
Share on other sites

4 hours ago, ZippyOasys said:

I'm sure it wouldn't be. I already have ideas for a side-scrolling platformer as well as a pinball/breakout hybrid.

V

Very cool! I'm looking forward to that. Original games are so cool, especially when everyone tries to simply copy an existing format (including myself). I like the innovation.

  • Like 1
Link to comment
Share on other sites

Here's the new build of the game.

As promised, I've fixed the following;

  • The background color is now separate from the gem colors (Now less pink!)
  • Adjusts Player Speed, the run button now slows down the player based on a suggestion by ZeroPageHomebrew
  • Balances the difficulty (Eyeborgs get faster over the course the game)
  • Tweaked the level designs just a bit after the pit stages caused some confusion.
  • Level complete message changes after every 10 levels based on a suggestion by ZeroPageHomebrew
  • Game takes you back to the title screen & displays ending message once the game's beaten. This fixes the ending crash bug.
  • Removed stoprmt command during level intermissions so players can enjoy those sweet POKEY arpeggios.

TO-DO

  • Fix platform collisions

I've also included the source folder for @saxmeister so he can help me get proper semi-solid platform collisions to work.

 

 

lyra_rev3_1_pk_2023y_12m_13d_0105t.78b.a78 lyra_rev3_1_pk_2023y_12m_13d_0105t.78b.bin Lyra 7800.zip

  • Like 3
Link to comment
Share on other sites

This game is designed ambidextrously to be compatible with the good ol' CX40 joystick. but I'm planning on adding SNES & Genesis controller compatibility

 

Where does joy0fire0 & joy0fire1 map to on both SNES2Atari & Mega7800?

 

Edit: Nevermind, I figured out what buttons both controllers will map to.

 

 

Edited by ZippyOasys
Decided which buttons to map
Link to comment
Share on other sites

I don't have any code examples to give, but as a general overview for how I do things I'd keep track of the velocity of the player, then based on that velocity check a few specific points on the player to check for collisions in that direction. If they hit something then move them to a valid position and zero out their velocity on that axis.
 

  1. Update player based on their current velocity
    1. PlayerX = PlayerX+PlayerXVelocity
    2. PlayerY = PlayerY+PlayerYVelocity
  2. Apply typical physics stuff
    1. PlayerYVelocity = PlayerYVelocity+Gravity
    2. If PlayerYVelocity >0 then PlayerYVelocity=PlayerYVelocity-Friction (or whatever gets it to zero)
    3. If PlayerYVelocity <0 then PlayerYVelocity=PlayerYVelocity+Friction (or whatever gets it to zero)
  3. Do controls
    1. Left = decrease X velocity
    2. Right = increase X velocity
    3. Jump = set negative Y velocity (only if a flag states they can jump)
  4. Do collision (Might want to add extra checks so there's no gap between points that a block could fit in)
    1. If X velocity negative check collision on left side of player
      1. Compare upper left, middle left, and lower left coordinates of the player against the level. If any touch a block then reset X velocity to zero.
    2. If X velocity positive check collision on right side of player
      1. Compare upper right, middle right, and lower right coordinates of the player against the level. If any touch a block then reset X velocity to zero.
    3. If Y velocity negative check collision on upper side of player
      1. Compare upper left, upper middle, and upper right coordinates of the player against the level. If any touch a block then reset Y velocity to zero.
    4. If Y velocity positive check collision on lower side of player
      1. Compare lower left, lower middle, and lower right coordinates of the player against the level. If any touch a block then reset Y velocity to zero then set the flag to enable jumping; if no collision then clear the flag.
Link to comment
Share on other sites

I've not checked your code (not had the chance over the holidays). 

 

I think your code is based from the example for RAMCHARMAP.

 

So basically your map is loaded into ram and then your code PEEKCHARs at the the ram location under your player. If that returned number <> whatever the platform tile numbers are, then you fall. 

 

You basically need to check what tile indexes are "platforms" and which are not and change that in the check in your code.

 

If you don't understand what the code is doing, then rewind and take some time to figure that out, walk through your own code step by step.

 

If I get some time in the next few days I'll look at your code but I'm kinda tied up with stuff at the moment.

  • Like 1
Link to comment
Share on other sites

5 hours ago, ZippyOasys said:

Guys... I'm at the end of my rope, I can't quite figure out the collisions. It's driving me bonkers!

7800Basic experts, please I need your help. I made a diagram of want I wanna do with the platform collision. What must I do to achieve what is in the picture I made.

collision.png.3c8206dd75bc85113c669bd7bdbe801c.png

 

From playing the rom a bit here's some observations and advice:

 

1. Even at maximum jump the player will barely make it to another platform.  You might want to consider adding a little more height to the jump so it's easier to get to a platform.

 

2. The collision detection only seems to matter when falling since you're only checking for a position under the player.  If you want the platforms entirely solid (no jumping up through them) then when the player is rising up in a jump you should be testing a second location instead that's directly above the player.  If a collision is detected you immediately change to falling and start testing for the initial lower position again.

 

3. When the player detects landing on a platform, to avoid stopping in the middle of a platform you can also do a quick fix on the Y coordinate to zero out the bottom 3 or 4 bits (depending on if you're using 16-line zones (4) or 8 line zones (3).  This should ensure the player is auto-fixed to the top of the tile.  I'd probably only recommend doing this when falling.  It might cause you to pop up through a platform if you do this zeroing during the rising detection recommendation in #2.

 

 

  • Like 1
Link to comment
Share on other sites

Quote

2. The collision detection only seems to matter when falling since you're only checking for a position under the player.  If you want the platforms entirely solid (no jumping up through them) then when the player is rising up in a jump you should be testing a second location instead that's directly above the player.  If a collision is detected you immediately change to falling and start testing for the initial lower position again.

 

3. When the player detects landing on a platform, to avoid stopping in the middle of a platform you can also do a quick fix on the Y coordinate to zero out the bottom 3 or 4 bits (depending on if you're using 16-line zones (4) or 8 line zones (3).  This should ensure the player is auto-fixed to the top of the tile.  I'd probably only recommend doing this when falling.  It might cause you to pop up through a platform if you do this zeroing during the rising detection recommendation in #2.

@Mord Can you explain this in code please?

Link to comment
Share on other sites

It's a bit hard to explain in code when I don't entirely follow how the code is working - and just giving a generic example might be more difficult if it doesn't work with your existing code.

 

However for #2 I was able to make the platforms more solid from below with a couple edits.

 

 

    rem ** ... then make sure we don't try to read/write
    rem ** off-screen memory...
    if mytemp1>19 || mytemp2>11 then goto falling

    rem ** ...then read the character!
    herochar=peekchar(screendata,mytemp1,mytemp2,20,12)
	
	; MORD EDIT
	;
	; for the location ABOVE the player.
	mytemp2 = mytemp2-1
    herochar2 = peekchar(screendata,mytemp1,mytemp2,20,12)
    mytemp2 = mytemp2+1

 

and

 

  if _Jump_Gravity_Counter<=7 then antigravity=5
  if _Jump_Gravity_Counter>7 && _Jump_Gravity_Counter<=10 then antigravity=3
  if _Jump_Gravity_Counter>10 then antigravity=1

  ; MORD EDIT
  ;  
  ; The quick test for for bumping into a platform from below.
  if herochar2=2 || herochar2=4 then _Jump_Gravity_Counter=0 : _Fall_in_Progress=1 : goto __Skip_Jump

  heroy=heroy-antigravity

  
__Skip_Jump

 

These two edits were done on a previous version than the absolutely latest code you posted. I included snippets of your code around my edits to give an idea of where they would go.

 

I defined "herochar2" variable so I could do the extra test without reusing existing variables.

 

 

Trying to add in the Y coordinate zeroing in #3 is more problematic since I'm probably missing how you're doing the jumps and platform detections entirely. When I try to do the zeroing it ended up having the side effect of causing the player to jump between half to the full height of the screen. Wasn't expecting a gravity boots jump from Symphony of the Night to be so easily coded! ;) 

 

Either way to make the platforms more solid it'll all be about deciding where you want to test for your peekchar.  For instance to make the sides of the platform feel more solid you'll want to test a couple of points on the sides of your character instead of in the middle of the sprite.  You would only need to test those side points when you're actively moving in those directions however.

 

 

 

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

    rem ** convert sprite coordinates to character coordinates...
    mytemp1=(herox+4)/8 ; rem 16 is our zoneheight
    mytemp2=heroy/16    ; rem 8 is 160A character width, but x2 for doublewide

 

These are the lines in your code that are specifying where your current test point is, for under the sprite.  From the looks of it, it's checking the middle of your sprite (herox+4).  To see the left side of your sprite, you'd have to use something like (herox-4) instead - this will place the test position just to the left of your sprite.  To get to the right of your sprite, you'd want (herox+12) - just enough to get exactly 1 tile to the right of your sprite, again testing in the middle of that tile.

 

In these cases, where you're only testing to the direct left or right of your sprite, you won't need to do that extra line after that, which would place the test point down one.

 

    mytemp2=mytemp2+1   ; rem the block under our feet

 

 

 

 

 

Link to comment
Share on other sites

No, that won't represent where the player is.  You'll need to define a couple more variables and store each location separately, sorta like below, and only use whichever ones you need at any given time based on the player's situation (is he moving left or right, or falling, etc).  Also changed the rem comment to be accurate. In the X direction you aren't dealing with height.

 

mytemp1=(herox-4)/8 ; rem 8 is our tile width.
herocharLeft=peekchar(screendata,mytemp1,mytemp2,20,12)

mytemp1=(herox+12)/8 ; rem 8 is our tile width.
herocharRight=peekchar(screendata,mytemp1,mytemp2,20,12)

 

  • Thanks 1
Link to comment
Share on other sites

You'll need a bit more than that it seems.  I had to add the below to get a more solid block, although it's not perfect still.  Formatting looks bad due to me using a different tab size (looks good on my notepad honest. :p)

 

But yeah, essentially you would have to do directional checks wherever you're actually about to try to move the player.

 

main 
  restorescreen

  frame=frame+1
  if (frame&7)=0 then walkframe=(walkframe+1)&1
  if (frame&1)   then goto joydone
  
    ; Mord Edit
	;
	;
    rem ** convert sprite coordinates to character coordinates...
    mytemp1=(herox+4)/8 ; rem 8 is 160A character width, but x2 for doublewide
    if joy0left then mytemp1=(herox-4)/8 ; rem 8 is 160A character width, but x2 for doublewide
	if joy0right then mytemp1=(herox+12)/8 ; rem 8 is 160A character width, but x2 for doublewide
	mytemp2=heroy+8
	mytemp2=mytemp2/16
    mytemp2=mytemp2   ; rem the block under our feet
    herochar2 = peekchar(screendata,mytemp1,mytemp2,20,12)
	; skip horizontal movement due to obstruction.
    if herochar2=4 then goto joydone

  
  
  if joy0left && !joy0fire0 then herodir=0:herox=herox-1:goto joydone
  if joy0right && !joy0fire0 then herodir=2:herox=herox+1:goto joydone
  if joy0left && !joy0fire0 && gravity=0 then herodir=0:herox=herox-1:goto joydone
  if joy0right && !joy0fire0 && gravity=0 then herodir=2:herox=herox+1:goto joydone
  rem make the character run
  if joy0left && joy0fire0 then herodir=0:herox=herox-2:goto joydone
  if joy0right && joy0fire0 then herodir=2:herox=herox+2:goto joydone
  if joy0left  && joy0fire0 && gravity=0 then herodir=0:herox=herox-2:goto joydone
  if joy0right && joy0fire0 && gravity=0 then herodir=2:herox=herox+2:goto joydone 
  walkframe=0 : rem make our hero stand tall when he's not walking

 

  • Thanks 1
Link to comment
Share on other sites

Also, keep in mind if you do make the platforms more solid like this, you'll have to revisit your level designs to make sure they're still doable.  There's at least one that can't be solved with solid platforms due to needing to jump from a smaller platform that's directly below a larger one.  No way to clear the jump.

  • Like 1
Link to comment
Share on other sites

2 hours ago, Mord said:

Also, keep in mind if you do make the platforms more solid like this, you'll have to revisit your level designs to make sure they're still doable.  There's at least one that can't be solved with solid platforms due to needing to jump from a smaller platform that's directly below a larger one.  No way to clear the jump.

Actually, went ahead & redid some levels. ;)

Link to comment
Share on other sites

GOOD NEWS! Collision is fixed, still a little jank but mostly fixed. :) I don't wanna hear any more whining. *cough* @vhzc *cough*

 

BAD NEWS! Screen wrap no longer works because of the fixed collisions. No problem, I just got set up screen boundaries. But I'm having trouble doing that!

It was so much easier when I previously added bounds on the 2600 version.

Edited by ZippyOasys
fixed typo
Link to comment
Share on other sites

Here is my boundary code

Quote
  if herox<18 || herox>136 then goto joydone
  if joy0left && !joy0fire0 && herox>17 then herodir=0:herox=herox-1.5:goto joydone
  if joy0right && !joy0fire0 && herox<137 then herodir=2:herox=herox+1.5:goto joydone
  if joy0left && !joy0fire0 && gravity=0 && herox>17 then herodir=0:herox=herox-1.5:goto joydone
  if joy0right && !joy0fire0 && gravity=0 && herox<137 then herodir=2:herox=herox+1.5:goto joydone
  rem slow the player
  if joy0left && joy0fire0 && herox>17 then herodir=0:herox=herox-0.8:goto joydone
  if joy0right && joy0fire0 && herox<137 then herodir=2:herox=herox+0.8:goto joydone
  if joy0left && joy0fire0 && gravity=0 && herox>17 then herodir=0:herox=herox-0.8:goto joydone
  if joy0right && joy0fire0 && gravity=0 && herox<137 then herodir=2:herox=herox+0.8:goto joydone

I'm obviously doing something wrong...

Link to comment
Share on other sites

Did you have herox set up as a fixed point variable?  In the older code I was looking at, it wasn't.  In the Slow the Player section, that would probably be interpreted as herox-0 instead of herox-0.8. 

 

Additionally, and probably the main issue, the check on the very top would cause the joystick to be ignored when you would be trying to wrap around I believe....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...