Tracking Turns in Turn Based Game Loop
I'm trying to keep track of what number turn it is in this turn based game I'm building. The game focuses a lot on simulation, and is expected to run for weeks, months, possibly years. Each "turn" occurs roughly every ten seconds. Ideally, I want to be to able to check data for what happened on what turn, and thus I need to keep track of turn number.
With this in mind, what kind of data type should I use to keep track of what numbered turn it is? I'm thinking ulong but is there a better way to handle this then just tracking a ulong variable?
ulong should be big enough I think?
The largest value for a ulong is 18,446,744,073,709,551,615. If each of those are a 10 second apart, you can play your game for about 5,849,424,173,550 years.
Huh. Never did the math myself. I'm curious as to what the equation looks like.
I'll take that as an answer though. If ulong is long enough and using a ulong is the best method to do what I'm looking to do, then I'll accept your comment as the answer.
@GameSoundGuy Just to quench your curiosity.
Source for largest ulong value is here: https://msdn.microsoft.com/en-us/library/t98873t4.aspx
18,446,744,073,709,551,615 turns at 10 seconds a pop is 184,467,440,737,095,516,150 seconds
184,467,440,737,095,516,150 / 60 = 3,074,457,345,618,258,602 $$anonymous$$utes
3,074,457,345,618,258,602 / 60 = 51,240,955,760,304,310 hours
51,240,955,760,304,310 / 24 = 2,135,039,823,346,012 days
2,135,039,823,346,012 / 365 = 5,849,424,173,550 years
give or take ;3
Answer by MichaelNielsenDev · Aug 17, 2016 at 03:39 AM
Arkaid's comment answers my question.
Your answer
Follow this Question
Related Questions
Problem with coroutine waiting 0 Answers
Looking for the best datatype for a data storing problem 0 Answers
Good Day! I have this code but I had an error 0 Answers
Press Escape, quit game if variable is false otherwise... How? 1 Answer
Optimizations: Should I use Update or FixedUpdate? Could you help me optimize rotations? 1 Answer