Some Math Questions

Some Math Questions

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Some Math Questions

Post by SanadaUjiosan »

So I'm no math whiz, and that's not great for working on something like a game, but I thought I would ask some of the fine, enterprising young minds here what they thought of something.

Basic situation is, for my own sake, I'd like to have buildtimes for units simple. I realized a big part of accomplishing this was to make it so units being built in a factory could not be assisted by outside forces. Figured that out today, woo hoo. So now that the only thing affecting the build time of a unit is the factory's worker time, I looked at the equation provided to me in the wiki:

Time to Build = Build Time / Worker Time

and think "Hmmm, I could make this simple." Like make the factory worker time 1, and then just set each unit's build time to whatever amount of seconds I want it to be. I'm guessing there's no negative repercussions for this simple approach, but there might be, so if anyone knows of any, I ask you step forward.

So far I've only thought about and tried to work this out for units being built in factories, where outside forces can't influence the speed. But I'm open to multiple workers being able to build a building, and I still want things to be simple.

So if a building's Build Time is, say 10, and 10 workers with a worker time of 1 work on it, will it build instantly? If that's how it works, then is there a good way to balance reasonable build times for single workers, and massive mobs of workers which could potentially build buildings in a moment or two? How do the other big mods approach this? I noticed CA uses 6 and 12 as common worker times.

Does each worker working on a building (or unit in general) put forth the build cost in full? Like if two workers are working on a building with a build cost of 100 energy and metal, do both workers use 100 energy and metal each, resulting in a 200 energy/metal cost?

These may seem like easy questions to answer, but I just really want to get things straight. Know exactly what I'm doing. I grew up on just needing more minerals and Vespene Gas, and gold and food to make units :-)
Kerr
Posts: 37
Joined: 27 Feb 2010, 03:18

Re: Some Math Questions

Post by Kerr »

So I'm no math whiz, and that's not great for working on something like a game, but I thought I would ask some of the fine, enterprising young minds here what they thought of something.

Sure.

Basic situation is, for my own sake, I'd like to have buildtimes for units simple. I realized a big part of accomplishing this was to make it so units being built in a factory could not be assisted by outside forces. Figured that out today, woo hoo. So now that the only thing affecting the build time of a unit is the factory's worker time, I looked at the equation provided to me in the wiki:

Time to Build = Build Time / Worker Time

Meh, I answered the post from bottom up :s just read it all.

and think "Hmmm, I could make this simple." Like make the factory worker time 1, and then just set each unit's build time to whatever amount of seconds I want it to be. I'm guessing there's no negative repercussions for this simple approach, but there might be, so if anyone knows of any, I ask you step forward.

Not That I Can Think Of!

So far I've only thought about and tried to work this out for units being built in factories, where outside forces can't influence the speed. But I'm open to multiple workers being able to build a building, and I still want things to be simple.


Sounds like you want it to be By-The-Unit time to build, you could have it 1:1 workertime/buildtime with seconds. as below you will get a structure in 1 sec if you have buildtime and workertime the same.

Factories can be set to not be influenced by other units (as far as building) it's something *like* canBeAssisted = [[put 1 (yes) or 0 (no Here!]]


So if a building's Build Time is, say 10, and 10 workers with a worker time of 1 work on it, will it build instantly? If that's how it works, then is there a good way to balance reasonable build times for single workers, and massive mobs of workers which could potentially build buildings in a moment or two? How do the other big mods approach this? I noticed CA uses 6 and 12 as common worker times.

CA bases build time on metal cost, cost of 100 = 100 Workertime, so you need 100 workertime in units to build it.

10 cons of workertime 1 will build a structure of build time 10 in 1 second.



Does each worker working on a building (or unit in general) put forth the build cost in full? Like if two workers are working on a building with a build cost of 100 energy and metal, do both workers use 100 energy and metal each, resulting in a 200 energy/metal cost?

No, Two builders will do it in half the time for the same cost.

These may seem like easy questions to answer, but I just really want to get things straight. Know exactly what I'm doing. I grew up on just needing more minerals and Vespene Gas, and gold and food to make units :-)
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Re: Some Math Questions

