Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: Number of Ships at deployment  (Read 6521 times)

Flare

  • Admiral
  • *****
  • Posts: 906
    • View Profile
Number of Ships at deployment
« on: June 14, 2011, 03:22:11 PM »

Is it possible to give each side an infinite number of ships in missiondefinition? I'm trying to make a game mode where the main objective is to capture stations and to block out enemy reinforcements by capturing all the stations. Not too sure how the AI is going to handle it though. So far I'm only giving each side a massive amount of ships, and even this seems to be inadequate as they quickly dwindle to how much fighting goes on in the map.

I guess it's more along the veins of the space skirmish option in Star Wars: Empire at war, where you have to capture way-stations to fund more upgrades and ships. This is also similar to games such as StarCraft 2's space battle mod (albeit with stations being the main points of focus). Another game where this manafests itself is in the Armada Online MMO game. Particularly the maelstorm mode where a allied players have to push out and capture stations to act as a blockade against the massive ensuing waves of aliens.

I know this idea is not very original, but this type of mode is quite fun where the conservation of force doesn't play all that much of an impact.
« Last Edit: June 14, 2011, 03:33:57 PM by Flare »
Logged
Quote from: Thana
Quote from: Alex

The battle station is not completely operational, shall we say.

"Now witness the firepower of this thoroughly buggy and unoperational batt... Oh, hell, you know what? Just ignore the battle station, okay?"

Erebos

  • Lieutenant
  • **
  • Posts: 68
    • View Profile
Re: Number of Ships at deployment
« Reply #1 on: June 14, 2011, 04:18:39 PM »

Have you tried sticking addToFleet in a for loop? That way you could enter an arbitrarily large number of ships per side. I wonder if it would break anything...
Logged

Flare

  • Admiral
  • *****
  • Posts: 906
    • View Profile
Re: Number of Ships at deployment
« Reply #2 on: June 14, 2011, 04:49:47 PM »

Loop? My coding experience is next to nonexistent :o.
« Last Edit: June 14, 2011, 04:55:37 PM by Flare »
Logged
Quote from: Thana
Quote from: Alex

The battle station is not completely operational, shall we say.

"Now witness the firepower of this thoroughly buggy and unoperational batt... Oh, hell, you know what? Just ignore the battle station, okay?"

Trylobot

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1170
    • View Profile
    • Github profile
Re: Number of Ships at deployment
« Reply #3 on: June 14, 2011, 05:37:43 PM »

Here's an example of a "for" loop (a type of loop that executes its "body" a specific number of times) borrowed from the "randombattle1" in the Starfarer 0.34a core data.

Code
	
private void addShip1(String variant, int weight)
{
  for (int i = 0; i < weight; i++)
  {
    ships1.add(variant);
  }
}
Logged

Flare

  • Admiral
  • *****
  • Posts: 906
    • View Profile
Re: Number of Ships at deployment
« Reply #4 on: June 14, 2011, 10:44:53 PM »

Would it mean that I replace a ship line like this:

api.addToFleet(FleetSide.ENEMY, "condor_Support", FleetMemberType.SHIP, false);

With the above code?
Logged
Quote from: Thana
Quote from: Alex

The battle station is not completely operational, shall we say.

"Now witness the firepower of this thoroughly buggy and unoperational batt... Oh, hell, you know what? Just ignore the battle station, okay?"

Ivaylo

  • Loremaster
  • Global Moderator
  • Commander
  • *****
  • Posts: 230
    • View Profile
Re: Number of Ships at deployment
« Reply #5 on: June 15, 2011, 01:14:17 AM »

I don't think a loop would achieve the effect you're looking for, which is to keep spawning ships forever, at some interval.

The code within the mission definition is only executed once, at the beginning of the mission.


Spawning ships that were not added to the fleet explicitly in the mission definition is currently not supported.
Logged
Escort Ship-level forum support

Flare

  • Admiral
  • *****
  • Posts: 906
    • View Profile
Re: Number of Ships at deployment
« Reply #6 on: June 15, 2011, 03:29:19 AM »

Are there any plans to make future deployment screens display the number of ships each side has in a numerical fashion rather than through an individual symbol one? I imagine it's going to get really hard to keep track of things once the campaign is brought into play and fleet sizes grow.
Logged
Quote from: Thana
Quote from: Alex

The battle station is not completely operational, shall we say.

"Now witness the firepower of this thoroughly buggy and unoperational batt... Oh, hell, you know what? Just ignore the battle station, okay?"

Erebos

  • Lieutenant
  • **
  • Posts: 68
    • View Profile
Re: Number of Ships at deployment
« Reply #7 on: June 15, 2011, 05:41:41 AM »

Quote from: Flare
Are there any plans to make future deployment screens display the number of ships each side has in a numerical fashion rather than through an individual symbol one? I imagine it's going to get really hard to keep track of things once the campaign is brought into play and fleet sizes grow.

Good point, although I think the present method is preferable for smaller battles, for the same reason I wear an analogue watch – that is, it's more intuitive to compare visual weight or position than to actually read something. On the other hand, if the fleet is too large for the icons to all to be displayed in the box, it mightn't be a bad idea to have one icon for each ship type with a number next to it indicating how many there are. I suppose it really depends on how frequently we can expect to see battles of such a scale in the campaign.

Quote from: Flare
o_O

This code should add 1,000 Condors to the enemy fleet:
Code
for (int i = 0; i < 1000; i++)
{
  api.addToFleet(FleetSide.ENEMY, "condor_Support", FleetMemberType.SHIP, false);
}

Just copy it and change the quantity and addToFleet parameters as needed.

As Ivaylo pointed out, it won't spawn ships during the mission; rather, the above code is equivalent to copy/pasting the api.addToFleet() statement 1,000 times in MissionDefinition.java, so it's really just a matter of convenience.

As an aside, I wonder of the AI would choose its reinforcements in an unexpected way... for example, if it has a fleet of 5 fighter wings, 5 frigates and a cruiser, they'll all be out soon enough anyway. But if it has 5,000 fighter wings, 5,000 frigates, and 1,000 cruisers, would it perhaps favour one type of vessel and never send out the others? You might have some testing to do, Flare.  ;)
Logged

Avan

  • Admiral
  • *****
  • Posts: 1399
  • Pioneer of Starfarer Modding
    • View Profile
    • DevDB forums
Re: Number of Ships at deployment
« Reply #8 on: June 15, 2011, 06:10:24 AM »

The AI seems to like to deploy fast ships at first to capture objectives, then send out its heavy ships.... but if you have lots of ships, it will skip some of the more medium-weight ships, which won't be deployed until after the heavy ships are all expended.