Autogame on multiplayer
-
cajadas
- Trained

- Posts: 56
- Joined: 01 Mar 2011, 17:33
Autogame on multiplayer
Hi,
I've been trying to test some multiplayer features and noticed the best way to do it would be using AI. I've best suggested to use the "autogame on" cheat i doesn't seem to work on multiplayer.
Was this feature disabled or deleted for multiplayer? Can i easily get it up and running?
I'm working on master (20110320).
Thanks.
I've been trying to test some multiplayer features and noticed the best way to do it would be using AI. I've best suggested to use the "autogame on" cheat i doesn't seem to work on multiplayer.
Was this feature disabled or deleted for multiplayer? Can i easily get it up and running?
I'm working on master (20110320).
Thanks.
-
Per
- Warzone 2100 Team Member

- Posts: 3780
- Joined: 03 Aug 2006, 19:39
Re: Autogame on multiplayer
It should work. You need to enter cheat mode first?
-
Berg
- Regular

- Posts: 2204
- Joined: 02 Sep 2007, 23:25
- Location: Australia
Re: Autogame on multiplayer
I did a few test with now trunk and old trunk this cheat works in multiplay in old trun but seems not to work in the last version it has nexus.slo with the same cheat code in it as old trunk had in AI.slo
so yes it was tried in cheat mode but did not function
regards berg
PS:maybe its QT?
so yes it was tried in cheat mode but did not function
regards berg
PS:maybe its QT?
-
cajadas
- Trained

- Posts: 56
- Joined: 01 Mar 2011, 17:33
Re: Autogame on multiplayer
By Cyps suggestions, i when looking over the src folder for AI script loading indications and found this on loadMultiScripts() (src/mulyiint.cpp).
Notice the condition confirms if it is a skirmish game. May this be the reason for "autogame on" only working on skirmish games but not on multiplayer? I'll test tomorrow.
However, by this code i can't understand what AI files are being loaded since the only AI scripts now are nexus, dydo and semperfi and none of this names appears here.
Code: Select all
// Load AI players
resForceBaseDir("multiplay/skirmish/");
for (int i = 0; i < game.maxPlayers; i++)
{
// The i == selectedPlayer hack is to enable autogames
if (bMultiPlayer && game.type == SKIRMISH && (!NetPlay.players[i].allocated || i == selectedPlayer)
&& NetPlay.players[i].ai >= 0 && myResponsibility(i))
{
resLoadFile("SCRIPT", aidata[NetPlay.players[i].ai].slo);
resLoadFile("SCRIPTVAL", aidata[NetPlay.players[i].ai].vlo);
}
}
However, by this code i can't understand what AI files are being loaded since the only AI scripts now are nexus, dydo and semperfi and none of this names appears here.
-
Per
- Warzone 2100 Team Member

- Posts: 3780
- Joined: 03 Aug 2006, 19:39
Re: Autogame on multiplayer
Multiplayer games are also counted as "skirmish". Sorry, the terminology here is imprecise and confusing.
Did you specifically mean if the "autogame" feature works in multiplayer games with other people? I think there is a check to prevent that in the script somewhere.
Did you specifically mean if the "autogame" feature works in multiplayer games with other people? I think there is a check to prevent that in the script somewhere.
-
cajadas
- Trained

- Posts: 56
- Joined: 01 Mar 2011, 17:33
Re: Autogame on multiplayer
Besides this condition on loadMultiScripts() i found no other mention of "autogame" on other files in the src folder. However, inside nexus.slo there is a condition to check in the console message is "autogame on":
I believe the ai.slo file was substituted by nexus.slo and when a player types "autogame on" this is the AI script running (since the default NetPlay.players.ai value is 0) but i cant find any check here to prevent this feature on multiplayer games with other people.
Code: Select all
event consoleEv(consoleTr)
{
//turn on 'autogame'
if(message == "autogame on" && (sender == me))
{
if(debugModeEnabled())
{
if(myResponsibility(me))
{
if(not bRunning) //make sure current machine is responsible for this AI and it's not already active
{
console(getPlayerName(me) & " is active");
reassignAI();
setEventTrigger(startLevel, chainloadTr);
}
}
}
}
...
-
Per
- Warzone 2100 Team Member

- Posts: 3780
- Joined: 03 Aug 2006, 19:39
Re: Autogame on multiplayer
Hmm. Right. The only thing I see is that it checks that you are the host (all AIs run on the host).
-
cajadas
- Trained

- Posts: 56
- Joined: 01 Mar 2011, 17:33
Re: Autogame on multiplayer
But all players run the function loadMultiScripts() when starting a multiplayer session. When "autogame" is enabled on a peer not host doesn't he run the AI script?
The thing is, as i am trying use "autogame" to test my multiplayer implementation. If a peer doesn't run the AI when "autogame" is enabled i'm afraid i can't monitor message traffic.
EDIT: I checked out the myResponsibility function and noticed that it return true if the player is responsible for himself (a.k.a. not AI), which checks out on a multiplayer game (at least in the tests i've made).
The thing is, as i am trying use "autogame" to test my multiplayer implementation. If a peer doesn't run the AI when "autogame" is enabled i'm afraid i can't monitor message traffic.
EDIT: I checked out the myResponsibility function and noticed that it return true if the player is responsible for himself (a.k.a. not AI), which checks out on a multiplayer game (at least in the tests i've made).
-
Per
- Warzone 2100 Team Member

- Posts: 3780
- Joined: 03 Aug 2006, 19:39
Re: Autogame on multiplayer
AIs only run on host, not on peers. myResponsibility(player) is true for if player is human and we are this player, or if we are host and player is an AI.
-
cajadas
- Trained

- Posts: 56
- Joined: 01 Mar 2011, 17:33
Re: Autogame on multiplayer
Since every player loads the AI scripts, wouldn't there be a way to activate AI on peer letting the host think that he's still a human player?
EDIT: I can't find anywhere the function consoleEv() being called. I guess this might be the problem. Since "autogame on" is enabled on 2.3.8 i think this might be QT related.
EDIT: I can't find anywhere the function consoleEv() being called. I guess this might be the problem. Since "autogame on" is enabled on 2.3.8 i think this might be QT related.
-
cajadas
- Trained

- Posts: 56
- Joined: 01 Mar 2011, 17:33
Re: Autogame on multiplayer
Hi,
I'm still looking in the code how the function consoleEv() in nexus.slo is called to figure out with does it work on skirmish and not on multiplayer. Doesn't every player load nexus.slo on loadMultiScript() (src/multiint.cpp) ?
Moreover, how are AI functions (such as consoleEv) called on src?
Thanks
I'm still looking in the code how the function consoleEv() in nexus.slo is called to figure out with does it work on skirmish and not on multiplayer. Doesn't every player load nexus.slo on loadMultiScript() (src/multiint.cpp) ?
Moreover, how are AI functions (such as consoleEv) called on src?
Thanks