Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by MichaelNielsenDev · Aug 17, 2016 at 01:47 AM · updatedata storageturn-baseddatatype

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?

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Arkaid · Aug 17, 2016 at 03:02 AM 1
Share

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.

avatar image MichaelNielsenDev Arkaid · Aug 17, 2016 at 03:39 AM 0
Share

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.

avatar image Arkaid MichaelNielsenDev · Aug 17, 2016 at 03:59 AM 1
Share

@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

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by MichaelNielsenDev · Aug 17, 2016 at 03:39 AM

Arkaid's comment answers my question.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

52 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges