Improving game performance

louistrudellouistrudel Member, BASIC Posts: 15
edited March 2016 in Working with GS (Mac)

Hello community!

Since I have experienced some lag with my project, I have been going trough it all over and over rewriting and reorganizing behaviors. I must say that I am quite surprised by the the importance of writing efficient and organized behaviors. By doing that I have almost doubled the number of enemies my game can compute smoothly!

Special shout out to Timers Are For Chumps!!
(http://forums.gamesalad.com/discussion/44707/timers-are-for-chumps-gs-optimization-tips)

and Ian
http://www.gamingdebugged.com/2013/01/15/31-gamesalad-optimization-tips/

Here are a couple of questions I am asking myself

1. Say my Enemy actor has a random Integer EnemyType

IF EnemyType=1 changeimage to img1
IF EnemyType=2 changeimage to img2
IF EnemyType=3 changeimage to img3
IF EnemyType=4 changeimage to img4

Would it be more efficient to write it like this:

IF EnemyType=1 changeimage to img1
ELSE
----IF EnemyType=2 changeimage to img2
----ELSE
--------IF EnemyType=3 changeimage to img3
--------ELSE
-------------IF EnemyType=4 changeimage to img4

2. is there an easy way to go trough a large set of data in a single frame?

hyper loops are fine but a bit of a hassle

In C# this is done easily with For loops ex:

foreach (DataColumn col in rightsTable.Columns)
{
---foreach (DataRow row in rightsTable.Rows)
---{
------//output
---}
}

3.Do you have any Key concept that makes you game run smooth?

4What do you think of my project? All feed back is appreciated

http://arcade.gamesalad.com/games/135351
http://arcade.gamesalad.com/games/131986

(I update on both to keep a backup version)

5 is there any way to use spaces to make sense of the code i wrote in this post?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    1. Yes.
    2. HyperLoops. Or the new loop behavior in the as yet unreleased version of Creator.
    3. Lots of things but it's dependent on the situation.
    4. I'll get back to you. :)
    5. Not sure what you mean but if you're asking how to type a space at the beginning of a line and have it show up, use option/alt+space.

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

  • SocksSocks London, UK.Member Posts: 12,822

    @louistrudel said:
    1. Say my Enemy actor has a random Integer EnemyType

    IF EnemyType=1 changeimage to img1
    IF EnemyType=2 changeimage to img2
    IF EnemyType=3 changeimage to img3
    IF EnemyType=4 changeimage to img4

    Would it be more efficient to write it like this:

    IF EnemyType=1 changeimage to img1
    ELSE
    ----IF EnemyType=2 changeimage to img2
    ----ELSE
    --------IF EnemyType=3 changeimage to img3
    --------ELSE
    -------------IF EnemyType=4 changeimage to img4

    If you were going to do it like this, you wouldn't need the last rule:

    If NME=1
    --image to img1
    Else
    --If NME=2
    ----image to img2
    --Else
    ----If NME=3
    ------image to img3
    ----Else
    ------image to img4

    Personally I try and avoid lots of code for simple tasks like this, I'd probably just have this . . . .

    Change image to "img"..random(1,4)

    . . . instead of separate rules for every outcome.

  • louistrudellouistrudel Member, BASIC Posts: 15
    edited March 2016

    @Socks

    good tip for putting the last outcome in the Else tab

    @Socks said:

    Personally I try and avoid lots of code for simple tasks like this, I'd probably just have this . . . .

    Change image to "img"..random(1,4)

    . . . instead of separate rules for every outcome.

    Every enemy gets a separate set of AI behaviors depending on its enemy number do you still think i could write this another way?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2016

    Whenever someone asks for feedback about their game, I'm conscious of two things: 1) positive feedback is generally not very helpful and 2) people weigh negative feedback more heavily than positive so that a ratio of 1:5 of negative to positive feedback is often considered balanced.

    So here goes: The game seems potentially really fun! I love the sort of samurai-fantasy look to the characters. The archers are a cool touch and make me think it's a bit tower-defensy. Is that what the rounds are for? Without instructions, it's hard to know what all is involved... are the steaks important? What is the blue bar for? Besides WASD and the mouse, are they other keyboard controls? I left the game running for several hours (oops) in a browser window and never lost so... it's too easy. Without a significant challenge, a game gets boring. What is the objective? How do I advance or win? Is there any sound? I scored 4 points. Players like to feel rewarded for their efforts so even though I clearly didn't do very well, you might scale up the rewards system and give me 400 points.

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

  • louistrudellouistrudel Member, BASIC Posts: 15
    edited March 2016

    @tatiang said:
    Whenever someone asks for feedback about their game, I'm conscious of two things: 1) positive feedback is generally not very helpful and 2) people weigh negative feedback more heavily than positive so that a ratio of 1:5 of negative to positive feedback is often considered balanced.

    So here goes: The game seems potentially really fun! I love the sort of samurai-fantasy look to the characters. The archers are a cool touch and make me think it's a bit tower-defensy. Is that what the rounds are for? Without instructions, it's hard to know what all is involved... are the steaks important? What is the blue bar for? Besides WASD and the mouse, are they other keyboard controls? I left the game running for several hours (oops) in a browser window and never lost so... it's too easy. Without a significant challenge, a game gets boring. What is the objective? How do I advance or win? Is there any sound? I scored 4 points. Players like to feel rewarded for their efforts so even though I clearly didn't do very well, you might scale up the rewards system and give me 400 points.

    Thank you for these insightful advice!

    I will surely work on a more rewarding score system and setting up a better challenge for the player

    Here is how the game works for future reviewers

    The controls are:

    -WASD move
    -Click to attack
    -Mouse position to aim
    Q to select Meelee Weapon
    E to select Ranged weapon
    Space to eat Steak (potions)

    -the blue bar drains if you shoot arrows (its mana)
    -each round spawns a different set of mobs
    -the enemies try to make their way to the portal (ugly green circle you spawn on)
    -its game over if you have no more portal live (hearts on topright corner)
    -pick up weapons and boosters from killing enemies

    http://arcade.gamesalad.com/games/135351
    best played in fullscreen (bottomleft corner in the arcade)

Sign In or Register to comment.