Wishes : AI attack each other + choice manually the number of AI

Bug #811899 reported by Thaeron
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Stratagus
Won't Fix
Wishlist
Unassigned
Wargus
Won't Fix
Wishlist
Unassigned

Bug Description

(Sorry if wishes must not be in buglist but I didn't find another place).
It would be great if we could choose AI attack each other in network party and if we could manually select the number of AI in a game (below maximum of the map).
Few years ago I made this modifications on old stratagus / wargus versions (2.2.4) and I experienced many network issues (but sometimes it worked), so I probably made mistakes.

Another little thing, I remember that GameCycle (into stratagus) is not reset on start of each network party, but I don't know if you already fix it.

Pali (pali)
Changed in stratagus:
importance: Undecided → Wishlist
Pali (pali)
Changed in wargus:
importance: Undecided → Wishlist
Revision history for this message
Kyran Jackson (erstmap) wrote :

You've identified two issues here.

1. A lack of customization options for creating a network game.
2. Poor network support (desync, no resync).

I agree that the create network game screen needs to be a little more robust. I think something along the lines of what Age of Empires 2 does would be appropriate. That is to be able to select each person's team, colour, and start location. Being able to disable AI players or select the AI type would also be a bonus.

Do cheats work multiplayer? If they could be enabled I could provide a patch which allowed you to modify the teams via typing in cheat codes. Something like typing in 'Player1 likes Player2', or 'Player3 hates Player1'. Maybe even an AI free for all.

You could also hardcode the teams in the map files them selves.

Revision history for this message
Thaeron (thaeron) wrote :

We can choose team (only with other players) in the game so may be it's not really useful to add it in the create network game screen. In addition, in my humble opinion, nobody wants to be allied with AI.
Choosing color is fun but not really useful too.
But choosing number of AI and choosing AI are not allied is very interesting.

When I made my patch to enable this features I modified stratagus network structures in order to add variables. Is there an alternative ?
Have you some documentation about how the network code works ? I'm confused with "ServerSetupState" and "LocalSetupState".

There is another issue in network support : it's impossible (with 2.2.4, I don't try with newer versions) to play with one client on windows and another client on Linux (64 bits, I don't try with 32 bits).

Revision history for this message
Kyran Jackson (erstmap) wrote :

Ah, but what if you don't want to allow people to change teams?

There are two ways I know of to implement AI teams, in the map file and in the AI.

You can see how I've done it with this AI:
http://bazaar.launchpad.net/~erstmap/wargus/gametype-extra/view/head:/scripts/caanoo/caanoo-ai-blueribbon.lua

To make player 2 an enemy of player 1:

SetDiplomacy(1, "enemy", 2)
SetSharedVision(1, false, 2)

To make player 1 a friend of player 2:

SetDiplomacy(2, "allied", 1)
SetSharedVision(2, true, 1)

Revision history for this message
Thaeron (thaeron) wrote :

Hello,
Recently I have been playing wargus again (on my (old) customized version), and decided to try to port my patchs on stratagus / wargus trunks. I saw that race selection is implemented but it doesn't work for me (my patch works fine on multiplayer but breaks solo game).
My question is : how to determine if game is multiplayer or not in lua scripts ?

My plan is to achieve my patchs and submit to your dev team in order you might integrate them in the next release (after cleaning them, I think they are really dirty).

Revision history for this message
Pali (pali) wrote :
Revision history for this message
Thaeron (thaeron) wrote :

Here is my first patch for stratagus and wargus. It allows (in mulitplayer mode) to disable AI Alliance and to set number of AI.

Note : in game.cpp I had to put include of png.h at the beginning for compilation success.

Revision history for this message
Thaeron (thaeron) wrote :

The second part of my first patch (I can only post one file per comment).

Revision history for this message
Pali (pali) wrote :

> Note : in game.cpp I had to put include of png.h at the beginning for compilation success.

Can you paste compile error message? This seems like some stratagus header depends on png.h and this should be fixed in header too.

Revision history for this message
Thaeron (thaeron) wrote :

[ 28%] Building CXX object CMakeFiles/stratagus.dir/src/game/game.cpp.o
In file included from /usr/include/png.h:426:0,
                 from /home/thaeron/inst/tmp/stratagus_ai/src/game/game.cpp:76:
/usr/include/pngconf.h:386:12: erreur: '__pngconf' does not name a type
/usr/include/pngconf.h:387:12: erreur: '__dont__' does not name a type
make[2]: *** [CMakeFiles/stratagus.dir/src/game/game.cpp.o] Erreur 1
make[1]: *** [CMakeFiles/stratagus.dir/all] Erreur

Refers to :
#ifdef PNG_SETJMP_SUPPORTED
# ifndef PNG_SKIP_SETJMP_CHECK
# ifdef __linux__
# ifdef _BSD_SOURCE
# define PNG_SAVE_BSD_SOURCE
# undef _BSD_SOURCE
# endif
# ifdef _SETJMP_H
       /* If you encounter a compiler error here, see the explanation
        * near the end of INSTALL.
        */
           __pngconf.h__ in libpng already includes setjmp.h;
           __dont__ include it again.;
# endif
# endif /* __linux__ */
# endif /* PNG_SKIP_SETJMP_CHECK */

   /* Include setjmp.h for error handling */
# include <setjmp.h>

Revision history for this message
Thaeron (thaeron) wrote :

I removed the following comment (just after #ifdef PNG_SETJMP_SUPPORTED) which is may be useful :
/* This is an attempt to force a single setjmp behaviour on Linux. If
 * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
 *
 * You can bypass this test if you know that your application uses exactly
 * the same setjmp.h that was included when libpng was built. Only define
 * PNG_SKIP_SETJMP_CHECK while building your application, prior to the
 * application's '#include "png.h"'. Don't define PNG_SKIP_SETJMP_CHECK
 * while building a separate libpng library for general use.
 */

Revision history for this message
Joris Dauphin (joris-dauphin) wrote :

1 GameCycle.
According to the code, GameCycle is set to 0 when game start (solo, and multi)

2 AI Team
I would prefer to set directly team instead of a flag for AI (in stratagus)
(and yes playing with a AI may be fun/usefull).

In your patch, I see a bug (you didn't update the size of the packet structure for networking :-/ (Not good code I know :-/ ))

3 png.h
which OS/ gcc version do you use ?
/me wonders where setjmp.h is include

Revision history for this message
Thaeron (thaeron) wrote :

1 GameCycle
Ok

2 AI Team
I really think you are right but it seems to me that is very difficult to implement it (GUI side and code side).
One part of my patch is setting of AI number which is useful in both case (just AI Alliance and AI teams).

2.5 bug
Thank you for spotting the bug. (Patch fixed in attachment)

3 png.h
I use : Linux (slackware) 64bits
gcc version 4.7.1
libpng-1.4.12

Revision history for this message
Thaeron (thaeron) wrote :

I'm trying to extend my modifications to solo mode but I have a "little" issue.
GameSettings.AiAllied is correctly set to 0 in LUA script but in NetworkGamePrepareGameSettings() and CPlayer::Init() it's value is 1. For multi mode I avoid this issue by using ServerSetupState.AiAllied (which value is correct), obviously I can't do it for solo mode.

I don't know where is the problem. I didn't have it with stratagus 2.2.4 and in multi mode (current stratagus sources) GameSettings.Opponents has correct value in NetworkGamePrepareGameSettings().

I think I have made a mistake but where ?

Revision history for this message
Thaeron (thaeron) wrote :

I'm a nut. I forgot to add AiAllied in GameSettings structure in game.pkg so modifications of GameSettings.AiAllied in LUA were not applied in stratagus C++.

Here my third version of patchs with AI Alliance available in multiplayer and singleplayer modes.

Revision history for this message
Thaeron (thaeron) wrote :

Patch for wargus

Revision history for this message
Pali (pali) wrote :

Problem with png.h should be fixed by this commit: https://bazaar.launchpad.net/~stratagus/stratagus/trunk/revision/8563

Revision history for this message
timfelgentreff (timfelgentreff) wrote : Moving to GitHub

This project was moved to https://github.com/Wargus/wargus. All issues were migrated there.

Changed in wargus:
status: New → Won't Fix
Revision history for this message
timfelgentreff (timfelgentreff) wrote :

This project was moved to https://github.com/Wargus/stratagus. All issues were migrated there.

Changed in stratagus:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.