Jump to content

Photo

My Approach to Pits

new pits holes concept

  • Please log in to reply
2 replies to this topic

#1 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 26 July 2016 - 05:11 PM

I've been rethinking how pits should work, and my approach is somewhat different to most. I'm going to post it here--it's a general outline, with both working code, and pseudocode, so be warned that you can't compile/use it as-is--for general discussion, feedback, critique, and so forth.
 
Note also that I used some constants that are atypical, and not meant to be in the finished product; but it was faster for me to type them however I will recall what they should do. The array values will all have constants in the final codebase, to make them easier for people to comprehend when reading it.
 
Spoiler

 
The intent here, is that a user may place the ffc manually, or use a global script instruction call via a global function, to auto-launch the ffc; so the code is identical, either way. I may make a global function for it, if Waitdraw() becomes an issue, but placement after Waitdraw() is going to matter for some of the effects, whereas delaying falling for one frame will be in the favour of the player (and thus, not horrible).

Edited by ZoriaRPG, 26 July 2016 - 07:07 PM.


#2 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 26 July 2016 - 05:53 PM

I think that checking for every combo on the screen with a for loop every frame causes a good bit of slowdown on some PCs. This might not be true though.

Anyway, the code is looking good so far. This would spawn link to the last place he was before falling into a pit, rather than the screen entrance, right?



#3 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 26 July 2016 - 06:21 PM

I think that checking for every combo on the screen with a for loop every frame causes a good bit of slowdown on some PCs. This might not be true though.
Anyway, the code is looking good so far. This would spawn link to the last place he was before falling into a pit, rather than the screen entrance, right?

 
Combo for loops easily run in one frame. You won't run into slowdown until you do huge loops, with 10,000+ iterations. I do combo loops constantly for engine events, and I don't notice it on 10+ year-old laptops. The number of instructions per iteration is also very important to consider, as if an 1,000 iteration loop has 50 instructions, then it's running 50,000 ZScript instructions per frame; which translates into easily 250,000 to 500,000 ZASM instructions per frame.
 
Correct, Link spawns in the last 'safe' location, or at least, that is my intent.
 
I also think it's nicer to the player, but some people may disagree on using that.
 
This links in with my Somaria code, and in particular, the Somaria platforms. I left out one check:
 
if ( Link->Misc[ON_PLATFORM] ) ... but that's barely useful, as Link->Z is set to '1' when he's on a platform, so it's just a safety net.

Updated above, with some important things, and an option to use Link's position on screen init.


Edited by ZoriaRPG, 26 July 2016 - 07:20 PM.

  • isilmo likes this



Also tagged with one or more of these keywords: new, pits, holes, concept

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users