Jump to content
  • optimization o'clock part 2 electric boogaloo revengeance & knuckles.8 final mix director's cut golden edition for Wii U


    andracass

    so apparently it's been a week since last post???? and i didn't even notice. 

    anyway the bois n i have been at this coding shit and it's all like dam gurl so fast like wo

     

    lemme show u a sample of what we got.

     

    Zoom

    so let's start off with an easy one

    image.png

    this code is parked at the end of the script that updates every single event that has a sprite. each of these lines calls a function that calculates a lot of data about where the event is relative to you, and how zoomed in its sprite should be.

    i'm mostly interested in the zoom lines.

    now, TILEWIDTH and TILEHEIGHT are both defined variables. their purpose is kind of obvious. both of them have set values since the tile size doesn't change when you're in game.

    let me show you those values.

    image.png

    now, class.

    could someone please tell me what you get when you divide either of the two tilesize variables by 32?

    anyone?

    essentials?

    here's what the code looks like now.

    image.png

    better.

    this probably doesn't look like that substantive of a change, and, yes, compared to the sheer number of calculations that need to be done per frame, this is kind of a drop in the bucket. to this, i counter:

    - this keeps two functions from being called per event per frame. if you're in, say, charlotte's gym, these functions would get called a grand total of 9,120 times each every second

    - it's literally just one 

    - it doesn't even do anything

    - it's just like "oh hey let's change the zoom from 1 to *shuffles notes um, 1" which is literally not even a thing

     

    which leads me to

     

    Math

    if you read through my entire last post (thx btw!) you'll remember that i was very tilted by the fact that essentials calculated the value of 128*4 a grand total of 8 times per event per frame via the in_range? function (which i'll be coming back to!). so, 72,960 times per second in charlotte's gym.

    this was not necessary. it was never necessary. it filled my heart with despair and my soul with rage.

    well.

    unknown.png

    WE GOT A WHOLE LOT MORE WHERE THAT CAME FROM

     

    Weather Updates!

    image.png

    the snow and sandstorm lines hurt me. why would you have the thing multiply something by two and then divide by four. why not just divide by two? better yet, why not just set them all to the same value in the first place and then drop the value in there? this isn't even nearly as big of an issue as the 128*4 thing but it just bugs me.

    image.png

    you can't even see the whole time because rmxp's script editor is ass, but i think you can get the idea here: all this does is multiply a bunch of shit together that doesn't need to be multiplied, and it gets called thousands of times every second.

    it doesn't have to be this way.

    i could go on, but like, do you really want to see me complain about math more? no, you don't. suffice it to say that about half the time i see a function is running absurdly often or absurdly long, it tends to be doing a whole bunch of stupid math. it offends my sense of justice.

     

    are you SURE you're in range??

    this one i particularly wanted to include in the event that you also happen to make these games and are particularly interested in some shit that can help speed things up.

    good news!

    this is some easy shit that you can just grab for yourself.

    nearly every single aspect of the code that affects the overworld operates through one central script: the Scene_Map update function. nearly every aspect of your entire gaming experience has some sort of roots in that single function. it pushes all the overworld processing to two separate scripts: Game_Map which deals with the mechanics of the map itself (where events are, what maps are connected to it, etc) and Spriteset_Map, which handles everything you see on your screen. essentials comes with some helpful anti-lag scripts that use the in_range? function and the event trigger to determine if an event actually needs to be updated. it's actually helpful! it saves some time updating events that literally do not matter.

    here's the thing.

    despite the fact that the two major functions handle a lot of the same objects, they don't coordinate with each other at all. that leads to a lot of duplicated calculations.

    but there's a fix for that!

    in game_event:

    unknown.png

    in game_map:

    unknown.png

    in spriteset_map:

    unknown.png

    and boom. ur game already goes at the speed of zoom.

     

    is this a deep bush?

    this is gonna be a short one because i'm getting tired.

    i've mentioned functions that run on a per event per frame basis. what this basically means is that the code runs for every event on the map regardless of what is, every single frame of the game. these functions are the core of why some places simply lag to hell: the game is updating so much shit that your computer- even with the hippest, hoppest, newest CPUs- can't keep up (especially on speedup). the reason that 18.4 was such a huge improvement is because it took a massive chunk of those updates and yeeted them.

    well, i'd now like to give you part 2: bush edition.

    when something is in a bush in pokemon, it looks different. we all know this. when something is in a big bush, it looks big different.

    but in reborn, nothing is in a big bush- except for you.

    so we just 

    yeeted the code that dealt with that!

    and wow is it faster.

    you can even see for yourself!

    (i've updated the patch on the downloads page, too, but not the main downloads. it's not worth that level of effort.)

     

    anyway. trying not to pass out on my keyboard.

    there's still a lot of fixes i haven't mentioned that will be in e19 and just require more testing before i let them out into the wild.

    but that patch has some fancy new in_range functions along with it.

    if it breaks someone's game i will cry.

    • Like 26
    • Thanks 4
    • Hmm 1

    User Feedback

    Recommended Comments

    This post reminds me of my math teacher who said that more math is good. I would like to throw this in her face as proof that less math is better

     

    You guys are amazing. Hopefully this will not cause any unexpected issues, it's too amazing to want to change back

    • Like 4
    Link to comment
    Share on other sites

    • Global Mods

    I'd think of a clever and witty comment but my brain is now running slower that the latest version reborn because it's late at night so you're out of luck 

     

    fast good. 

     

    cass good.

    • Like 3
    Link to comment
    Share on other sites

    • Veterans
    13 minutes ago, Dreamblitz said:

    I'd think of a clever and witty comment but my brain is now running slower that the latest version reborn because it's late at night so you're out of luck 

    me by the end of this post

    • Like 1
    Link to comment
    Share on other sites

    "do you really want to see me complain about math more?"

    Yes?

    (imo it's not really math, just code someone hadn't cared to optimize)

     

    Am I the only one who's interested to see what the code looked like before your fixes (in the section "are you sure you're in range")?

     

    What do you call a "deep bush"? Aren't there some on Route 1?

     

    Anyway, that looks like an amazing job, cass.

    (also, please don't deprive yourself of sleep for us).

    Link to comment
    Share on other sites

    • Veterans
    15 minutes ago, Mindlack said:

    Am the only one who's interested to see what the code looked like before your fixes (in the section "are you sure you're in range")?

     

    What do you call a "deep bush"? Aren't there some on Route 1?

    well, if you have an old version of the game (or really any version of essentials) you can probably find something.

     

    and yes, those are the deep bushes. that just happens to be what they're called in the code.

    Link to comment
    Share on other sites

    47 minutes ago, andracass said:

    well, if you have an old version of the game (or really any version of essentials) you can probably find something.

    I've checked the game and a version of Essentials, and I can't find anything resembling a script. I suppose I need RPG Maker to get the dat/rxdata files to make sense?

     

     

    Link to comment
    Share on other sites

    • Veterans
    1 hour ago, Mindlack said:

    I've checked the game and a version of Essentials, and I can't find anything resembling a script. I suppose I need RPG Maker to get the dat/rxdata files to make sense?

     

     

    yes. gemini is a free alternative, too

    Link to comment
    Share on other sites

    Jeeze, nice work. I'd like to think that those math things come from someone being used to compiled programming where that is optimized-out... but considering how messed up other stuff in Essentials is, I'm not optimistic. 😅

    • Like 1
    Link to comment
    Share on other sites

    • Veterans
    9 minutes ago, Aeodyn said:

    Jeeze, nice work. I'd like to think that those math things come from someone being used to compiled programming where that is optimized-out... but considering how messed up other stuff in Essentials is, I'm not optimistic. 😅

    big same.

    hear that there have been updates to some of this.

    but after hearing about past incidents where the reborn team (before my time) tried to implement new versions

    (and considering what i've seen)

    i am not optimistic here

    Link to comment
    Share on other sites

    My head almost went numb from reading the title... but this time it didn't... A - Am I... Getting used to this? I don't know if that is a good sign or bad sign for my brain, nor what that says about me.

     

    Buuuuuttt... On the real, great update Cass! We all really appreciate your hard work.

    • Like 1
    Link to comment
    Share on other sites

    • Veterans
    1 hour ago, BlueRose86 said:

    Hi, I'm not that smart lol, when I extract the patch for the updated 18.4 should i just put it in my reborn folder or the data folder in the reborn folder??? 😧

    data folder!

    Link to comment
    Share on other sites

    • Veterans
    58 minutes ago, Firecage said:

    Could similar reasons be why so, so many pokemon fangames tends  to either 'lag' when they really shouldn't, or 'lag' at rather unexpected areas?

    yup.

    everyone uses the same engine, which means it has the same flaws.

    unfortunately, there isn't really a great way to just take what we've done and move it into a different game since a number of optimizations are reborn specific.

    Link to comment
    Share on other sites

    Now my game doesn't freeze for a second or two before every move animation, it's instant! It's a miracle!

    As always, very fun post to read, cass, though I dumdum so I didn't completely understand everything.

    Y'all are amazing ❤️

    • Like 1
    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.

    Guest
    Add a comment...

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


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • i know i'm, like, criminally bad at updating the sidebar

    but it's just the scripts!

    i never know what's worth mentioning.

    anyway we might redo the battle system.

    (6/15)

     

     

    SPOILER_shaving_luna_head.png

  • 16-4.png
    16-5.png
    16-6.png
    16-7.png
    16-8.png
    16-11.png
    16-12.png

×
×
  • Create New...