Post by SanadaUjiosan »

Is there a way to alter how the build time equation is handled? And when you say "yes, with lua", could you give me an example? That I can use. Because I totally can't script something/I wouldn't even know a good way to alter it.

I've been looking at build times for other games, to get a feel for things numerically. I timed some functions in Age of Empires 2, and discovered some obvious diminishing efficiency is going on. Perhaps something along those lines?
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Some Math Questions

Post by zwzsg »

Don't or maybe do forget it is or maybe was rounded or maybe floored to closest multiple of 30.
Kerr
Posts: 37
Joined: 27 Feb 2010, 03:18

Re: Some Math Questions

Post by Kerr »

It' possible with LUA!

lol idk, i'm a newbie and don't know nearly anything about LUA, i don't even know if it is possible with lua, but it probably is. maybe not as it is determined by the unit def? (then again, CA has a factory plop gadget, and another for factory plop/boost 2 mode where the factory builds faster than normal and for free? idk...)
User avatar
JohannesH
Posts: 1793
Joined: 07 Apr 2009, 12:43

Re: Some Math Questions

Post by JohannesH »

SanadaUjiosan wrote:Is there a way to alter how the build time equation is handled?
Would be helpful to know how you want to alter it
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Re: Some Math Questions

Post by SanadaUjiosan »

Very basic idea:

The more builders working on a building, the less effective each one is. Probably goes down to where the most you can reasonably reduce build time is half of the original time. Something along those lines.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Some Math Questions

Post by Google_Frog »

Assuming you are not stalling each worker's input and drain is easy to calculate. Handling the 3 resources seperatly:

Buildee build completion += builder workertime
Once the buildee has more 'build completion'(made up word) than 'build time'(actual unit stat) it is completed. So time to completion = build time / total workertime working on it.

builder metal drain = (buildee metal cost) * (builder workertime) / (buildee build time)

builder energy drain = (buildee energy cost) * (builder workertime) / (buildee build time)

The builders don't care how many other builders are helping build. They put forward their cost every second and buildings will always cost how much they say they cost in unitdefs.

Basically everything else uses this default behaviour and simple decreasing time to completion for every builder added is often a gameplay feature, it is rarely 'dealt with'. In the case of CA the low starting build power is dealt with by boost which increases build power for the first 500 resources and factory plop. In the case of other games they often have less BT on their start buildings. I recommend a simple ratio relating energy, metal and BT as it's so much easier to manage.

With lua you can do anything with construction and resource costs that you can think of. Noone has done
The more builders working on a building, the less effective each one is.
so you would have to do it yourself, either way if you want to make anything with extra features you need to know lua. There is a lot of stuff around but you still would need to know how to adapt it. There is no limitation on how you handle resources.
User avatar
JohannesH
Posts: 1793
Joined: 07 Apr 2009, 12:43

Re: Some Math Questions

Post by JohannesH »

Google_Frog wrote:I recommend a simple ratio relating energy, metal and BT as it's so much easier to manage.
I strongly recommend against it, I rather play a economically complex game than a simple, easy one. Varied costs make for much more rewarding planning, when you cant just switch from making 1 unit composition to another without thinking.
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Re: Some Math Questions

Post by SanadaUjiosan »

The default Spring economy is not the definition of a "complex" or "interesting" economy. It's just another card in the deck.
User avatar
JohannesH
Posts: 1793
Joined: 07 Apr 2009, 12:43

Re: Some Math Questions

Post by JohannesH »

SanadaUjiosan wrote:The default Spring economy is not the definition of a "complex" or "interesting" economy. It's just another card in the deck.
And?

Its more complex if units have varying cost ratios between different resources compared to fixed ratios, no matter what system you use.
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Re: Some Math Questions

Post by SanadaUjiosan »

Well, the fact of the matter is that this hasn't already been done, and I'm sure not going to attempt it, so I guess this thread has exhausted itself for me.
Post Reply

Return to “Game Development”