Comments (6)
Yes, you are right. My bad. There are a lot of different timing issues.
Every tick, the game calculate how much it could complete yours base. The result is the maximum
percentage of completion and is a float. Now to have the real amount, it needs to multiply it with total cost. The result is very close to a integer except you have float and float have rounding errors and floating point errors. It's sufficient to allow to spend one more minute in your base building every some tick.
The code use the ceiling function. With the rounding function, the error is gone.
Replace
cost_paid = numpy.maximum(numpy.cast[numpy.int64](numpy.ceil(raw_paid)), was_complete)
by
cost_paid = numpy.maximum(numpy.cast[numpy.int64](numpy.round(raw_paid)), was_complete)
Another solution could be using the minimum between the amount spent and the amount that can be spent. But I think it's overkill. The only case when the percent is not close to a integer is when percent is capped. But in this case, by definition, it can't be superior to the capped number (in float representation).
P.S.: I have done my test in speed 3. It works. I didn't check it in other speed.
In my case, the base is finished at 23:48.
from singularity.
That fixes it for me too, and I tested in speeds 2, 3, and 4. I think you should make a pull request for it.
Oh, and the reason the base finished at 23:48 for you is that you didn't switch to speed 2 at 23:44 like I did.
from singularity.
@dwentz89 , care to see if this issue was fixed?
from singularity.
Sorry, it's still happening exactly as I described.
Base construction uses mins_passed
, not secs_passed
, so that change shouldn't affect it at all.
from singularity.
I found the origin of the problem. Tick are played completely. But some action can be finished before tick end time. In most game, it's not a problem because tick are very fast. But we have very long tick with the slower speed settings.
Correct solution would allow tick to be partially played and abort with the time passed. But we need a major rework of the main game loop.
from singularity.
@Xenega That'd be a nice change too, but I don't see how it'd help this issue. The issue I found is that builds finish sooner than scheduled on low game speeds, but the issue you describe causes builds to finish later than scheduled on high speeds.
To use a variant of my example above, if you start a 24 hour build on day 5 at 00:30 and run at speed 2 until it finishes, it'd finish on day 5 at 23:07 because of my issue. If you instead run at speed 4, it'd finish on day 6 at 04:00 because of your issue. If both issues were fixed, it'd finish on day 6 at 00:30 regardless of game speed.
from singularity.
Related Issues (20)
- malloc_consolidate(): unaligned fastbin chunk detected HOT 4
- Crash in dialog HOT 11
- pygame.error: Unsupported image format HOT 5
- Autosaves HOT 1
- Automation of repetetive actions HOT 1
- malloc_consolidate(): unaligned fastbin chunk detected HOT 9
- Fatal Python error: pygame_parachute: (pygame parachute) Segmentation Fault on Gentoo HOT 11
- how to run from source windows HOT 1
- Crash on OSX HOT 1
- Crash bug: Fatal Python error: (pygame parachute) Segmentation Fault in Ubuntu HOT 2
- More music for the game
- Upload to PyPI?
- How do diesel generators work on the bottom of sea and on the moon? HOT 7
- Freedom issue: music requires proprietary software to compile HOT 14
- Crash bug HOT 3
- Signing key expired HOT 9
- Sway (wayland/xwayland) Crash bug HOT 3
- CPU building fails to progress HOT 3
- Publish the game on steam and other websites HOT 1
- Provide auto-save feature
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from singularity.