Space Engineers

Space Engineers

AI Enemies - Waves of NPCs
 This topic has been pinned, so it's probably important
DarkkShadow0  [developer] 16 May, 2015 @ 7:37am
Full Command List
To use these command, enter them into the game chat. (Not the Comms). This means: Press Enter. Type your command in the little text box on the bottom-left of the screen. Press enter to submit your command. Keep in mind that all these commands will work with '/ai' just the same as 'ai'.

Note: this page shows command usage in a specific format. For example:
ai <[s][l]> <number of ships>
The first pair of "<>" means that; the command should be used as "ai s"or "ai sl" or "ai l". The second pair of "<>" is the next argument that must be specified.
In short: Whenever a command on this page contains "<>"; it means that you have to specify a variable in place of the shown text. In places where a command shows "[ ]", it means that the argument is optional. So in case of "<[s][l]>": You must use an argument, either "s" or "l" or both.

Basic Commands
  • ai <[s][l]> <num> : Spawn hostile AI ships (from the prefabs). The usage of this command is shown in the mod description E.g. 'ai sl 5', 'ai s 1'
  • ai off : Turn off all AI ships. All AI ships will stop moving and cease fire. This can be done to "pause" the game, or to prepare a larger wave before starting the fight.
  • ai on : Turn on all AI ships. All the AI ships will resume chasing the target.
  • ai clear : Removes all the active AI ships from the game.
  • ai setspawn <x> <y> <z> : Sets where the ai will spawn. (If you're using the basic pilot, the new spawn should have clear line of sight to players.)
  • ai randomspawn : Command set for automatically spawning AI at random times.See below.
  • ai custom : Command set for using your own ships as AI ships. See below.
  • ai help : shows this list in-game
  • ai safety off : Disable the safety, allowing you to spawn however many ships you want!
  • ai safety on : Enable the safety to ensure you do not spawn too many ships accidentally and crash your game
  • ai count : Tells you how many AI ships are currently in the game.
  • ai seeker <amount> : Spawn <amount> seeker missiles. They will blindly chase the nearest player, and explode on collision.
  • ai authPlayer <playername> : Allow a player to execute '/ai' commands on your server. Only do this when you trust someone, because with this access they could, for example, spawn a million ships and crash your server.
  • ai deAuthPlayer <playername> : Take away a players permissions. They will no longer be allowed to execute '/ai' commands
  • ai speedlimit <maxSpeed> : Limits the speed at which the AI ships will move. Note that the ships will never move faster than allowed by the game itself, but rather can be instructed to move more slowly. Setting this to -1 will effectively disable the feature. e.g. /ai speedlimit 50

CustomSpawn Command Set
This feature lets you use your custom-built ships as AI ships. View the tutorial in this discussion. The tutorial also shows the shorter versions of these commands.
  • ai custom list : Lists all currently saved ships
  • ai custom spawn <id> : Spawns a certain ship from Mod memory into game. To get the available IDs use: ai custom list
  • ai custom remove <id> : Removes a certain ship from AI memory. To get the available IDs use: ai custom list
  • ai custom save : Shows a list of ships in the world which you can save and use as AI ships
  • ai custom save <id> : Saves a specific ship to Mod memory so you can spawn it as AI later. To get the IDs, use: "ai custom save"

RandomSpawn Command Set
These commands will let you turn on/off the RandomSpawn feature. This feature will spawn AI ships automatically at certain intervals, and make them seek and destroy the nearest player.
  • ai randomspawn off : This command will disable the automatic spawning. Will have no effect until randomspawn is turned on by the following command.
  • ai randomspawn <[s][l]> <average spawn time in min> : This command will start random AI spawning. Specify the ship size flags, as well as the average time in minutes between spawns. e.g. ai randomspawn sl 5
  • ai randomspawn amount <num ships per wave> : This command specifies how many ships should be spawned in every "wave". e.g. ai randomspawn amount 3

Ai SetPilot Command
All ships spawned after issuing this command will have the specified pilot controlling them. This includes both prefab/random and custom spawns. The syntax of the "AI SetPilot" command is simple:
  • ai setpilot <pilotType> : This command will set the pilot to be used by newly spawned ships.
A pilot is what I decided to call the algorithm controlling the ships' behavior and motion (pretty obvious). There are currently three different pilot types. Each have their advantages and their drawbacks.
List of pilot types that can be used:
  • basic : This is the AI from before I rewrote the code. Yeah, it's the one that crashed into things (and you), didn't really move while in combat, and was generally not very intelligent. It is good at: better performance (you can have more, with less lag) and slightly better aim (it is easier to aim when you're not moving). RoE: They will always attack the nearest player.
  • adv : This is the new AI I wrote. It is also the default. (i.e. before manually setting the pilot, all ships spawned will use this one) It is much more mobile. It also tries to avoid collision when possible (i.e. has all thrusters). It's aim is a little worst than the basic pilot's, but in my experience this one is more enjoyable. RoE: They will always attack the nearest player.
  • ally : This pilot will follow the player who created it. It will attack the player's enemies when they get too close. It behaves much like the adv pilot, because it uses 90% of the same code. RoE: Allied ships will attack neutral (un-owned) ships. They will also attack factions, when the owner is not in a faction or if the owner's faction is at war with the target's faction. This behavior is based on the vanilla Turret behavior.
Last edited by DarkkShadow0; 11 Mar, 2016 @ 5:46am
< >
Showing 1-15 of 23 comments
Darmandorf 19 May, 2015 @ 1:57pm 
Is there a way to set the number of ships per wave with random spawn?
cen2050 24 May, 2015 @ 10:10pm 
this is pretty awesome, a hostile fleet on command!
Saobie 4 Jun, 2015 @ 1:38pm 
Noob question, but how do i execute commands?

I also have no idea about the 'ship flag' thing. Im guessing thats the ID of the ai ship, but idk what it is.
DarkkShadow0  [developer] 9 Jun, 2015 @ 6:33pm 
Sorry for the late response. I have been busy lately. To send commands you press enter, and type the command in. Then press enter again. (you have to be in single player or be the host of an multiplayer game for this to work). As for the "flag" thing. It is really quiet simple. If I wanted to spawn only small ships, I would use "ai s 4", using the "s" flag for small. If I wanted only large ships, I would use "ai l 4", using "l" for large. To get both small and large ships I might use "ai sl 4". I realize this method can be confusing to anyone who does not have experience using command-line, and I do apologize. Hopefully this clears it up.
Saobie 10 Jun, 2015 @ 11:30pm 
Is there a way to ave it randomly spawn only ships set on my custom ship list? Trying to test a whole line of ships iv made specificly for this, but it only ever spawns the standard ai ships and never mine.

This is with randomspawn on ofc. I want random encounters with small fleets of my ships, and just my ships.
DarkkShadow0  [developer] 11 Jun, 2015 @ 2:49am 
Unfortunately that is not possible at the moment. I have been considering implementing it, but I figure the command for ship selection would be rather difficult from the players point of view. You would have to select whether to spawn prefab or custom, and if prefab then what size. If custom then what ship list. you see how that would be an unpleasant command to type out? If you have a good idea for how to make it simpler, I would be glad to implement it.
Saobie 11 Jun, 2015 @ 11:28am 
Unfortunatley i do not lol.

Now to my next question: Is there any way to set multiple spawns? For the sake of a cool video, i created an immense defense platform and the idea was to have huge hordes come in from all sides.
DarkkShadow0  [developer] 11 Jun, 2015 @ 1:58pm 
Again. It would be a rather complicated command set. I will see what I can do tomorrow. If its for one video, I could make a quick (but ugly looking) hidden command for your purpouse specifically. What are you thinking; all 3d directions (sphere of enemies)? Surrounded like a 2d circle? Comming at you as a wave of half-circle?
Last edited by DarkkShadow0; 11 Jun, 2015 @ 2:01pm
Saobie 11 Jun, 2015 @ 2:18pm 
Well the idea was like so:

Reaver Ships are hostile enemy AI ships that activley seek and destroy the nearest player. Reavers spawn from Hellgates all over the map. The level of the Hellgate determines how strong the Reaver forces spawning from it will be.

If you are following, im essentially just setting many spawnpoints all over a gigantic area, in pretty random locations. SO, the ability to set more than 1 spawn in any area is what i was looking for. Though this does also tie into the 'only spawn my ships' thing, it would work just fine with the normal ones, as it just means theres no theme to it.
DarkkShadow0  [developer] 11 Jun, 2015 @ 2:55pm 
You know what. Those two features sound good. I am gonna try to implement them tomorrow. It will be in the form of one or two simple commands, perhaps with seperate lists for spawn points and for randomspawn with custom ships. I think I got a general idea of how I can make it work, and yet make it simple to both code and use. The only thing which I don't think I can implement is the "Hellgate level/strength". The code has no way to determine how strong a particular ship is, and to cross-reference ship lists with spawn points would be very confusing.
Last edited by DarkkShadow0; 11 Jun, 2015 @ 2:56pm
Saobie 11 Jun, 2015 @ 4:06pm 
Oh, the Hellgates are mine. I really just set a spawnpoint and then i make my Hellgate there. That way you can see where the ships come from. Its no more than a beacon, but its also full of turrets to prevent spawn camping. The strength thing is all set by me, i would just have a ship of so and so strength spawn next to a Hellgate of so and so level.

None of that needs to be made, i already did it. Just for the theme of my world. Because my server is meant to be very hostile like that. Thats why Reavers come out of the Hellgates to ruin marraiges.
Hucket Bat 14 Jun, 2015 @ 10:30am 
I JUST GOT THE BEST IDEA EVER. HOMEWORLD IS YOUR HINT!!!!!!!!!!!!!!
Doomsday2233 16 Jan, 2016 @ 5:29pm 
im rather confused on how to make a random encounter, it keeps saying that i ant set the wave due t a code error.
DarkkShadow0  [developer] 16 Jan, 2016 @ 7:18pm 
That's strange. I will look into it tomorrow. In the mean time; if you could post the exact command you used, and a more specific error message; that would be very helpful. Thanks for your help.
Doomsday2233 16 Jan, 2016 @ 8:40pm 
it was when i was using the randomspawn ai code
< >
Showing 1-15 of 23 comments
Per page: 1530 50