Heirarchy of Orders

The Galaxy Lives On! Distant Worlds, the critically acclaimed 4X space strategy game is back with a brand new 64-bit engine, 3D graphics and a polished interface to begin an epic new Distant Worlds series with Distant Worlds 2. Distant Worlds 2 is a vast, pausable real-time 4X space strategy game. Experience the full depth and detail of turn-based strategy, but with the simplicity and ease of real-time, and on the scale of a massively-multiplayer online game.

Moderator: MOD_DW2

Post Reply
zgrssd
Posts: 5105
Joined: Tue Jun 09, 2020 1:02 pm

Heirarchy of Orders

Post by zgrssd »

Currently it seems like ships have one slot for orders. That leads to stupid stuff, like ships that get disabled forgetting their orders. Because the "disabled" order replaces the "fly the out of that Ion Nebula" order.

So I propose giving each ship several order "slots". Only the highest order is followed - but the others are only suppressed, not removed.

Meta Order - this is either the order from the Fleet, or from a bigger mission like "build station" or "colonize".

Opportunistic Order - Station construction needs to grab material, Colonizers need to grab Colonists and everyone needs to stop for fuel every once in a while. This is where those kind of orders go.

Friendly Request - "hello, I am tanker that is trying to refuel you. Could you please stop so I can catch you!"

Escape Order - when a ship decides to escape, this is the level the order should go for

Direct Order - this order was given to the ship directly by the player. It overrides the above stuff - because I should not need to give direct orders except to overwrite issues from above.

Capability Override - this level is applied by the ships (lack) of capabilities. Being disabled temporarily suppresses other ships order. It does not allow them to throw the orders out the airlock.

Physical Override - this level is applied by ships outside the ships abilities. Stuff like being stuck in a tractor beam or a giant green space hand.
zgrssd
Posts: 5105
Joined: Tue Jun 09, 2020 1:02 pm

Re: Heirarchy of Orders

Post by zgrssd »

So, I wrote some pseudocode up in Notepad, set to C#. Sorry if my Syntax is off, but it should get the idea across.

Code: Select all

//Let us assume there is a ShipOrder type to represent all possible orders.

class ShipOrderManager{
	ShipOrder MetaOrder { get; set }
	ShipOrder OpportunisticOrder { get; set; }
	ShipOrder FriendlyOrder { get; set; }
	ShipOrder EscapeOrder { get; set; }
	ShipOrder DirectOrder { get; set; }
	ShipOrder CapabilityOverride { get; set; }
	ShipOrder PhysicalOverride { get; set; }
	
	ShipOrder CurrentOrder {
		get {
			//Return the most important order first
			if(PhysicalOverride != null)
				return PhysicalOverride;
			
			if (CapabilityOverride != null)
				return CapabilityOverride;
				
			if (DirectOrder != null)
				return DirectOrder;
			
			if (EscapeOrder != null)
				return EscapeOrder;
			
			if (FriendlyOrder != null)
				return FriendlyOrder;
			
			if (OpportunisticOrder != null)
				return OpportunisticOrder;
			
			if (MetaOrder != null)
				return MetaOrder;
			
			//return Null if there is no applicable order at all
			return null;
		}
	}
}
Post Reply

Return to “Distant Worlds 2”