Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to specify game start time #2615

Merged
merged 3 commits into from Jan 10, 2014

Conversation

lwho
Copy link
Contributor

@lwho lwho commented Jan 4, 2014

Some time ago someone complained that you start at night in Los Angeles.

This PR allows to specify the game start time in the Lua function Game.StartGame and sets the start time for Los Angeles to start at sunrise.

@johnbartholomew
Copy link
Contributor

Specifying game start time is fine, but I'm not sure about the changes to Frame.

We've been able to specify rotational phase offset since #1506 was merged back in September 2012. If you want it to be daytime in LA at game start, all you need to do it adjust Earth's rotational_phase_at_start value in data/systems/00_sol.lua.

@robn
Copy link
Member

robn commented Jan 4, 2014

Or just choose a different start point. We've done it before. Nothing special about LA!

@lwho
Copy link
Contributor Author

lwho commented Jan 5, 2014

Actually I do not care at all about LA. It is just a good example.

Fiddling with rotational_phase_at_start or changing the start location works only for a custom system, but not for generated systems. I have a starting point in the outskirts of the settled areas an I preferred to see the wonderful planet I chose at start.

Moreover, I considered it a bug that the rotation resets to rotation_phase_at_start whenever you enter the system (not only at game start). So, while it is pitch-dark at LA at game start at 00:00, it could be noon at the same time when you revisit LA later when jumping out and into the system. I think, this is not the case for the orbits, only for the self rotation (but it is some time ago that I looked into this and wrote the code).

Last but not least, this iterative multiplication with the rotation matrix accumulates rounding error astonishingly fast. So, even if you stay longer in the solar system, you may notice day drift.

@johnbartholomew
Copy link
Contributor

Fiddling with rotational_phase_at_start or changing the start location works only for a custom system, but not for generated systems.

I'd rather it was easy to make custom modifications to a generated system (or otherwise specify the system); fiddling with the starting time seems like a hack if that's why you're doing it. But that's a problem for some other PR in the future.

Moreover, I considered it a bug that the rotation resets to rotation_phase_at_start whenever you enter the system (not only at game start).

Agreed, that should be fixed.

Last but not least, this iterative multiplication with the rotation matrix accumulates rounding error astonishingly fast. So, even if you stay longer in the solar system, you may notice day drift.

Agreed, that should be fixed.

m_state(STATE_NORMAL),
m_wantHyperspace(false),
m_timeAccel(TIMEACCEL_1X),
m_requestedTimeAccel(TIMEACCEL_1X),
m_forceTimeAccel(false)
{
if (!Pi::game)
Pi::game = this;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this constructor calls the Space(Game*, const SystemPath &) constructor which calls Space::GenBody(SystemBody *, Frame *) which calls MakeFrameFor(SystemBody *, Body *, Frame*) which needs the current time (Pi::game->GetTime()) for setting up the orientation of rotating frames.

Game::CreateViews seems to use the same hack.

Well the if (!Pi::game) is probably not needed ;)

@johnbartholomew johnbartholomew merged commit f81cbc6 into pioneerspacesim:master Jan 10, 2014
@lwho lwho deleted the game_start_time branch January 10, 2014 22:11
@lwho lwho restored the game_start_time branch January 10, 2014 22:22
@lwho lwho deleted the game_start_time branch January 10, 2014 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants