mifriis / edge-of-kuiper

Textbased space rpg somewhat based on real science
Other
7 stars 3 forks source link

Refactored gametime into a pure struct #34

Closed larsbaunwall closed 2 years ago

larsbaunwall commented 3 years ago

I've refactored GameTime into a struct encapsulating the pure point in time (Ticks) in gametime, eliminating the need to think in real time.

The only time, where real time is needed is in GameTime.Now(), which translates elapsed real time into GameTime.

GameTime should be used everywhere to represent time in-game.

Would be great to get rid of these static methods (as they are hard to test), but this is the first iteration...

mifriis commented 3 years ago

apart from the underscores is there a difference?

From phone


From: Lars Baunwall @.> Sent: Friday, September 17, 2021 6:38:43 PM To: mifriis/edge-of-kuiper @.> Cc: Michael Nissen Thorup Friis @.>; Mention @.> Subject: Re: [mifriis/edge-of-kuiper] Refactored gametime into a pure struct (#34)

CAUTION: This email originated from outside of your organization.

@larsbaunwall commented on this pull request.


In kuiper-tests/GameTimeShould.cshttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmifriis%2Fedge-of-kuiper%2Fpull%2F34%23discussion_r711202086&data=04%7C01%7Cmichael.nissen.thorup.friis%40lego.com%7C92838573bb0a475a114208d979f99de7%7C1d0635156cad41959486ea65df456faa%7C0%7C0%7C637674935272500890%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=F2%2BI3lFUbadIw2uVbRGCzSEs6FK6CCDuI3I%2FdUyMCis%3D&reserved=0:

     [Fact]

Hmm 🤔

Personally, I like the Should convention: StructureUnderTest_Should_ExpectedBehavior_When_StateUnderTest (I kinda got that from the class naming (the StructureUnderTest_Should part))

@mifriishttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmifriis&data=04%7C01%7Cmichael.nissen.thorup.friis%40lego.com%7C92838573bb0a475a114208d979f99de7%7C1d0635156cad41959486ea65df456faa%7C0%7C0%7C637674935272510874%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=nEW2mpFIi5D9GJI%2B%2FFeaiFb2qUvuezloeMm5xq5Wgds%3D&reserved=0 do you have a naming conventionhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdzone.com%2Farticles%2F7-popular-unit-test-naming&data=04%7C01%7Cmichael.nissen.thorup.friis%40lego.com%7C92838573bb0a475a114208d979f99de7%7C1d0635156cad41959486ea65df456faa%7C0%7C0%7C637674935272510874%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=4DsYyGNxepBtsmVWDDDnYerl%2By8bJ7Sbpv7ussLlMrc%3D&reserved=0 in place, you would like to be used?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmifriis%2Fedge-of-kuiper%2Fpull%2F34%23discussion_r711202086&data=04%7C01%7Cmichael.nissen.thorup.friis%40lego.com%7C92838573bb0a475a114208d979f99de7%7C1d0635156cad41959486ea65df456faa%7C0%7C0%7C637674935272520817%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=VnLNh9yn5dhrQtZ%2F6RoanTLWIAdNJ4NawdPQwTfSgKY%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAALAOCXIXK4IVTZZDFRE43LUCNVJHANCNFSM5EDGJP6Q&data=04%7C01%7Cmichael.nissen.thorup.friis%40lego.com%7C92838573bb0a475a114208d979f99de7%7C1d0635156cad41959486ea65df456faa%7C0%7C0%7C637674935272520817%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=cnpShjjjAENCjESZktR4E%2FYPeSEsl9xjbdfjZ9dR%2FYI%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Cmichael.nissen.thorup.friis%40lego.com%7C92838573bb0a475a114208d979f99de7%7C1d0635156cad41959486ea65df456faa%7C0%7C0%7C637674935272520817%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=vyZs0hfZnivkn9enJMZs9va99Afa4rFA3gd8153Nt98%3D&reserved=0 or Androidhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Cmichael.nissen.thorup.friis%40lego.com%7C92838573bb0a475a114208d979f99de7%7C1d0635156cad41959486ea65df456faa%7C0%7C0%7C637674935272530772%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ptLeVlTExpYOTs8U1jAD9puVj5gS7nqENbEOILylwxU%3D&reserved=0.

larsbaunwall commented 3 years ago

apart from the underscores is there a difference? From phone

Syntactically, there is, but to some extent the semantic meaning is the same, I guess. When the test suite grows, syntax begin to matter to quickly get an overview of what is being tested And did you just reply via e-mail? 👴

larsbaunwall commented 3 years ago

@Nicoolai @VisualBean I rewrote the implementation to get closer to a pure container and introduced a TimeService for the current game time calculation. It still has a nasty static, but at least it is a tad bit easier to factor out later on.

VisualBean commented 3 years ago

Ill check it out tomorrow 🙂 On Fri, 17 Sep 2021 at 19.49, Lars Baunwall @.***> wrote:

@Nicoolai https://github.com/Nicoolai @VisualBean https://github.com/VisualBean I rewrote the implementation to get closer to a pure container and introduced a TimeService for the current game time calculation. It still has a nasty static, but at least it is a tad bit easier to factor out later on.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/mifriis/edge-of-kuiper/pull/34#issuecomment-921974673, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIMPUC346GRCYAIBH6KBZLUCN5SZANCNFSM5EDGJP6Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- mvh Alex Carlsen