Currently Online

Latest Posts

Topic: play as another player in singleplayer

Tibor
Joined: 2009-03-23, 23:24
Posts: 1209
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-07-23, 20:46

Hi,

I wonder, is it possible to load singleplayer saved game as another player? I mean I played as blue, but I want to load game and go on as red.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 2809
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-07-24, 11:53

Since the game immediately loads after the savegame is selected, no, you can't.


Busy indexing nil values

Top Quote
stdh
Avatar
Joined: 2013-08-04, 22:05
Posts: 36
Ranking
Pry about Widelands
Posted at: 2016-09-03, 23:48

A late reply, but I have a question as well:

In build 18 (and before) I used to do this by starting a multiplayer game from the latest saved game, then I could take another player's spot. But this seems to no longer work, single- and multi-player savegames appear to be segregated. Is this a feature or a bug ? face-wink.png


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 2809
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-09-04, 09:02

We segregated them on purpose in order to unclutter the savegame list. If you plan to switch players later, you will have to use multiplayer mode when you create the game.


Busy indexing nil values

Top Quote
stdh
Avatar
Joined: 2013-08-04, 22:05
Posts: 36
Ranking
Pry about Widelands
Posted at: 2016-10-04, 22:50

For the record: it is actually possible to change a single player game to multiplayer, but it requires some digging.

You can unzip the .wgf file, and you'll find in the folder a file named 'preload'. This is a text file, at the bottom of which is the line 'gametype="1"'. Change the number to 3, save and zip again (take care of the extension), and you'll be able to load this game in multiplayer mode.

Making the AI take your place controlling the side you previously played has been described as 'fragile', and I uncovered two crashes doing so. But those have been fixed, and I think it works well enough.

I don't know what happens if you set the gametype to 2...


Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 1209
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-10-04, 23:34

Thanks stdh, For now I managed to live without this, but I will remember about this post for a case I will need it in future...


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 2809
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-10-05, 07:06

Game types are:

    enum class GameType : uint8_t {
        SINGLEPLAYER = 1,  // we don't want SINGLEPLAYER just because a value is empty
        NETCLIENT,
        NETHOST,
        REPLAY
    };

Busy indexing nil values

Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 1209
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-10-28, 09:05

stdh wrote:

For the record: it is actually possible to change a single player game to multiplayer, but it requires some digging.

You can unzip the .wgf file, and you'll find in the folder a file named 'preload'. This is a text file, at the bottom of which is the line 'gametype="1"'. Change the number to 3, save and zip again (take care of the extension), and you'll be able to load this game in multiplayer mode.

Making the AI take your place controlling the side you previously played has been described as 'fragile', and I uncovered two crashes doing so. But those have been fixed, and I think it works well enough.

I don't know what happens if you set the gametype to 2...

Well, I just unpacked one savegame and gametype is allready 3 and still it is loaded as a blue position as human.

One more clarification - game was initialized as AI-only game so there is no "overtaking human player by AI"


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 2809
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-10-28, 09:28

The preload packet also has

player_nr="1"
player_amount="1"

You could have a look at what those do.


Busy indexing nil values

Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 1209
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-10-28, 12:57

Well, I modified this:

player_nr=

But widelands does not even start:

Game not loaded: Game data error: no map

Anyway, I am afraid that it would not work anyway - I looked into code a bit


Top Quote