Progress Thread - Wolfling

Moderator: Moderators

Post Reply
User avatar
Lazycow
Posts: 98
Joined: Tue Jun 11, 2013 1:04 pm
Contact:

Re: Progress Thread - Wolfling Zero

Post by Lazycow » Thu Dec 07, 2017 11:16 pm

Sound effects are working now. But I have the feeling that every effect shows up a bit late.
Is that the expected behaviour with famitone2-effects?

User avatar
rainwarrior
Posts: 7671
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Progress Thread - Wolfling Zero

Post by rainwarrior » Fri Dec 08, 2017 12:20 am

Sound effects should begin immediately.

In an emulator, sound latency of ~100ms or more is normal.

If you want to verify, you could try using FCEUX and step frame by frame (use the backslash \ key to step) you can hear each frame's sound as it steps.

User avatar
dougeff
Posts: 2614
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Progress Thread - Wolfling Zero

Post by dougeff » Fri Dec 08, 2017 5:32 am

Make sure you main song volume isn't overpowering the sound fx. Sound effects should be as loud, or louder than the music (in famitone2) or they won't play.

I modified my vrsion of famitone, to avoid this.
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
Lazycow
Posts: 98
Joined: Tue Jun 11, 2013 1:04 pm
Contact:

Re: Progress Thread - Wolfling Zero

Post by Lazycow » Sun Dec 10, 2017 12:49 am

weekly update: 7 weeks to go

Image
Zolionline has finished the 1st enemy, there's a mini end sequence and the NES low level code seems to be stable: The game is fully playable now!!
(but there're only two rooms - lot's of work ahead...) 8-)

@FrankenGraphics: Nice ideas... I guess there's not enough time to improve the gameplay significytly, though.
@rainwarrior: Hm... ok, after examining everything, I think only a few effects are a bit late. The problem should be the effect itself, I guess.

User avatar
Lazycow
Posts: 98
Joined: Tue Jun 11, 2013 1:04 pm
Contact:

Re: Progress Thread - Wolfling Zero

Post by Lazycow » Sat Dec 16, 2017 10:44 am

update: 6 wees to go...
There're 18 new rooms! (and 20 new bugs)
And I just recognised that my code is too slow to move more than 2 enemies at the same time. How could that happen? :shock: It's time for optimizations!

User avatar
dougeff
Posts: 2614
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Progress Thread - Wolfling Zero

Post by dougeff » Sat Dec 16, 2017 12:15 pm

describe "too slow".

are you getting dropped frames? (lag)

try moving to a 30 frames per second animation change system.

that would be, like, do all ppu changes (buffering) in even frames, do all game logic and sprite changes on odd frames.

music should be tied to NMI to stay consistent.
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
gauauu
Posts: 654
Joined: Sat Jan 09, 2016 9:21 pm
Location: Central Illinois, USA
Contact:

Re: Progress Thread - Wolfling Zero

Post by gauauu » Sat Dec 16, 2017 1:38 pm

Similarly, but maybe less drastic, you can also often get away with updating different enemies on alternating frames. Half the enemies one frame, half the next.

User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2032
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: Progress Thread - Wolfling Zero

Post by FrankenGraphics » Sat Dec 16, 2017 4:41 pm

Also *if* the problem is mainly moving them (maybe i'm reading it to literally?) as opposed to updating them in general, it seems to suggest they have a bit more complex movement code than needed be. Some enemies might not even need hit detection routines, and else, they can sometimes be kept simple; unlike the player character.
http://www.frankengraphics.com - personal NES blog

User avatar
tokumaru
Posts: 11466
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Progress Thread - Wolfling Zero

Post by tokumaru » Sat Dec 16, 2017 10:22 pm

Enemies can often be given simpler physics and collision detection than the player. It's not uncommon to see enemies using a single point of contact with the floor, ignoring ceilings, lacking slope physics, and so on. Some enemies may even not require any interactions with the level map at all if all they do is fly or patrol a plain surface.

User avatar
Lazycow
Posts: 98
Joined: Tue Jun 11, 2013 1:04 pm
Contact:

Re: Progress Thread - Wolfling Zero

Post by Lazycow » Sat Dec 23, 2017 3:33 am

Update: 5 weeks to go...

@dougeff: Ok, that should work. But as I would like to retain the 60 fps movements, the movement code will still be called in 60 fps and I only lowered the call frequency of the control code to 30 fps. Now the program code is fast enough to move whopping 3 enemies at a time, but only if there's no scrolling.

@gauauu: Yes, that's an old C64 trick. I tried to call the player control in all odd frames, and the enemy control in all even frames. Now 3 enemies can be moved even with scrolling. Seems like querying the joypad with 30 fps is fast enough. hopefully...

@frankengraphics: Ok, I can skip the gravity and BG collision calculations on some enemies if they only walk left and right. If I only use these simple enemies, then I can handle 4 enemies instead of 3.

@tokumaru: I cannot skip the collision detetion, but I converted the collision routine to assembler and now I can move 5 simple enemies or 3 sophisticated enemies.

That's enough for now. Thanks for the hints! :D

I have also recognised that the NMI code waits ca. 24 scanlines for the SPR0-hit, doing nothing. Any ideas how I could use this time? (I'm already calling the famitone2 handling there)

User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2032
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: Progress Thread - Wolfling Zero

Post by FrankenGraphics » Sat Dec 23, 2017 4:30 am

more on enemies: Some of them can be BG based and stationary (if you have bits for ”hurting” and ”destructible” in your map system, maybe represented as ”structures” placed on top of the more mundane map) which would more or less be ”for free” as they’re part of the player characters’ bg detection. Enemies like castlevania’s twin dragon skulls would be possible this way, for example.

nmi: any timers you’d like to tick, maybe, can go there
http://www.frankengraphics.com - personal NES blog

User avatar
tokumaru
Posts: 11466
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Progress Thread - Wolfling Zero

Post by tokumaru » Sat Dec 23, 2017 5:43 am

Lazycow wrote:Any ideas how I could use this time?
Clearing the OAM buffer, maybe? You really only need to set the Y coordinates, but still. Reading the controller(s) and calculating the newly pressed and released buttons is another thing you can do.

User avatar
dougeff
Posts: 2614
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Progress Thread - Wolfling Zero

Post by dougeff » Sat Dec 23, 2017 6:12 am

Now the program code is fast enough to move whopping 3 enemies
3 is not as bad as you think (for the NES).

My Honey game was only fast enough to handle 5 enemies without slowdown. (Also 4 enemy projectiles, and 2 hero projectiles).

Other games I'm aware of had a max of about 5. 3 is close.
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
Lazycow
Posts: 98
Joined: Tue Jun 11, 2013 1:04 pm
Contact:

Re: Progress Thread - Wolfling Zero

Post by Lazycow » Sun Dec 24, 2017 5:19 am

@tokumaru: Hm... Yes, resetting Y pos OAM entries in NMI would result in a small speed boost. Didn't think of that one. :)

Another thing: After switching to PAL, the game runs with 50 fps... But there seems to be less CPU time available for the main code (outside the NMI).
:shock: Shouldn't there be more CPU time available on PAL? Where's that lost time? Maybe in the busy-wait for the SPR0 hit?

User avatar
Broke Studio
Formerly glutock
Posts: 164
Joined: Sat Aug 15, 2015 3:42 pm
Location: France
Contact:

Re: Progress Thread - Wolfling Zero

Post by Broke Studio » Sun Dec 24, 2017 6:39 am

PAL should have more CPU time.
It may be your sprite 0 waiting loop indeed.
My first game : Twin Dragons available at Broke Studio.

Post Reply