Jump to content
  • throwback wednesday: a classic coding post


    andracass
     Share

    hi! i bet some of you were expecting this dev blog to never get used again.

    and that's fair.

    we're, like, half a step away from the "final" release. community beta has gone shockingly well. it has blown everyone's expectations out of the water devside. gamebreaking bugs have been few and far between. the site didn't crash (though it came close!). the discord server somehow managed to stay fairly tame despite the massive amounts of hype. (which, if you want to drop some nice words to the devs, check out this thread!)

    we're all like what????

    so the next step between now and the actual release is to just, like, say that one of the patches is the final release.

    there's not really a big process that determines when we're there- eventually we'll hit a patch that seems stable and be like "yeah, okay, i think we can be done with this."

     

    and that means i can get back to work

    one of the downsides of needing to release something stable is that i can't just run around and break whatever shit i want. so over the past few months i've built up a backlog of bullshit that i'm just absolutely sick of, and now i get to blow all of it up!

     

    hype.

     

    so who wants a coding post.

    (quick disclaimer: this post is kind of a disjointed mess- i got interrupted by some moderation stuff and it definitely threw me off a bit. sorry!)

     

    the pbs is garbage and i hate it

    90% of people who know what a pbs is only know because they're asking for debug.

    but did you know that the pbs actually does something?

    the pbs is where all of the game-related data is held. it's basically a bunch of text files that have information that, say, defines what a move is, or what a pokemon is, or what teams different trainers have.

    it is organized like actual ass garbage.

    here's what the moves list looks like:

    image.png

    the fuck are any of those numbers. you need a manual for this shit.

    tm learnsets are in here too! and they look like this:

    image.png

    ughhhhhhh it's so gross. good luck finding out if someone's missing from that.

    the pbs is a horrible mess to work with.

     

    - legally required disclosure notice -

    my lawyers have advised me to throw in this disclaimer because otherwise i risk being cancelled by relic castle again.

    this is not what the updated version of essentials uses. it's laid out a little bit more nicely. it's not what we work with because we can't get the newer version.

    all characters in this post are fictional. any relation to persons, living, dead, or not yet in existence, is entirely coincidental.

    - legally required disclosure notice -

     

    so i have made some ✨changes✨ and i think they're pretty neat so i'm going to tell you about them.

    here's what the moves pbs looks like now:

    image.png

    omg check that hawt code out.

    i feel like every once in a while i find out some cool new coding trick and feel the need to use it everywhere. today that cool trick is a symbol! and also hashes.

    obviously the primary advantage of this layout is that it's way easier to understand and edit. the additional bonus is that i can change anything about this move whenever i want, however i want.

    all i have to do is, say, add this:

    image.png

    bam. all i gotta do is slip a line into the code that checks if the move i'm using instantly wins the game, and it just works.

    i can do that with anything!

    anywhere!

    it's easy. simple. clean.

    even better: i don't have to compile this shit! ever! i can just load it in the game straight from the text file and the shit just works. it's beautiful.

     

    it's also not quite ready for primetime yet. i'm mentioning it now because i'm hyped about it and i think it's going to make things a lot easier for future devs.

     

    the main reason for this post is:

    the animation editor is garbage and i hate it

    right off the bat, let's state some facts.

    the reborn animations are the best in the business.

    the animation squad has put a stupid amount of effort into making some high-quality animations for every move in the game and mon transformations and field changes and probably even more shit than that??? if you even do a cursory skimming of other fangames, you'll see the phrase "uses the reborn battle animations" all over the place.

    go appreciate your friendly local animator. i'll even call them in here to make it easy: @smeargletail, @Voctrode, @VulpesDraconis, @crimsoncrim (on occasion!)

     

    and if you're not appreciating them for the visual quality, appreciate them for suffering through the animation editor.

    the animation editor is ass.

     

    the animation editor is ass

    this gets two headings because i really can't overstate what a horrible experience using the animation editor is. longtime readers of my posts will recall that i originally started as an animator!

    i made one animation.

    before mkxp the animation editor was, in my opinion, borderline unusable. people with more patience than me may disagree. i think they're wrong. basic changes took forever to do because you had to click and hold an arrow to make them happen and the rmxp engine stuttered between every single increment.

    the people who got pinged a little earlier have suffered immensely for their art.

     

    in particular, this is a callout post for vulpes.

    one day, back in--

    holy shit this only happened in january what the actual fuck

    one day, back in january, i had made some changes to try and reduce the file size of the animations. (more on this in a bit!) vulpes popped in one day and was like "hey! this thing isn't working right. i took a look at the code and think this might be the problem."

    she nailed the problem in one try. perry and i immediately indicted her into the script team. since then she's been doing a shitload of work to make the animation editor less ass.

     

    there's third reasons for this callout post.

    first, vulpes is doing some great work and we are very proud.

    second, the animation editor is so ass that it literally led two people to become scripters.

    third, this incident happened in the first place because i desperate to do something about the giant-ass animation file.

     

    the animation data structure is ass

    reborn first started the project to redo all of the animations in e16. the base essentials animations were ass and we* wanted them to be better.

    *we is ame- i didn't exist at this point, and one of the animators on the team, MDE, has since left the community

    the base essentials animation file supplied in v17 was about 1MB.

    our animation file in e16 was almost 6MB.

     

    as of right now, in e19, it is 14.1MB.

     

    one of my original optimizations was that i set the game up to only load the animation file once at the start of the game. prior to that, it loaded the animation file every time you needed an animation. the game would hang for a second every time you used a move. it was a bad system back in e18. it would be crippling in e19. i have a top of the line computer, and it still takes 3 seconds to load the animation file.

    i shudder to think about whether or not other fangames still use our animations with the old system.

     

    i posted a disclaimer earlier absolving essentials of responsibility for the PBS edits. there is no disclaimer here. the base system still works like this. if i don't get cancelled before i finish my modifications, i'm going to push for this to get put into the base engine. we're kind of doing our own thing nowadays, but this is self contained enough that i think it can still be passed off to other people easily.

     

    make your animations file half the size with one easy trick! (relic castle admins HATE this)

    imagine 1400 boxes. they each have their own labels and information written on them.

    imagine that inside each of those boxes are another 15 boxes. and then, finally, inside each of those boxes are another 20 boxes.

    that's the animation data structure.

    at its core, the animation file is a triple nested array. you have the individual animations. then you have the individual frames of the animations. then you have the individual cells.

    there's something like 140,000 of them.

    each of those arrays has a specific prescribed layout. it looks something like this:image.png

    this is everything you can do a sprite in the animation editor. all the effects, colors, blending, etc. 

    the first thing you will notice, if you are able to count, is that slots 9 and 10 are just straight up missing. that's wasted space. not good.

    a number of these parameters are never used. FLASH in particular uses four slots in this array. all of those slots are wasted. VISIBLE isn't used. that's a wasted slot.

    you have a 27 element array and 7 of those elements are wasted.

    of the remaining 20, not every element is used on every sprite. most sprites just need to exist in a place with no special effects. those sprites will use the same amount of space as a stretched sprite that's tinted blue and zoomed in.

    the fundamental cell data structure is very ineffecient.

    so i ripped it out and replaced it with a hash.

    image.png

    here's a nice before/after of my lazy implementation of it. i cut out the 7 unused elements. i set some default values for every parameter and excluded things that matched the default. i changed some values to more efficient data types.

    it's almost half the size it used to be.

     

     

    okay, so this post was a minor disaster.

    if people are really really curious about how big of a deal each of these changes are, i can make a follow up post!

    but if nothing else, now you know the posts aren't over. ame's moving on to starlight, but a lot of the squad is still involved with rejuv and/or deso.

    and i've still got plenty of shit in the scripts to be mad at.

    • Like 53
    • Thanks 4
    • Upvote 2
     Share


    User Feedback

    Recommended Comments

    • Veterans
    9 minutes ago, Dreamy said:

    As always, your stream of consciousness is a delight to behold, you wonderful code witch.
    actually understanding what's going on is another matter entirely, but it sure sounds good!
     

    god this was so not my best work

    • Like 1
    Link to comment
    Share on other sites

    Cass and the script/ dev team have been working their asses off to make the game behave better, use more efficient structures and so on. The improvement is amazing. Kudos to the whole team.

     

    1 hour ago, Dreamy said:

    As always, your stream of consciousness is a delight to behold, you wonderful code witch.
    actually understanding what's going on is another matter entirely, but it sure sounds good!
     

    Also yeah, the inner workings of cass is a wild ride lol.

    • Like 1
    Link to comment
    Share on other sites

    • Global Mods
    1 hour ago, andracass said:

    god this was so not my best work

    too bad I'm gonna tell my friends that they're cool and there's nothing you can do to stop me
     

    • Like 1
    Link to comment
    Share on other sites

    I feel like there is never enough emphasis on just exactly how much work goes on into things that most of the userbase won't even notice, we're just gonna screech that x pokemon is obtainable too late in the game. Outstanding work reducing the animation file size by almost 50%, and was learnset really just an array of strings? No IDs? Amazing work cleaning everything up. Back end of things always seem to be on fire (at least from my experience), and I love to see when things get slightly less on fire.

    • Like 2
    Link to comment
    Share on other sites

    • Developers

    cass is great, also vulpes,perry,marcello and whoever else touches the code to make magic happen, Like I swear they have to have done some dark arts to make things work

    • Like 2
    • Upvote 3
    Link to comment
    Share on other sites

    • Developers

    I feel like "ass" is an understatement considering it took me a whole month to make an animation that would have taken maybe half an hour tops in any other software. Working on the code is probably the best decision I made during development because now I can channel four years of suffering into fixing all the things that caused said suffering

    • Like 4
    • Thanks 3
    • Upvote 1
    Link to comment
    Share on other sites

    omg i don't know if it's because I've been reading Cass's previous post cuz i'm a dum dum when it comes to coding but for once I understand what is happening in this post! Hallelujah, Also kudos to Cass and the other animation team members for making this so much easier. They are walking so the future fangame creators could run XD

    Link to comment
    Share on other sites

    3 hours ago, Angelkitsune said:

    omg i don't know if it's because I've been reading Cass's previous post cuz i'm a dum dum when it comes to coding but for once I understand what is happening in this post! Hallelujah, Also kudos to Cass and the other animation team members for making this so much easier. They are walking so the future fangame creators could run XD

    Honestly same. I know very little about coding (some entry level stuff, and some stuff specific to reborn for various reasons), but Cass is able to make this stuff pretty easy to follow and also coming across as barely fucking coherent while doing so. It's a pretty impressive line to walk on, good post Cass.

    • Like 1
    Link to comment
    Share on other sites

    Easy PBS stuff is so nice. It will make it a lot easier to make enhancment mods and whatnot. It would be so awesome if this actually got pushed to Essentials. 

    Link to comment
    Share on other sites

    Quote

    if people are really really curious about how big of a deal each of these changes are, i can make a follow up post!

    Your posts are always fun to read, so I'm looking forward to this!

    Even if I don't always understand something

    Link to comment
    Share on other sites

    new update is stupid i looked forward to this for so long for this ? explain how a tyrantrum is faster than a fully ev trained mega houndoom and greninja whats the point ? 

     

    Link to comment
    Share on other sites

    • Veterans
    On 5/7/2022 at 11:03 PM, cons00mption said:

    "risk being cancelled by relic castle again"
    what doth this mean?

    last time i bitched about essentials they got really angry and ranted about me among themselves on their server.

    1 hour ago, Jiren4Star said:

    new update is stupid i looked forward to this for so long for this ? explain how a tyrantrum is faster than a fully ev trained mega houndoom and greninja whats the point ? 

     

    wow

    this is incredible

    can we start a post hall-of-fame

    Link to comment
    Share on other sites

    2 hours ago, Jiren4Star said:

    new update is stupid i looked forward to this for so long for this ? explain how a tyrantrum is faster than a fully ev trained mega houndoom and greninja whats the point ? 

     

    choice scarf probably 

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