#What is better to use for prices in a strategy? #macro or global var?

1 messages · Page 1 of 1 (latest)

frank sorrel
#

Hi, everyone! I'm creating a strategy game with a lot of processes, buildings, units, and their costs. I've noticed that some of the costs are defined as macros, while others are global variables. I was wondering if it makes sense for optimization to rewrite all the global cost variables and similar things as macros. Will this actually have an impact on performance? Or am I mistaken? Thanks in advance for any response. And thanks in general for your help with my newbie questions.catcry0

frank sorrel
#

Oh, I would also add that the prices in the game are indeed constants. And will not be subject to any changes.

graceful field
#

I wouldn't say this has any impact on performance

#

In fact, so very little that it's not really worth it for a rewrite.

#

But

#

There is a management cost on your end

frank sorrel
#

Hi! Ok, got it! Thank you very much! That's what I wanted to know.

graceful field
#

I'd say that if anything, it'd be good to use global variables in terms of easier management

#

If you take it one step further, a struct database stored in a global variable

#

So you could have
global -> buildings -> building -> info on building.

#

Or global.buildings[$ "name of building"].some_info_var

#

Anywho, no worries

frank sorrel
#

Oh, as for management, right now I just have a list/script at the beginning of the game with all the prices. It is convenient for me to balance the game directly in the engine.

graceful field
#

nods well, that too can be done in-game

#

If it works, it works!

frank sorrel
graceful field
#

I do actually like strategy games!

#

Played a variety of them. RTS, 4X, City-based building

#

I can't wait to see your game 🙂

frank sorrel
stone sierra
#

Very nice graphics!! 😮

graceful field
unkempt light
#

brother.... hook me up with your artist... jesus

arctic solar
#

holy holy

tough saffron
frank sorrel
#

Thanks guys!
Looks like it's not as bad with my game as I thought, I should show my work more often lol🥹

graceful field
#

Should def drop some images/videos 😉