Ticket #149 (new defect)

Opened 2 years ago

Users should be able to start new Simulations without quitting

Reported by: knowknowledge Owned by:
Priority: critical Milestone: 0.6.0
Component: Source Version:
Keywords: Globals Cc:

Description

Once a Simulation has been started, it cannot be deleted and a new Simulation cannot be started until the game quits.

This is because of the proliferation of "Global" variables that have one static instance but are not managed by the Main Menu.

All game Component classes currently have a single static instance and a Instance() function. This means that Loading more Components (or the same Components again) will create duplicates in the game (two different alliances named "Independent") or worse, corrupt the Component xml files.

All Game data should be managed by the Simulation class. There should be no static classes outside of the main scope; this should only include things like options, skins, and Resources.

Important classes with this issue:

  • Lua
  • SpriteManager
  • All Game Components, but especially Planets and Gates because they are multiclassed with Sprite.

The Lua Interface classes (UI_Lua, AI_Lua, Planet_Lua, Simulation_Lua) are static by necessity. They should be able to work without

This should also enforce proper OO design, as accessing globals indicates a potential information leak between Simulations.

Only once the Simulation has been encapsulated, can we trust that a newly loaded Simulation would run correctly.

Note: See TracTickets for help on using tickets.