[4.5.6] Sprite Cycling (flicker)

AllDarnDavey

Active member
Yup, @CutterCross beat me too it, this will do little to nothing for slowdown.

You might want to look at the advanced Shmup tutorial, it goes into some optimizations on hard coding how some objects are handled to strip out complexity and free up a bit of CPU time. Would come in handy to do something like that for your projectiles. Game is looking cool BTW.
 

9Panzer

Well-known member
Thanks @AllDarnDavey ! If it wasn't for folks like you I wouldn't have even gotten off the ground. Its been slow - but things are starting to make a little more sense each day :)
 

PasseGaming

Active member
There is a reason why so few people bothered with the Shooter module. It's absolutely terrible to try and make one on NESmaker.
 

vanderblade

Active member
Yup, @CutterCross beat me too it, this will do little to nothing for slowdown.

You might want to look at the advanced Shmup tutorial, it goes into some optimizations on hard coding how some objects are handled to strip out complexity and free up a bit of CPU time. Would come in handy to do something like that for your projectiles. Game is looking cool BTW.
Have you tested this on the LR platformer mod? I'm running into glitches when the player crosses a load seam, but I'm not sure if it's because my game is so heavily modified and there are conflicts or if it's because this was meant for single-screen games.
 

AllDarnDavey

Active member
Have you tested this on the LR platformer mod? I'm running into glitches when the player crosses a load seam, but I'm not sure if it's because my game is so heavily modified and there are conflicts or if it's because this was meant for single-screen games.
Oh man... I've been so busy at work this year I'm pretty rusty with NESmaker stuff. I definitely know I had it tested and working in the maze mod, the metriodvania mod, and the brawler mod. I don't remember specifically if I ever tested it with the scrolling platformer mod, but that mod setup is very similar to the metriodvania one, so it seems strange to me that it wouldn't work. It definitely should be compatible with scrolling though, metriodvania and brawler mods both have scrolling.
 

vanderblade

Active member
Oh man... I've been so busy at work this year I'm pretty rusty with NESmaker stuff. I definitely know I had it tested and working in the maze mod, the metriodvania mod, and the brawler mod. I don't remember specifically if I ever tested it with the scrolling platformer mod, but that mod setup is very similar to the metriodvania one, so it seems strange to me that it wouldn't work. It definitely should be compatible with scrolling though, metriodvania and brawler mods both have scrolling.
Thanks for replying, man, especially if you're busy. It's probably because I tried to merge your changes here with my existing already-modified script and am just missing something. I'll take another look at it.
 

vanderblade

Active member
Oh man... I've been so busy at work this year I'm pretty rusty with NESmaker stuff. I definitely know I had it tested and working in the maze mod, the metriodvania mod, and the brawler mod. I don't remember specifically if I ever tested it with the scrolling platformer mod, but that mod setup is very similar to the metriodvania one, so it seems strange to me that it wouldn't work. It definitely should be compatible with scrolling though, metriodvania and brawler mods both have scrolling.
Okay, so this is what is happening. The sprite cycling works great, but if I move past the 6/7th column, things start to break down, I think because of something to do with the scrolling and loading. (By the way, I would obviously never situate my monsters like this in the actual game. Just a test screen.)

neMULEsis_sprite_cycling_bug.gif

The only part in my doHandleObjects script that is different from your code is below, and I believe it's from the default script. Around line 77 for me.

Code:
;; Below is everything that happens for an active object.
        doActiveObject:
       
            ;;;; EVALUATE THE CAMERA POSITION

                LDA Object_x_hi,x
                STA pointer
                LDA Object_screen,x
                AND #%00001111
                STA pointer+1
                           
                Compare16 pointer+1, pointer, camX_hi, camX
                ; arg0 = high byte of first value
                ; arg1 = low byte of first value
                ; arg2 = high byte of second value
                ; arg3 = low byte of second value

                +
                    JMP +checkRightForDrawingOffCamera
               
                ++      
                    ;;; object is outside camera
                    ;;; so skip updating this object.
                    JMP doObjectIsInactive
                   
            +checkRightForDrawingOffCamera
                LDA Object_x_hi,x
                ;CLC
                ;ADC #$10 ;; arbitrary - approximate width of objects
                STA pointer
                LDA Object_screen,x
                ;ADC #$00
                AND #%00001111
                STA pointer+1

                LDA camX
                STA pointer5
                LDA camX+1
                clc
                ADC #$01
                STA temp
                Compare16 pointer+1, pointer, temp, pointer5; camX
                +
                    ;; this camera is out of camera range.
                    JMP doObjectIsInactive
                ++
                    ;;; this object is in camera range.
                    ;;; cotninue evaluating this object.

So, anybody see the probably painfully obvious issue here?

EDIT: I don't think the problem stems from this script alone, but rather how it's interacting with another script. Even if I get rid of the extra code, the game behaves the same way. Shucks. That makes this much more difficult to diagnose and solve.
 

AllDarnDavey

Active member
It does seem like it might be somewhere around this code where the issue lies, it does look like it's messing up the drawing seem somehow. But what you posted is exactly the same as in the normal DoHandleObjects_withinCamera.asm
 

Levty87

New member
I followed the tutorial exactly, I even commented out the doUpdateSpriteTimer as mentioned. But when I tested my game it really slowed down in a way that I couldn't see if it was working or not. I also got invisible collision from my monsters I can't explain. I'm working in a metrovania kinda game and what I noticed is that it uses DoHandleObjects_withinCamera.asm in stead of DoHandleObjects.asm. What could be wrong? Could it have something to do with the difference of those scripts?
 

baardbi

Well-known member
I tried this in the metrovania module and I also got strange behavior. I noticed there was a part of the doHandleObjects_withinCamera missing in your code. I copied the code from the default file into this and now it seems like it's working fine. Here's the new modified file.
 

Attachments

  • doHandleObjects_withFlicker.zip
    3.5 KB · Views: 14
I know this is ages old, but I couldn't get this to work on the Maze Module. Once everything was in place, my player sprite wouldn't function/draw on screen anymore. It's not a performance improvement (which I need desperately) so I didn't try to solve for it. Posting in case anyone knows an obvious thing I missed.
 

vanderblade

Active member
I know this is ages old, but I couldn't get this to work on the Maze Module. Once everything was in place, my player sprite wouldn't function/draw on screen anymore. It's not a performance improvement (which I need desperately) so I didn't try to solve for it. Posting in case anyone knows an obvious thing I missed.
I'm having similar bugs -- either my player won't appear or I get bizarre behavior, like random hits from monsters with no collision or the game resets. I suspect, but have no way of confirming, it might be do to using the larger, combined screens? Still investigating.
 
Top Bottom