Maximum game attributes before serious slowdown?[Solved]

piper82

  • Posts: 6
Hi,

The more i develop a core engine for my game the more i get stuck with different behaviors i download or find in tutorials as they are written in different styles, they lack the key functionality i need or they are overkill and clog my game with unnecessary code. When i start cleaning up or upgrading code i usually end up in endless debugging and mediocre code which is very hard to read and thus hard to work on.

So, id like to write some behaviors, my style, from scratch. The thing is, im only amateur programmer comfortable working with variables (attributes) to deal with all kinds of actions in the game.

The engine consists of 5 actors exchanging bullets to boss enemy in top down enviroment, fight similar to dungeon boss in some of the MMORPG games. There are damage modifiers, temporary powerups, lots of stuff going around. The control of the actors is indirect and it involves slowing down or speeding up of attack, moving small distances to avoid incoming damage, using special abilities and such. 4 actors are simple AI while fifth actor, the 'healing' character should have somewhat complex ai. Boss would have medium complex AI.

This is a rather daring and somewhat large project for me as im very busy person. I usually develop at night when i should be sleeping. I would not like to end up with a useless game after months of sleep deprivation.

With all this in mind i suppose there would be hundred or more variables involved in the fight at the same time.

What id like to know is how would Stencyl handle such engine and is it worth at all to start this project?

Thanks in advance.

« Last Edit: January 10, 2012, 03:20:59 am by piper82 »

mukowAPPS

  • Posts: 78
Are you targeting flash or iOS? In ios, you would have no problem. Flash I could not say.

I do not. Believe the number of global attributes is that big of a deal. I think how often they are updated/called upon has more effect. ie. every frame or what have you.

Hope that helps

Alexin

  • *
  • Posts: 3132
I think you're concerned with unimportant things. It's like you want to write a book and are concerned about how many sheets of paper you have available.


Quote from: piper82
What id like to know is how would Stencyl handle such engine [...]
Stencyl provides a general purpose 2D engine and kits. Use the Space Shooter kit for example.


Quote from: piper82
[...] is it worth at all to start this project?
Is it? It depends on you. Try it.
"Find the fun"
alexin@stencyl.com

piper82

  • Posts: 6
I think you're concerned with unimportant things. It's like you want to write a book and are concerned about how many sheets of paper you have available.


Quote from: piper82
What id like to know is how would Stencyl handle such engine [...]
Stencyl provides a general purpose 2D engine and kits. Use the Space Shooter kit for example.


Quote from: piper82
[...] is it worth at all to start this project?
Is it? It depends on you. Try it.

Maybe i had put my question wrong, im sorry about it but the english is not my first language.

I dont think the number of pages is comparable to my concerns of having "too many variables in use at the same time" but nevertheless, from your answer i can conclude that this is probably not a problem. I would definitely not want to spend time to make something and find myself to learn that stencyl cannot handle x number of global variables at a time efficiently.

I already made some of my own behaviors from scratch since i need them to be written in same style so they can interact the way i want and stay simple. So far ive managed to make the simplest functional frame of the engine with placeholder graphics which now only needs to be upgraded one feature at a time. Actors shoot simple projectiles at each other and taking damage, dying etc...

I really wanted to emphasize the size of what im going to do and it is worth for me if im not going to be restricted by some kind of limitation in the process and thats the reason why i wrote all this.

Ill follow your advice and think less about possible limitations. After all i will probably pick up some skills in the process of the making that will come in handy and improve my game and programming.

Thanks for the answer.

piper82

  • Posts: 6
Are you targeting flash or iOS? In ios, you would have no problem. Flash I could not say.

I do not. Believe the number of global attributes is that big of a deal. I think how often they are updated/called upon has more effect. ie. every frame or what have you.

Hope that helps

Im targeting flash, and large number of variables will be certainly called upon at some point of the scene but definitely not all the time. It may be that im over concerned with something i shouldnt be but by the time it may become problem i also may have the solution for it. Im definitely going for it.

Thanks for the answer.

Alexin

  • *
  • Posts: 3132
Quote from: piper82
Ill follow your advice and think less about possible limitations. After all i will probably pick up some skills in the process of the making that will come in handy and improve my game and programming.
This is exactly what I wanted you to say. If you stumble upon a limitation, then the community is here to help.
"Find the fun"
alexin@stencyl.com

Jon

  • *
  • Posts: 17524
Game attributes are just entries in a registry - there's no impact on performance even if have a 1000 of them.

piper82

  • Posts: 6
Game attributes are just entries in a registry - there's no impact on performance even if have a 1000 of them.

Ive heard or read somewhere that a lot of variables are bad for the program. I just wanted to be sure if that is true.

Thanks for the answer.

CONCLUSION: NUMBER OF VARIABLES HAVE NO IMPACT ON PERFORMANCE

Syauqi

  • Posts: 10
I'm not a good programmer not smart, but I know that a lot of variables are bad for he program.

if you used with flash, then you must familiar with Object Oriented Programming.in OOP, we know encapsulation, so we always put variable in the class which needed it, not put everything in global variables. it wasn't tidy.

Same with stencyl. In stencyl, game attributes means global variable.probably, people said it meaning that in oop, global variable only created when it can't be helped to create that. at least make the getter and setter so manipulation of the value could still controlled.

i hope that helps.

coleislazy

  • *
  • Posts: 2607
I'm not a good programmer not smart, but I know that a lot of variables are bad for he program.

if you used with flash, then you must familiar with Object Oriented Programming.in OOP, we know encapsulation, so we always put variable in the class which needed it, not put everything in global variables. it wasn't tidy.

Same with stencyl. In stencyl, game attributes means global variable.probably, people said it meaning that in oop, global variable only created when it can't be helped to create that. at least make the getter and setter so manipulation of the value could still controlled.

i hope that helps.

That's not really true. I would be very surprised if anyone ever made a Flash game where the number of variables caused a performance problem. The reason you use encapsulation is to isolate the effect of a section of code on the rest of the program. It helps track down bugs and keeps code secure, but it doesn't really give a performance gain.

Alexin

  • *
  • Posts: 3132
For the sake of simplicity, the number of variables you declare doesn't affect the performance. You shouldn't even worry about it.

This discussion would make sense as an academic exercise, not as a game design concern.
"Find the fun"
alexin@stencyl.com

Syauqi

  • Posts: 10
That's not really true. I would be very surprised if anyone ever made a Flash game where the number of variables caused a performance problem. The reason you use encapsulation is to isolate the effect of a section of code on the rest of the program. It helps track down bugs and keeps code secure, but it doesn't really give a performance gain.

I didn't answer about the connection between numbers of variables and performance. i agree that it doesn't affect the performance.
i just replying piper comment about why people say that many attributes is bad for program. probably not bad program, since there would be a game which need tons of variable. i just assume that it's true when every local variable dragged outside to the global variable when it doesn't necessary. it's not tidy.
and i agree about it helps track down bugs and keeps code secure.