Starting Skirmish with kind of "spring < script.txt&

Starting Skirmish with kind of "spring < script.txt&

Discuss everything related to running Spring on your chosen distribution of Linux.

Moderator: Moderators

Post Reply
User avatar
Kaot
Posts: 23
Joined: 10 Mar 2007, 02:11

Starting Skirmish with kind of "spring < script.txt&

Post by Kaot »

I read several informations about starting spring only with a prepared script.txt where Player and Teams and CPU with AI can be inserted to start spring in Skirmish Mode, so that one Player can fight against multiple AIs.

I tried some scripts but none of them worked. Unfortunately i don't get Feedback, what is wrong.

I found this script for example but it doesn't work:

Code: Select all

[GAME]
{
  Mapname=SmallDivide.smf;
  scriptname=3 Teams;
  StartMetall=0;
  StartEnergy=0;
  MaxUnits=500;
  StartPosType=1;
  GameMode=0;
  GameType=AASBase23.sdz;
  LimitDGun=0;
  DiminishingMMs=0;
  GhostedBuilding=1;
  
  HostIP=localhost;
  HostPort=8452;
  
  MyPlayerNum=0;
  
  NumPlayers=1;
  NumTeams=2;
  NumAllyTeams=2;
  
  [PLAYER0]
  {
    name=Kaot;
    Spectator=0;
    team=0;
  }
   
  [TEAM0]
  {
    TeamLeader=0;
    AllyTeam=0;
    RGB=0.0 1.0 0.0;
    Side=Arm;
    Handicap=0;
  }
   
  [TEAM1]
  {
    TeamLeader=0;
    AllyTeam=1;
    RGB=0.0 0.0 1.0;
    Side=Core;
    Handicap=0;
    AIDLL=AI/Bot-libs/KAI-0.22.so;
  }
   
  [ALLYTEAM0]
  {
    NumAllies=0;
  }
   
  [ALLYTEAM1]
  {
    NumAllies=0;
  }
   
  NumRestrictions=0;
  
  [RESTRICT]
  {
   
  }

}
Can perhaps somebody give me a site with References about the Structure or post an example that works.

I tried several Variants of Scripts and tried to start it with

Code: Select all

spring script.txt
and also

Code: Select all

spring < script.txt
None of the Lobby Clients works for me now so perhaps this methods works somehow.

Thanks in advance,
Kaot
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Have you seen the "official" documentation?
https://spring.clan-sy.com/svn/spring/t ... 0start.txt

You run it by

Code: Select all

spring script.txt
or

Code: Select all

spring /abs/path/to/script.txt
In the first case script.txt must be in one of the data directories (not necessarily the current directory). In the second case it can be anywhere.
User avatar
Kaot
Posts: 23
Joined: 10 Mar 2007, 02:11

Post by Kaot »

Thanks a lot Tobi,
i managed it to setup a Skirmish Script, so i can play against multiple AIs.

While i was fiddeling around in the Script, i recognised that multiple Player can play the same, so to say Colour. I knew that multiple Player can play in the same Team and hence share their Metal and Energy. But if i interpret the Examplescript you gave me, in the right Way, it is possible, like it was in Earth 2150, that two or more People can control the Units of the same Colour together.

Is the following Understanding of "Team" in TA:Spring as follows
- Team: Share same Commander and Units
- AllyTeam: Normal "Team" like Understanding where you have your own Commander and can share you Metal, Line of Sight, Energy and can give spend Units to others in your AllyTeam. Do i see the others Cursors and Units they have currently selected?
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

Its possible for 2 or more users to control the same team (i.e same units) and for user(s) to control same team as AI (dont think any ai supports it though).

But u cant see what there doing though...
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Yep, it's generally referred to as com sharing in this community.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

NTai supports it.

As far as I am aware the problem comes when AIs actively check what their units commands are and re-issue when they dont match. This means the AI overwrites a players commands, examples of which are JCAI, and early AAI IIRC, although I dont know about AAI now or the other AIs. KAI doesnt appear to do this checking either.
User avatar
Slamoid
Posts: 237
Joined: 25 Jan 2005, 19:23

Post by Slamoid »

I'll try to write a bash-script to generate the game script until somone can make a proper SP lobby. 8)
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I can do that very quickly, but I need a little information first, namely what do I do about listing the AIs in linux (where should I look?) and how exactly do I output them in script.txt (do I just add the line aidll=blablahblah.so; in the player section or is there more to it?).
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Look in all data directories in the usual AI path. A list of data directories can be returned by unitsync (GetDatadirectories() IIRC). Adding them in startscript works the same as on Windows except that the extension is .so instead of .dll.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I dont have a java binding for that, I made the bindings basing them off of the contents of unitsync.cpp, perhaps its something in the python bindings?
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Hmm, yeah:

Code: Select all

////////////////////////////////////////////////////////////
////////// Functions not in other bindings (TODO)

static PyObject *unitsync_GetDataDirectories(PyObject *self, PyObject *args)
{
        // unitsync.GetDataDirectories(bool write = False)
        int write = 0;
        if (/*!PyArg_ParseTuple(args, "") &&*/ !PyArg_ParseTuple(args, "i", &write))
                return NULL;
        std::vector<std::string> f;
        if (write)
                f.push_back(FileSystemHandler::GetInstance().GetWriteDir());
        else
                f = FileSystemHandler::GetInstance().GetDataDirectories();
        PyObject *ret = PyList_New(f.size());
        for (unsigned i = 0; i < f.size(); ++i) {
                PyList_SET_ITEM(ret, i, PyString_FromString(f[i].c_str()));
        }
        return ret;
}
Post Reply

Return to “Linux”