Finally got around to optimizing, the game runs really smoothly.

Just recently, about 2 weeks ago, I could finally understand GS more than I ever could before. I had the itch to remake the entire way the system of techniques was handled.

I utilized the "else" or "otherwise"{mac} a lot.

The way I organized the behaviors was by organizing them by the attributes they had in common and used, and kept grouping them, until I had this big, super rule, with nested rules inside when before, they were all seperate.

For example, in the old setup, I would have if ON(false),0,u,i,o,p,[,[, then do this. And I would have dozens of actors with those same conditions, others would have ON(true),0, f,g,h,j,k as their conditions and so on. Instead, made a super rule with a single condition of 0, as they all shared that value, then a secondary super rule of ON{true}, and under that, f,g,h,j, and k, with OTHERWISE having 0,u,i,o,p,[,[. Instead of being in a seperate rule of ON{false} since it equals "otherwise of ON{true} anyway. Actually, for f,g,h,j, and k, I made a single attribute that activates when any of those activate, thus, allowing the removal of those conditions and setting up a single attribute called X. f,g,h,j, and k still activate in game, but only for damage flavor purposes, but thanks to X, the actor itself can quickly activate it from themeselves now, allowing animation to work correctly.

And when I tested it out, the lag spikes I would see, no longer occured, it was as smooth as if I had turned the graphics down to 8-bit pixels, but they weren't. I was so amazed. o _o

This was a simplified way to explain what I did, the attributes have full names and are a bit more complex than that, as I had rules nested within rules nested in the otherwise of another rule in most instances, but it was fun to make, and I didn't make a single mistake during this past week. I'm amazed that I progressed this far, when weeks ago I wanted to give up because I couldn't understand it{and hilariously enough, it was around when I got the hang of it, that I solved the supposedly unsolvable thing I was talking about weeks ago.

I couldn't help it, I couldn't stop myself, I just went down the actors entire list of behaviors, dragging and throwing them into related groups, breaking them apart down to their essence. I literally was able to make some things in the game not only work smoothly, minimal conditions, but in a way that was superior to the old, redundant method.

I even fixed the animations on all the characters, as the missed sprites and frames where caused by too many attributes being checked, leaving the character stuck on a single frame for half a second.

The best thing I implemented was a "sword swing" that goes all the way to the last frame. I didn't use an animation controller. Instead, I used an actor that spawns, activating a game.attribute. The actor's duration is 0.27 seconds before dissapearing/destroying itself and resetting the attribute to 0/false. In the animation, the slash is 8 frames, at 30 fps. 8/30 is nearly equal to 0.27, thus the animation lasts to the last frame. No more "holding down" the button to get the animation out. :dizzy: A single tap, then boom, slash! I've been wanting to have that since the beggining, and now that I can understand and come up with solutions within GS, I managed to figure out my own method. :smiley:

Comments

  • HopscotchHopscotch Member, PRO Posts: 2,782

    Hi @Franto , yes, it is a great feeling when you learn something new and suddenly things start falling into place and you start getting confident.

    The feeling of being master of the tool, not the other way round. :) Way to go!

  • FrantoFranto Member Posts: 779

    @Hopscotch Thank you! I hope to improve even further.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    What a great description of a cognitive leap!

    By the way, that is usually how it goes. First, there is a steady climb in a skill. Then comes instability, frustration, and the desire to quit. Then, out of nowhere, it all reorganizes into a more coherent way of seeing the issue.

    May conquering the logic stack be one of many great leaps you take in game design/development.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited November 2015

    @Franto said:
    Just recently, about 2 weeks ago, I could finally understand GS more than I ever could before. I had the itch to remake the entire way the system of techniques was handled.

    I utilized the "else" or "otherwise"{mac} a lot.

    The way I organized the behaviors was by organizing them by the attributes they had in common and used, and kept grouping them, until I had this big, super rule, with nested rules inside when before, they were all seperate.

    For example, in the old setup, I would have if ON(false),0,u,i,o,p,[,[, then do this. And I would have dozens of actors with those same conditions, others would have ON(true),0, f,g,h,j,k as their conditions and so on. Instead, made a super rule with a single condition of 0, as they all shared that value, then a secondary super rule of ON{true}, and under that, f,g,h,j, and k, with OTHERWISE having 0,u,i,o,p,[,[. Instead of being in a seperate rule of ON{false} since it equals "otherwise of ON{true} anyway. Actually, for f,g,h,j, and k, I made a single attribute that activates when any of those activate, thus, allowing the removal of those conditions and setting up a single attribute called X. f,g,h,j, and k still activate in game, but only for damage flavor purposes, but thanks to X, the actor itself can quickly activate it from themeselves now, allowing animation to work correctly.

    Welcome to the world of optimized code!!!!!!! Sounds like you are getting a firm handle on the concept.

    In the electrical world we call it series or parallel relationships. Code logic is similar to electrical circuit logic.

  • Thunder_ChildThunder_Child Member Posts: 2,343

    Glad to see you have learned this as well and how VALUABLE this is...I also learned this recently and good to see @Lost_Oasis_Games chiming in because he has preached this very often and its a great feeling to get that "ah ha" moment of optimimization to make things run smoother.

    One awesome for you !

  • SLOCM3ZSLOCM3Z Member Posts: 797

    I love this! Great work. This is definitely a great skill to learn and have! And it is awesome when your game can run much smoother :smiley:

  • FrantoFranto Member Posts: 779

    @Rthurman I'm glad I didn't give up, or I wouldn't have had that leap. Thank you.

    @Lost_Oasis_Games Thank you, I didn't think the order of code and minimization/efficiency would make such a big difference when I started, but it does, greatly.

    @Thunder_Child Thank you, and glad to see another who's learned it as well recently. I think this is a very invaluable skill to learn. I am grateful for it.

    @jdlcrater Thank you, and definitely true. And it is quite fun to optimize things/build in the most efficient way.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    @Franto said:
    @Rthurman I'm glad I didn't give up, or I wouldn't have had that leap. Thank you.

    @Lost_Oasis_Games Thank you, I didn't think the order of code and minimization/efficiency would make such a big difference when I started, but it does, greatly.

    @Thunder_Child Thank you, and glad to see another who's learned it as well recently. I think this is a very invaluable skill to learn. I am grateful for it.

    @jdlcrater Thank you, and definitely true. And it is quite fun to optimize things/build in the most efficient way.

    I've been saying this for years...lol

  • SLOCM3ZSLOCM3Z Member Posts: 797

    @Lost_Oasis_Games said:

    @Franto said:
    @Rthurman I'm glad I didn't give up, or I wouldn't have had that leap. Thank you.

    @Lost_Oasis_Games Thank you, I didn't think the order of code and minimization/efficiency would make such a big difference when I started, but it does, greatly.

    @Thunder_Child Thank you, and glad to see another who's learned it as well recently. I think this is a very invaluable skill to learn. I am grateful for it.

    @jdlcrater Thank you, and definitely true. And it is quite fun to optimize things/build in the most efficient way.

    I've been saying this for years...lol

    Haha. I have seen those posts. Sometimes people get all ragey though

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    @jdlcrater said:

    @Lost_Oasis_Games said:

    @Franto said:
    @Rthurman I'm glad I didn't give up, or I wouldn't have had that leap. Thank you.

    @Lost_Oasis_Games Thank you, I didn't think the order of code and minimization/efficiency would make such a big difference when I started, but it does, greatly.

    @Thunder_Child Thank you, and glad to see another who's learned it as well recently. I think this is a very invaluable skill to learn. I am grateful for it.

    @jdlcrater Thank you, and definitely true. And it is quite fun to optimize things/build in the most efficient way.

    I've been saying this for years...lol

    Haha. I have seen those posts. Sometimes people get all ragey though

    Yep and now here is the proof..lmao

  • FrantoFranto Member Posts: 779
    edited November 2015

    @Lost_Oasis_Games Yes, without a doubt, if it wasn't for your presence on the forums, the concept would have never reached me. I've learned advanced techniques and how to understand how things work from other users, but optimized logic, as well as code running from top to bottom within an actor}, I learned from your posts. {Although, as for the attributes, I learned from GS staff that it runs on a notification based system. And from another user, I learned that scenes run code bottom to top. So I visualize a blue line going up the scene, then when it reaches an actor, the line turns red and goes down their list of rules.}

    Thank you again, Lost Oasis, for spreading the knowledge. I'm grateful to you and the other users like @Armelline, @hopscotch, @socks, @tatiang, @utopiangames, @gingagaming, @ashtmj, @tshirtbooth (for showing how quick and simple it was to build something in GS within 3 minutes usually, when other game engines had "simple" tutorials lasting at a minimum 15 minutes, which is one of the many things that drew me to GS, fast development time} and the gs staff.

    I hope I'm not forgetting anybody else.

    A mini-game/project should probably be made, to introduce people to the concept of integrated logic and how it improves performance, such as showing two actors, one with messy, redundant code and one with integrated code, and put it up in the academy as a fundamental beginner course. Maybe it's already there, or you might be working on something like it already.

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @Franto said:
    how quick and simple it was to build something in GS within 3 minutes usually, when other game engines had "simple" tutorials lasting at a minimum 15 minutes

    This is what sets GS apart. In GS you can make a messy prototype to test your gameplay concept, then start over, with a more structured approach, and still be done much faster that in any other tool.

    Now, once @CodeWizard gives us the announced export/import of code blocks...

    (http://forums.gamesalad.com/discussion/89701/gamesalad-and-steam-lets-make-this-happen#latest)

    ...development time will be down to seconds! :)

  • vikingviking Member, PRO Posts: 322

    A mini game using this approach with comments added all over the place would be awesome!

  • ClockClock Member Posts: 308

    Basically it should work this way. If you were leaving active codes off screen, it will make your game lag, because they are still running. Congrats to your level up!

  • gameviccigamevicci Member, PRO Posts: 306

    @Franto said:
    I utilized the "else" or "otherwise"{mac} a lot.

    Hi Franto, only one question, my english is not great :) So I didn't understand well your entire post.
    You mean that for better performance it's better to write:
    If X=0 do this and If X=1 do that
    instead of:
    If X=0 do this OTHERWISE to that?

    Thanks in advance!!

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    @gamevicci said:

    @Franto said:
    I utilized the "else" or "otherwise"{mac} a lot.

    Hi Franto, only one question, my english is not great :) So I didn't understand well your entire post.
    You mean that for better performance it's better to write:
    If X=0 do this and If X=1 do that
    instead of:
    If X=0 do this OTHERWISE to that?

    Thanks in advance!!

    Using otherwise depends on the code you are trying to implement. What he is refering to is writing slim logic. There is no specific tricks to writing lean logic. In order to write slim logic requires a firm grasp on what logic is and how to plan that logic to be lean in accomplishing the task. It's very tough to teach as it is a very abstract concept.

  • FrantoFranto Member Posts: 779

    @Viking Indeed.

    @Clock Yes, that's true, and thank you.

    @gamevicci As Lost_Oasis said, it depends on the logic. For example, using otherwise works well with a boolean. If you use a number, it would usually be for something like velocity check, where if 0, then do this, if otherwise, which would mean the object is moving left or right, a negative/positive value rather than zero, which is no movement, then that could work since it is checking whether the object is moving or not.

Sign In or Register to comment.