Page 1 of 1

Getting AI to pilot my ship

Posted: Tue May 10, 2011 5:06 pm
by FattyPants
Hi all!

Hope you're all doing great, and if not, well, hope things get better for you soon. =)

I spotted Vega Strike the other day and decided to download 0.5.1 and I'm loving it. Lots of new features! So I decided to start modding again. I liked some models from another game and decided to start ripping them out and putting them inside VS and it's working so far.

I got to buy my first modded ship finally, and I'm happy with it. But I'd like to know how to get the AI to drive my ships around too. Is there a way to get the computer players to fly around in my ship as well?

Thanks for any help,

Dan

Re: Getting AI to pilot my ship

Posted: Thu May 12, 2011 9:51 am
by pyramid
Glad to hear you like the latest VS release.

You'll probably need to change "faction_ships.py" to add your ship to the AI. Maybe some other python files, too, but I'm not sure about that. You might want to peep into our wiki, there is a tutorial on adding ships.

Re: Getting AI to pilot my ship

Posted: Thu May 12, 2011 7:28 pm
by FattyPants
"Like" is not the word. I really enjoy 0.5.1, lots of improvements. A couple of my friends are into it again, too! :mrgreen:

Thanks for the help, though! I had read the How To Add Ships article in the wiki, and it didn't have any information on how to allow the computer players to also use the new ships. I guess I assumed that the engine did it automatically, but I'll look into faction_ships.py to see what I can find out in there!

Thanks for all the hard work everyone's putting into this game. It's a real joy to play. You can't beat the price, but even still its unfinished nature makes it an interesting experience every time!

So thanks again!

Dan

Re: Getting AI to pilot my ship

Posted: Sun May 15, 2011 3:40 pm
by FattyPants
Well, I added the name of the ship in the faction_ships.py.

Code: Select all

stattableexp={
        #SHIPNAME:(CHANCE_TO_HIT,CHANCE_TO_DODGE,DAMAGE,SHIELDS,ORDINANCE_DAMAGE),
        "Admonisher":(0.38,0.32,100,1410,2000),
        "Ancestor":(0.48,0.58,160,410,400),
        "Archimedes":(1,0.18,60000,2292530,1000000),
        "Ariston":(0.54,0.32,500,1190,800),
        "Areus":(0.64,0.34,400,1300,300000),
        "Mk32":(1,0.18,60000,2292530,1000000), #dupe of Archimedes FIXME
        "Beholder":(1,1,5000,6940,0),
        "Convolution":(0.54,0.7,500,620,50000),
        "Thales":(0.32,0.02,1000,10000,10000),
        "Clydesdale":(1,0.14,40000,1683740,300000),
        "Cultivator":(0.68,0.16,300,286770,0),
        "Derivative":(0.5,0.46,500,1030,400),
        "Determinant":(0.5,0.62,300,590,400),
        "Diligence":(0.52,0.14,200,18720,400), # dupe of Mule FIXME
        "Dirge":(0.38,0.38,180,290,200),
        "Dodo":(0.4,0.16,10,2500,0),
        "Dostoevsky":(0.6,0.68,200,540,2000),
        "Franklin":(0.76,0.78,200,2590,2000),
        "Gaozong":(0,0.9,0,40,0), 
        "Gawain":(0.67,0.7,500,400,400),
        "Gleaner":(0.52,0.14,200,18720,400), #dupe of Mule FIXME
        "Goddard":(0.86,0.24,800,5200,500000),
        "GTIO":(0.4,0.16,10,2500,0),
        "H496":(0.4,0.16,10,2500,0),
        "Hammer":(0.36,0.28,600,550,50000),
        "Hawking":(1,0.2,80000,1887640,0),
        "Hidalgo":(0.52,0.14,200,18720,400),
	"Hurricane":(0.5,0.5,2500,15000,0),        
	"Ruizong":(1,0.19,25000,1800000,400000),
        "Hyena":(0.44,0.52,150,300,200),
        "Kafka":(0.4,0.16,10,2500,0),
        "Koala":(0.4,0.16,10,2500,0), # dupe of Kafka FIXME
        "Kahan":(1,0.18,25000,1400000,500000),
        "Kierkegaard":(0.86,0.24,800,5200,500000), #dupe of Goddard FIXME
        "Lancelot":(0.5,0.44,540,1250,600),
        "Llama":(0.34,0.22,200,4630,400),
        "MacGyver":(0.52,0.52,40,320,0),
	"Maller":(0.5,0.5,2000,11000,0), # Maller   <------------- HERE    
	"Midwife":(1,0.16,2000,269400,3210), #dupe of Watson FIXME
        "Mule":(0.52,0.14,200,18720,400),
        "Nietzsche":(1,0.18,20000,1564400,100000),
        "Nicander":(0.52,0.46,300,910,300),
        "Nicander.escort":(0.52,0.46,300,910,300),
        "Ox":(0.68,0.16,300,286770,0),
        "Pacifier":(0.3,0.2,400,1890,100000),
        "Plowshare":(0.3,0.2,100,1380,400),
        "Progeny":(0.68,0.86,200,470,400),
        "Quicksilver":(0.52,0.52,40,320,0),
        "Redeemer":(0.38,0.38,180,290,200),
        "Robin":(0.44,0.48,300,350,200),
        "Sartre":(0.3,0.2,100,1380,400),
        "Schroedinger":(0.8,0.91,120,790,400),
        "Seaxbane":(0.44,0.48,300,350,200), # dupe of Robin FIXME
        "Shenzong":(0.52,0.52,40,320,0),
        "Shizu":(0.52,0.52,40,320,0),
        "Shizu.civvie":(0.52,0.52,40,320,0),
        "Shundi":(1,0.18,50000,2017640,3210),        
        "Sickle":(0.34,0.34,480,390,800),
        "Taizong":(0.78,0.42,440,1150,100000),
        "Tesla":(1,0.22,100000,1887640,0),
        "Tridacna":(0.68,0.16,300,286770,0), #dupe of Ox FIXME
        "Agasicles":(1,0.22,20000,1366420,600000),
        "Vendetta":(0.52,0.5,440,450,0), #dupe of Zhuangzong FIXME
        "Agesipolis":(1,0.16,50000,5738710,3210),
        "Watson":(1,0.16,2000,269400,3210),
        "Leonidas":(1,0.12,300000,8138400,2000000),
        "Yeoman":(0.68,0.16,300,286770,0), # dupe of Ox FIXME
        "Anaxidamus":(1,0.24,50000,2495160,1000000),
        "Zhuangzong":(0.52,0.5,440,450,0),
        "Shizong":(0.52,0.5,440,450,0),
        "Agricultural_Station":(1,0,10,21841060,0), #dupe of Commerce_Center FIXME
        "AsteroidFighterBase":(0.52,0,200,1512400,3210), #dupe of Refinery FIXME
        "Asteroid_Refinery":(0.4,0,10,33071210,0),
        "Asteroid_Shipyard":(0.4,0,10,33071210,0), #dupe of Asteroid_Refinery FIXME
        "Commerce_Center":(1,0,10,21841060,0),
        "Diplomatic_Center":(1,0,10,21841060,0), #dupe of Commerce_Center FIXME
        "Factory":(.02,0.02,10,13987040,0),
        "Shaper_Bio_Adaptation":(0.12,0,10,9050760,3210),
        "Fighter_Barracks":(0.12,0,100,9050760,3210),
        "Gasmine":(.02,0.02,10,13987040,0), #dupe of Factory FIXME
        "Medical":(1,0,0,2230130,0),
        "MiningBase":(1,0,100,715750,0),
        "Outpost":(0.12,0,100,9050760,3210), #dupe of Fighter_Barracks FIXME
        "Refinery":(0.4,0,10,33071210,0),
        "Relay":(0.24,0,10,3228510,0),
        "Research":(0.12,0,0,5497290,0),
        "Shipyard":(0.12,0,100,9050760,3210), #dupe of Fighter_Barracks FIXME
        "Starfortress":(1,0,750000,475993990,4000000)
        }

# stattable is generated by adding your ship/base to stattableexp, and then running log_faction_ships.py ('python log_factions_ships.py')
Now, the ships show up in the game, but no model or stats. These ships work fine otherwise, but whenever they are ai-controlled, they don't show up. Am I correct in how I'm doing it?

Dan

Re: Getting AI to pilot my ship

Posted: Sun May 15, 2011 7:03 pm
by TBeholder
Try to switch to another your ship or set var "ai_pilot_when_in_turret" to true and switch to a turret.
But you probably won't like the result.
The autopilot will ignore your missions, so when you switch back you discover that it changed the target and ran to the other end of the system. Provided it didn't crash into something already, of course.

Re: Getting AI to pilot my ship

Posted: Mon May 16, 2011 1:46 am
by FattyPants
Hey,

Thanks for the reply, unfortunately, I think I should have been more clear. I didn't mean the AI piloting my ship while I'm in it (though that is a pretty cool idea now that I think about it.)

What I meant was that I've ported a few ships over from another game for myself and I want to get it so that the computer can fly them around, too. That way, it's just not me in piloting that one lone ship in a whole vast universe of different ships. =)

Thanks again!

Dan

Re: Getting AI to pilot my ship

Posted: Mon May 16, 2011 9:53 am
by TBeholder
FattyPants wrote: What I meant was that I've ported a few ships over from another game for myself and I want to get it so that the computer can fly them around, too. That way, it's just not me in piloting that one lone ship in a whole vast universe of different ships. =)
I.e. where VS (or your mod) should refer to it so that the engine would use it in game? Depends on what exactly you want.
  1. In all cases - a proper entry in data/units/units.csv - including Combat_Role value present in AI tables (all are in data/ai, but practically you just copy an entry of a similar ship).
  2. To test the model as a stationary object or a ship flying around, spawn it the way bases or PC ship are spawned in a flightgroup (with different faction) respectively, in some mission file (in data/mission/ - see examples in explore_universe.mission, modelview.mission and viewallships.mission). And start VS with it (vegastrike your_data_dir/mission/your_test_mission.mission).
  3. To make it purchaseable on bases, it needs an entry assigning it a purchaseable category and cost in data/master_part_list.csv.
  4. To let a new ship be spawned as a part of normal flightgroups - set up the faction's flightgroups data under a proper role in data/modules/faction_ships.py find a line like

    Code: Select all

    capitals = (...
    ...
    ("Ox","Mule","Mule","Mule","Cultivator","Cultivator"), #shaper_citizen
    ...
    ...so you only need to add the new unit's name to the list and it will be randomly selected too.

Re: Getting AI to pilot my ship

Posted: Thu May 19, 2011 6:29 pm
by klauss
Also, pay attention to the naming convention in units.csv.

Most ships have a <name>.stock, <name>.<somethingelse> etc versions. Those matter especially for generated NPCs, because the scripts (faction_ships.py) creates stock (empty) versions and adds upgrades randomly to get some variants (based on difficulty levels BTW).

So, make sure your units.csv entries follow those guidelines.

Sadly, I cannot remember which entries are needed - if you find out, please please document it in the wiki :D

Re: Getting AI to pilot my ship

Posted: Sat Jun 25, 2011 4:51 pm
by FattyPants
Thank you both for your help! I finally got the ships to show up in game! =D

And now, another question. How do I get the new ships to show up in missions? Not campaign missions. The regular, everyday random missions like bounty missions and whatnot? I've got quite a huge ship and I want to give it to the pirates because I'd really like to be able to up the ante and give the player more challenging missions as they grow. My goal is to make the game have more material so that it doesn't stop being interesting once you're into trading auto factories.

Thanks for any help!

Dan

Re: Getting AI to pilot my ship

Posted: Mon Jun 27, 2011 8:36 pm
by FattyPants
Oop. I spoke too soon. I just saw a mission which included one of my new ships. :oops:

Nevermind. =)

Re: Getting AI to pilot my ship

Posted: Tue Jun 28, 2011 9:03 pm
by FattyPants
Well, I discovered which entries are required, but I'm uncertain where to put it in the Wiki, so I will simply state them here in the meantime while I go a-hunting! :D

They are:

Name
Name.stock
Name.milspec
Name.civvie
Name.blank
Name.rgspec (I have no idea what that one is, I've never seen it before, but faction_ships.py calls for it in the stat table.)

Unless you specify otherwise, faction_ships.py will only call for the "Name" version of the ship. If you tell it to, faction_ships.py will call for .civvie or whatnot, but you have to tell it to. Otherwise, it apparently will default always to "Name".

So, in summary: you only need "Name" if you want faction_ships.py to call for one version of all the ships. Stat table inside faction_ships.py will call for all six of the variations of ships, but, unless you tell it to, VS will only use "Name" for computer players and "Name.stock" for player ships.

Hopefully this clears up some things. I'm learning as I go! =) Hope you're all doing great!

Dan

Re: Getting AI to pilot my ship

Posted: Thu Jun 30, 2011 11:13 pm
by travists
FattyPants wrote:Thanks for the reply, unfortunately, I think I should have been more clear. I didn't mean the AI piloting my ship while I'm in it (though that is a pretty cool idea now that I think about it.)
It is isn't it? I can see such used to execute pinpoint maneuvers that even top notch pilots would have trouble pulling off. Or, a lazy man's way of running a patrol. (Hey it's money, but boring if in a friendly system.)

Re: Getting AI to pilot my ship

Posted: Fri Jul 01, 2011 2:10 pm
by FattyPants
Another feature I'd certainly like to see is multiplayer campaigning so that my friends and I can play a campaign over a private server. That would rock as well. =) And bloom...lots and lots of bloom. :D

But the game is so much fun, even in its unfinished state. In fact, I think the unfinished state makes it even better than most other space sims out there!