Should the real economy be changed to match the tooltips?

Should the real economy be changed to match the tooltips?

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Should the real economy be changed to match the tooltips?

Post by Google_Frog »

Tooltips for economy related things are incorrect and the values entered into unitdefs are incorrectly interpreted. I would like to know whether game and engine devs think it should be fixed.

The economy is applied every 16 frames with a multiplier of 0.5x the units income/expenditure. There are 30 frames a second so all tooltips, lua calls etc... report an incorrect value when interpreted as income/second. Something similar happens for build power. The wiki may say 'game tick' instead of second but it seems quite misleading to have values which are only about 6% off from a second. It looks fairly simple to fix in the engine (replace 0.5 with 0.5*16/15).

Basically I want to know whether it is reasonable to change the engine or whether I should so something in unitdefs_posts and make a bunch of widgets slightly more complicated.

I have written more here: http://zero-k.info/Forum/Thread/11622

More things probably assume that slow update occurs exactly twice a second. I tested self-d time, if you set a time of 600 it will take 640 seconds for the unit to explode. Worse, a countdown will occur in chat for 600 seconds. Fixing all these cases is a good idea but would be more involved. Changing slow update to 15 frames would probably have far reaching consequences that would require fixing.
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: Should the real economy be changed to match the tooltips

Post by Silentwings »

I agree its a bit strange that one system uses 16 and the other uses 30, while 30~16*2. From https://github.com/spring/spring/blob/3 ... onstants.h it looks as though the engine was deliberately written to allow changing both values independently (and there are other systems updating at other slow rates too). I guess early on it would have been clear that it was a performance consideration but no way to guess correct values for the future. And that they ended up approximately equal is maybe coincidence; maybe one day engine changes or a change in typical hardware could make it preferable to change the rates again.

In short, I don't think it is a bug or that there is anything to gain from changing this. A UI that wants to report the tooltip info as "per second of simtime" should multiply the rate afaics.

Maybe Lua should get a Game.unitSlowUpdateRate to match Game.gameSpeed, to preserve flexibility.

@ the buildcosts issue:

I think you are right that it is a common belief amongst players that tooltip/etc values are per second when game is at 1.00 speed. I think its not a major problem that this assumption is slightly incorrect and I don't view this as anything "incorrectly implemented" in the engine.

@ the slow update affecting timings of game mechanics issue:

Unsure what to think of the issue with self d timings. I haven't tested it but if what you say is true then this is "incorrectly implemented" and an engine bug. It's a separate issue (in terms of fixing, even if same cause) and sounds to me like it needs more work to understand what's going on.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Should the real economy be changed to match the tooltips

Post by Google_Frog »

You have an unexpected way of disagreeing. If you have build times and build powers visible anywhere then people are going to assume that buildTime/buildPower results in the expected construction time. Something is incorrect there but the question is whether it is worth fixing.

Regardless, I think you have enough power to make me trying to change the engine an awful experience. If I fix this it will be spread thoughout the lua.
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: Should the real economy be changed to match the tooltips

Post by Anarchid »

An engine-side solution seems possible that would circumvent the entire politics debate. Make the tick frequency a mod rule with old defaults.

People not interested in making their rates match wouldn't even see the difference.
Last edited by Anarchid on 11 Feb 2015, 14:09, edited 1 time in total.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Should the real economy be changed to match the tooltips

Post by Jools »

Thanks for writing about this issue here. I had always wondered why unit self-destruction sounds have been a bit off, I assumed it was because if command lag.

I think the issue in principally interesting, but with regard to the actual buildtimes, it's a matter of perspective. Since there is no absolute value of time—it has always to be defined in relation to some other time—you could simply solve the issue by defining 1 Earth second = 93.75% of 1 Empyrrean second.

The other point is different, here we have a mismatch between two timing systems, and the best solution would be to adjust one of these to match the other.

Note: Formatting added to show how stupid and meaningless it is
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Should the real economy be changed to match the tooltips

Post by Google_Frog »

How do you define time like that? You can't just declare it deep in some manual or fluff. There is an ingame clock, the game runs at a certain speed and players would expect build rates and incomes that look very close to per second to actually be per second.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Should the real economy be changed to match the tooltips

Post by Jools »

Well, the game clock shows earth seconds and the build bar shows Empyrrean seconds :)

It's like local time in London is 12:00 and in Perth 20:00. They are both correct.

Edit:
One second is the time that elapses during 9,192,631,770 (9.192631770 x 10 9 ) cycles of the radiation produced by the transition between two levels of the cesium 133 atom
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Should the real economy be changed to match the tooltips

Post by smoth »

Anarchid wrote:An engine-side solution seems possible that would circumvent the entire politics debate. Make the tick frequency a mod rule with old defaults.

