Efficient programming (generally)
Posted: Fri May 25, 2012 7:41 pm
Hi,
I was wondering how do you handle your coding regarding efficiency, speed and as well cpu usage.
At the moment, I evolve my personally programming style and I think that is good, except I probably have to "optimize" it later.
To the point...
I would like to know how you handle things like gameStates, loops and efficient coding in generally.
Do you have some special methods or something like that?
I'm trying to make a dynamically menu, what means that I change a lot of X and Y coordinates if the user clicks on a menu point.
Also, I wonder what's better of the following things:
1) Use a Gui-library for buttons, etc.
or
2) Write the buttons as strings or images and check for collision (then hover them, mark them in another color).
Basically, the Gui-libraries base on the same system, what would be more resource-saving?
And regarding the gamestate, I essentially have two... "game" and "menu", but also other like "toGame" or if it's multiplayer "toGameMP" and so on.
I need them to hide/fade out the menu of the other gamestate.
The results are many ifs, also in other ifs and so on, like:
I call them every "dt".
...
As you can see, I'm confused.
I had a lot of other questions, but I forgot all of them.
Anyway, I'm would be very happy if you can explain and demonstrate your knowledge and experience.
Oh, and sorry for my english. I'm gonna "improve" it.
Greets
I was wondering how do you handle your coding regarding efficiency, speed and as well cpu usage.
At the moment, I evolve my personally programming style and I think that is good, except I probably have to "optimize" it later.
To the point...
I would like to know how you handle things like gameStates, loops and efficient coding in generally.
Do you have some special methods or something like that?
I'm trying to make a dynamically menu, what means that I change a lot of X and Y coordinates if the user clicks on a menu point.
Also, I wonder what's better of the following things:
1) Use a Gui-library for buttons, etc.
or
2) Write the buttons as strings or images and check for collision (then hover them, mark them in another color).
Basically, the Gui-libraries base on the same system, what would be more resource-saving?
And regarding the gamestate, I essentially have two... "game" and "menu", but also other like "toGame" or if it's multiplayer "toGameMP" and so on.
I need them to hide/fade out the menu of the other gamestate.
The results are many ifs, also in other ifs and so on, like:
I call them every "dt".
...
As you can see, I'm confused.
I had a lot of other questions, but I forgot all of them.
Anyway, I'm would be very happy if you can explain and demonstrate your knowledge and experience.
Oh, and sorry for my english. I'm gonna "improve" it.
Greets