rawbits Posted September 23, 2012 Share Posted September 23, 2012 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 Quote Link to comment Share on other sites More sharing options...
rawbits Posted September 23, 2012 Author Share Posted September 23, 2012 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 Quote Link to comment Share on other sites More sharing options...
+stephena Posted September 23, 2012 Share Posted September 23, 2012 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: 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 The centering (or lack thereof) that you see in these ROMs is also appearing that way on a real console Quote Link to comment Share on other sites More sharing options...
cd-w Posted September 23, 2012 Share Posted September 23, 2012 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 Quote Link to comment Share on other sites More sharing options...
rawbits Posted September 23, 2012 Author Share Posted September 23, 2012 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: 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 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. Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted September 23, 2012 Share Posted September 23, 2012 (edited) 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 September 23, 2012 by SeaGtGruff Quote Link to comment Share on other sites More sharing options...
rawbits Posted September 23, 2012 Author Share Posted September 23, 2012 (edited) 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 September 23, 2012 by rawbits Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted September 24, 2012 Share Posted September 24, 2012 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. Quote Link to comment Share on other sites More sharing options...
rawbits Posted September 24, 2012 Author Share Posted September 24, 2012 SeaGtGruff: Aha! Nice catch. I'll use that subrutine to position the enemies too so I would run into this problem again. Thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.