People not interested in making their rates match wouldn't even see the difference.
Or we could just switch to a lua based economy and move the economy out of the engine..
luckywaldo7
Posts: 1398
Joined: 17 Sep 2008, 04:36

Re: Should the real economy be changed to match the tooltips

Post by luckywaldo7 »

Jools wrote:Well, the game clock shows earth seconds and the build bar shows Empyrrean seconds :)

It's like local time in London is 12:00 and in Perth 20:00. They are both correct.

Edit:
One second is the time that elapses during 9,192,631,770 (9.192631770 x 10 9 ) cycles of the radiation produced by the transition between two levels of the cesium 133 atom
I agree that it's all a matter of reference frame, but I disagree that using multiple reference frames in the UI is ok for the users, especially when there is no explicitly stated difference between them.

Edit: Nevermind, it appears we both agree there also.
The other point is different, here we have a mismatch between two timing systems, and the best solution would be to adjust one of these to match the other.
I'm personally in favor of normal seconds, as that is what people are used to.
Last edited by luckywaldo7 on 11 Feb 2015, 15:56, edited 1 time in total.
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: Should the real economy be changed to match the tooltips

Post by Anarchid »

Or we could just switch to a lua based economy and move the economy out of the engine..
Problem herein is that you are thus forbidden from using the SlowUpdate callin.

It's also only a practical option for new games.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Should the real economy be changed to match the tooltips

Post by smoth »

doesn't take long to convert to a lua based. Why is the slowupdate thing a big deal?

I might start generalizing my economy code soon but honestly, I just don't see why it would be hard.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: Should the real economy be changed to match the tooltips

Post by FLOZi »

UI inconsistency is unpleasant but I'm not sure on the best way around it.

+1 to Smoth and lua-ing economy regardless

( http://springrts.com/wiki/User:Flozi/En ... dResources )
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: Should the real economy be changed to match the tooltips

Post by Silentwings »

@Googlefrog, well you asked for opinions and you got it ;)

On the econ rate, I didn't intend to sound as though I'd fight any change to it - although as said, I don't think its a bug and I don't think there is really anything to gain. Ofc I would be against a change that removed the engines flexibility of slow update rate versus sim time, or which was not backwards compatible.

A modrules tag for the econ rate multiplier per slow update (if its really as simple as that? link pls?) seems to me like a clean way to get raw per sec numbers, for those who want them. I guess that changing the slow update rate is much too big a can of worms.
Super Mario
Posts: 823
Joined: 21 Oct 2008, 02:54

Re: Should the real economy be changed to match the tooltips

Post by Super Mario »

lua based economy is a great idea for a bounty feature, as we can kill two birds with one stone.
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Should the real economy be changed to match the tooltips

Post by abma »

but it would be very difficult to make compatible widgets if economy is implemented in lua. very likely economy widgets can't be exchanged between games any more. very likely it would break all ai's as well.
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: Should the real economy be changed to match the tooltips

Post by Anarchid »

Widgets AI iteractions are an argument towards Flozi's proposal (engine-side but configurable resource framework) as opposed to completely lua-world one.

The interface for legacy code could then stay the same.

Presumably AI's would get a new function set to retrieve a list of resource descriptions the game uses.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Should the real economy be changed to match the tooltips

Post by smoth »

abma wrote:but it would be very difficult to make compatible widgets if economy is implemented in lua. very likely economy widgets can't be exchanged between games any more. very likely it would break all ai's as well.
how so? the default settings could be made to reflect the current economy. People who do not wish to use it can either place a blank file or replace it with their own(bonus points to anyone catching THAT anime reference). If the files were in base content the transition could be seamless
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Should the real economy be changed to match the tooltips

Post by gajop »

I might be missing something, but wouldn't it just be better to have the other value (UNIT_SLOWUPDATE_RATE ?) at 15 to make things better aligned? Is that the whole issue?
I doubt that there's a significant (noticable) speed difference between 15 and 16...

Regarding engine vs Lua:
I would definitely prefer an engine implementation of a better economy system: http://springrts.com/wiki/GSoC_Engine_r ... bstraction OR a Lua library people can rely on to provide resource/economy abstractions.
The library should be on a chili level of quality and usability. (We definitely could use more libraries).
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Should the real economy be changed to match the tooltips

Post by Google_Frog »

So Silentwings is indifferent and everyone else is now talking about lua economy?

I have looked into this further and it turns out that most things which rely on slow update already have a factor of (float)UNIT_SLOWUPDATE_RATE / (float)GAME_SPEED. The economy parts instead use the magic number 0.5.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Should the real economy be changed to match the tooltips

Post by smoth »

I'd rather see you more control rather than seeing them alter slow update.
Post Reply

Return to “Engine”