Jump to content
IGNORED

Horizontal positioning problem


rawbits

Recommended Posts

Hi!

 

I have a problem with the horizontal positioning algorithm I found somewhere here in the forums. I use it for positioning the bullets and the player but sadly it isn't put them in the right position. And the misplacement seems to be random according to the horizontal position I want. Check the attached file and you will see what I'am talking about. The algorithm which calculates the position is every the same every frame and gives the correct position.

 

Also in Stella the missile is not having the same width as I am showing/hidding it throughout the screen. I'm not sure if this is there on a real machine because I don't have time to calculate an exact frame what can show up correctly.

 

And there is something about in the Stella Programmer's Guide that says the missile can be positioned in the center of it's sprite somehow but I can not find a way.

 

I keep developing this game further because I want something playable for Function. I have about 5 days left. Please help if you can!

 

The source has mostly english comments so you can find the place easily. The positioning is in the "192 scanlines" / "positioning" part and it gives the correct values. The positioning algorithm I found here is the "PositionASpriteSubroutine". I used it before and it seemd to work there.

shmup0.zip

Link to comment
Share on other sites

Oh, I think somehow I made the missile centering work. So the previous problem isn't too urgent to solve now as I have got rid of that algorithm. But I still want to know what did I mess up there. I attached the solution to this post. The not consistent size is there still and I have another question. Did I do the centering right? Is this how you use the RESMPx?

 

P.s.: I'm still using the "PositionASpriteSubroutine" so I might run into other bugs if I'm not using it right...

shmup2.zip

Link to comment
Share on other sites

I haven't analyzed either the source code or the ROM, but there are several points I can mention from running on a real console:

  1. You seem to have too few scanlines (between 171 to 173), and this causes my screen to roll; consider pressing Alt-l in Stella to see that the scanline count is too low - it should be around 262 for NTSC
     
  2. The centering (or lack thereof) that you see in these ROMs is also appearing that way on a real console

Link to comment
Share on other sites

I haven't analyzed either the source code or the ROM, but there are several points I can mention from running on a real console:

  1. You seem to have too few scanlines (between 171 to 173), and this causes my screen to roll; consider pressing Alt-l in Stella to see that the scanline count is too low - it should be around 262 for NTSC
     
  2. The centering (or lack thereof) that you see in these ROMs is also appearing that way on a real console

 

Yes, I know but I consider timing as polishing and I don't need it until the very end of the developement. I have a lot of space to disect the calculations so they finish exactly when I need them and I have plenty of scanlines to use or waste ao I don't care about these things until every functionality is implemented.

 

I noticed this code:

STA WSYNC ; draw spacing / move
STA HMOVE
STA WSYNC
STA HMOVE

This will cause the sprites to be moved twice, e.g. if HMP0 is set to move +2 pixels, then it will be moved +4 pixels by this code.

 

Chris

 

This part is for vertical missile spacing and here the missiles are not shown so I put the horizontal spacing here as well. 2 moves causes the missiles more apart from each other. ;)

Link to comment
Share on other sites

But I still want to know what did I mess up there.

 

The routine looks okay to me at a casual glance, but I notice that the side-to-side misplacement in the shmup0 version follows a pattern based on whether the missile closest to the ship is to the left, in the center, to the right, or in the center:

 

1st missile is to the left -- missile is over ship's center, central missile is 2 pixels to right of ship's center

1st missile is in the center -- missile is 1 pixel to right of ship's center

1st missile is to the right -- missile is 4 pixels to right of ship's center, central missile is 2 pixels to right of ship's center

1st missile is in the center -- missile is 3 pixels to right of ship's center

 

Since the central missile's position is the same when the first missile is to the left or right of the ship, I'm wondering if the problem was in the way you were calculating the position of the first missile?

 

The not consistent size is there still

 

I can't see what you're referring to; all the missiles look the same size to me and have the same vertical spacing between them.

 

Did I do the centering right? Is this how you use the RESMPx?

 

Yes, it looks correct to me.

Edited by SeaGtGruff
Link to comment
Share on other sites

SeaGtGruff: Try to change the "PLAYERXPOS" to 60, 70 and 80 for example. You will see the deviation is not the same and sometimes it's a huge step to any direction when the mirror case - same logic but opposite side - is just a little off. It seams completly random for me. Maybe the move table is being incorrectly red in the "PositionASpriteSubroutine". (seriously how to express this? :) )

 

 

Thansk for taking a glance at the problem!

Edited by rawbits
Link to comment
Share on other sites

Okay, I think I understand the problem now. In shmup0 you are calling the positioning routine to position the ship, which is fine. But then you call the positioning routine again to position the missile-- except you haven't cleared the motion registers first, so strobing HMOVE at the end of the positioning routine to position the missile is causing the ship to move some more as well. This problem doesn't show up in shmup2 because you're using RESMP0 to position the missile to the ship rather than calling the positioning routine again, hence the ship isn't getting HMOVEd a second time by mistake.

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