mars-sim icon indicating copy to clipboard operation
mars-sim copied to clipboard

Relocatable buildings

Open mokun opened this issue 3 months ago • 7 comments

**Is your improvement request related to a situation? **

  • Currently, each building is assumed to be in placed indefinitely until it is salvaged.

Describe your rationale/motivation

  • #1746 potentially takes us into the direction of creating a landship or a nomadic settlement.
  • Before we can make a functional base mobile, we'll need to work out a little bit of physics and the math behind that idea, such as how much power and energy to move, etc.
  • To do so, we need to identify some of the impediments in implementing this mobile base idea.
  • The ability to pre-position and move building (habitable and non-habitable) around should be a vital capability in setting up a settlement in preparation for human beings' arrival.

Describe goal(s) you have in mind

  • Convert a fixed building into a relocatable building upon mating it with a mobile crawler at the bottom.
  • Iron out the logistics of disconnecting / reconnecting a building module from / to the settlement.
  • Create an UI mechanism (probably using the right click pop-up menu) to allow an easy, visual, point-and-click way to select a new location for a building to relocate.
    • Compute the power and energy that would need to be expended in order to achieve such a task and ask players for confirmation.

Any associated goal(s) that are secondary and may or may not be included

  • Build early, playable scenarios that would benefit from the use of positioning non-habitable power/resource buildings and the linking habitable buildings together prior to the arrival of human beings.
  • Take a closer look at the available resources and do an inventory of them and see how much they weight.
  • Categorize resources as essential or non-essential.
  • For the non-essential ones, stash them in tightly sealed containers and leave them behind at a location.
  • Account for those resources that must be carried with for survival.
  • Project how much vital resources must be stored and reserved for the next journey of arriving at a certain location on Mars

Describe solution(s) you desire to see

  • We may need to extend Buildings differently architecturally or we simply rename FixedUnit to something else :
/**
 * The Building class is a settlement's building.
 */
public class Building extends FixedUnit implements Malfunctionable,
	 InsidePathLocation, Temporal, ResourceHolder, UnitHolder, ItemHolder {

	/** default serial id. */
	private static final long serialVersionUID = 1L;	
...
/**
 * Represent a Unit that is at a Fixed location in a Settlement
 */
public abstract class FixedUnit extends Unit 
    implements LocalBoundedObject {
    
    private static final long serialVersionUID = 1L;
	private Settlement owner;

    /**
	 * Constructor.
	 * 
	 * @param name the name of the unit
	 * @param owner the unit's location
	 */
	protected FixedUnit(String name, Settlement owner) {
		super(name);

        this.owner = owner;
	}

    /**
     * Get the coordinates of this fixed unit on the surface.
     * @return Coordinates of the owning Settlement
     */
    public Coordinates getCoordinates() {
        return owner.getCoordinates();
    }
...

Screenshots

Image

Specifications

  • pre-3.10.0

Related Issues and Discussions

  • #1746

Additional context

  • See multiple floor layout of a building in https://github.com/mars-sim/mars-sim/issues/470

mokun avatar Sep 17 '25 22:09 mokun

@bevans2000

Do you think the simplest way to select a new location for a building is through the right-click popup menu ?

In case of construction, do you think the location of a construction site can be selected in a similar fashion ?!

mokun avatar Sep 19 '25 05:09 mokun

Yes I was thinking for unconnected buildings we select on the map. For connected building we select an unused Hatch already on the map and say create the building connected to here. Remember I want to reduce the need to specify every building at a position. The direct interconnections dictate the position.

bevans2000 avatar Sep 19 '25 17:09 bevans2000

For connected building we select an unused Hatch already on the map and say create the building connected to here.

But this approach has a drawback. A unused or open hatch must be present.

Currently, a hatch is added between two buildings explicitly in the settlement template.

Do we have a method for adding a hatch after the settlement template has been initialized ?

If we don't, we could add such a method.

I imagine that if two buildings are placed next to each other, I want the option of making an interconnection between them but I don't want to make it a mandate that I have to.

I want the option of building a long corridor north of both buildings. This corridor serves to connect these 2 buildings and others building together.

mokun avatar Sep 19 '25 18:09 mokun

Do you already have a collision check for buildings? I though I saw such a function some years back, but maybe my AI hallucinates.

Urwumpe avatar Sep 19 '25 22:09 Urwumpe

@mokun if you remember I want to change how hatches are created but that's for a later release. It took big a change at this stage. Hatches should be defined by the Building Spec not interconnects. This could add a hatch in the building where there is no space

bevans2000 avatar Sep 19 '25 22:09 bevans2000

Hatches should be defined by the Building Spec not interconnects

But should a hatch be added only by BuildingSpec ?

Should it be the only way ?

Why not more flexibility ?

mokun avatar Sep 20 '25 00:09 mokun

So if you go back and look at the chat in the other issue on this. Hatches need to be defined according to the Building spec to match their construction. Otherwise we could accidentally put a Hatch where the Garage vehicle door or on an Airlock. My option is the current approach is too flexible making creating the settlement layouts very hard to get correct with many positions needed. The reason I wanted to fix the hatches was to improve the placement of new buildings. At the moment it doesn't work. Resupply missions only work because they use Hallways to solve the placement problem. With new buildings there is no spare hallway to solve the joining problem. If you can fix the placement of new buildings with the current over flexible approach that we can drop fixed hatches. Nevertheless I want to complete 3.10 first

bevans2000 avatar Sep 20 '25 07:09 bevans2000