Tip: Rethink your code because there could be a simpler faster way!

ElfizmElfizm Member Posts: 489
edited February 2013 in Working with GS (Mac)
Hello

Just thought I would share and remind what some of the more experience users do. Just because you have a code that works doesn't mean it's the most productive way.

I been building up my game for months not thinking about this issue to much. Got to the near end and everything was getting delayed by a few seconds because it was running through so many rules. I had 60 main actors that each have about 60 rules in it about different variables. and that was just the easy low key stuff.

After noticing I couldn't get it to run smoother I tried to rethink the code because that's what @FryingBaconStudio said some where along the line.

Took two days to come up with something that would work. Two days of sitting down with paper and pencil . After many failed attempts I managed to get it down to 9 rules per an actor and runs as quick as a rabbit. Although I did have to add more images I worked well.

So now I wish I had listen and tried to find a simplier way or more better way instead of leaving it because it works.

Just thought I would share that people do know what they are talking about :)

Cheers
Elfizm

Comments

  • beefy_clyrobeefy_clyro Member Posts: 5,394
    Many many times there is a simpler and more elegant solution .. Too often I've used an elaborate solution, over thought it at the start and ended up stripping it out for something much simpler and lighter :)
  • ElfizmElfizm Member Posts: 489
    That awkward moment when I can't spell simpler correctly.

    @beefy_clyro most of my coding is thought out on paper first, just the basics, I think of one way to it and just stick with that and try for hours trying to make it work, when I could have just looked at it from a different view. So this time I learnt a big lesson because I have spent months working on it making it work and today, after I spent two days brain storming I could match a better result in one day. But I guess it's the learning on the journey that counts.

  • beefy_clyrobeefy_clyro Member Posts: 5,394
    Absolutely, all about learning mate!
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    It was a sinple fix. :)

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited March 2013
    Ah glad somebody listened..lol. Yes, it is easier to just throw it in because it works. But really great logic takes time and thought. Soon though you learn to do this in your head as you get better and better at understanding logic. I knew you were a hard working smart one! Remember you get out what you put into something. Lesson two, my writing mentor used to say "don't fall in love with your ideas." Why, because you force them into things and can't give them up and the idea might just plain suck.
  • ElfizmElfizm Member Posts: 489
    edited February 2013
    @FryingBaconStudios

    Good to see you on the forums again :)

    I think when I started my top secret project a few months back I was more into the idea of getting it done quick and fast with that one idea. Ideas grow and you have to be able to give up your Oriningal idea because the next one may be even better like you were saying before. But it's been on my mind since being mentioned a while back and now it actually hit me.

    So think of other ways guys and don't be too proud like I was to find another way even if it already works. People being saying it for ages so it helps to listen.

    That is all
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    On topic of this, I have redone a part of my new game 4 times now to get the right solution ... All worked but I now have better performance and is certainly lighter than my last solution as well ... All in all, happy days :)
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited March 2013
    @elfizm I do read the forums and you were so kind in your PM to me when things went sideways, I had to post and tell you good job and keep it up!
  • ElfizmElfizm Member Posts: 489
    @beefy_clyro

    Is this on your new lad endless runner? Glad to hear it's all going good, looking forward to it :)

    @FryingBaconStudios we newer members have to make sure the other well known people don't disappear like t shirt booth. :)
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    @Elfizm It is indeed :) The game is resource hungry due to the animations and sheer size of the images used in the parallax scrolling. Had to tinker lots to optimise stuff to keep it running at an acceptable rate! Its looking like its going to be new generation devices only though!
Sign In or Register to comment.