Menu

simulation.start()

maggruled
2010-10-02
2015-11-11
  • maggruled

    maggruled - 2010-10-02

    org.mars_sim.msp.core.Simulation.createNewSimulation()
    and
    org.mars_sim.msp.core.Simulation.loadSimulation()

    both start the Thread that is wrapped around the Simulation instance.

    However, the main program MarsProject.java also has a line         
    Simulation.instance().start(); which will always get executed so long as an exception has not been raised.

    Would it be okay to take out the .start() invocations in the two methods of the simulation class, just to make things cleaner?

    I'm trying to polish up the way the sim starts. it tends to be slow to pop up the main window. I think this makes it harder for users to get into it, because it makes the thing seem slow.

    any objections or concerns? I've done this on my code and it didn't break it. However, it is always invoking createNewSimulation() on mine I guess for lack of finding a saved game.

    Thanks,

    David

     
  • Scott Davis

    Scott Davis - 2010-10-08

    Hi David,

    I believe those two methods are being called from the UI when the user chooses to load or create a new simulation using the menu items or buttons.  These methods call them:

    org.mars_sim.msp.ui.swing.MainWindow.loadSimulationProcess()
    org.mars_sim.msp.ui.swing.MainWindow.newSimulationProcess()

    I think it's necessary to start the simulation thread once the new or loaded simulation.

    The Simulation.start() method call in the MarsProject class might be redundant, though.

    I agree with you that it would be great if we could get the UI showing up more quickly for the user.  I'm not how useful it will be if the simulation is still getting started, however.  Perhaps starting the UI with a "loading simulation" or "creating simulation" dialog.

    I'm sorry it's creating a new simulation every time you run the app.  It should be saving the sim each time you close the app in the /mars-sim/saved directory as "default.sim", then attempting to load that file automatically each time you start the app.  Let me know if there's a problem preventing it from doing this properly on your system.

    Scott

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.