Does MP replay put objects back onto the map?

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Does MP replay put objects back onto the map?

Post by GottaLove88s »

Pip,

If a mod removes an object (say a wall/hedgerow combination) from an MP map... Is there a way to prevent the replay from putting the removed objects back again?

Example here -> viewtopic.php?f=104&t=41339&p=389480#p389480
SCENARIO LINKS
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
pipfromslitherine
Site Admin
Site Admin
Posts: 9928
Joined: Wed Mar 23, 2005 10:35 pm

Re: Does MP replay put objects back onto the map?

Post by pipfromslitherine »

The replay should put the object back, but the script should (if it is correctly written :) ) remove it again in the same way as it did in the first instance. MP scripting requires a certain compact between the game and the scripter - the guarantee that the script will do the same actions in each turn, so that after the replay you end up in the same state.

I'll take a look at the specific example you reference.

Cheers

Pip
pipfromslitherine
Site Admin
Site Admin
Posts: 9928
Joined: Wed Mar 23, 2005 10:35 pm

Re: Does MP replay put objects back onto the map?

Post by pipfromslitherine »

Further to this: the key thing to remember is, only things which are attached to orders, or to given events (like a tick count) will happen. Anything hooked into the UI, or key presses, etc will not. Also, don't have things happen to only one side :)

Cheers

Pip
Amaris
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 929
Joined: Fri Jul 23, 2010 11:08 am
Location: France
Contact:

Re: Does MP replay put objects back onto the map?

Post by Amaris »

A small additional question on the MP mode: for storing values (as tile coordinates, object, ...) what is best? Use Global? Use Universal? Create a new attribute and use it? Can I use GetTileData()/SetTileData()? Can I use GetObjectData()/SetObjectData()?
“Take care, my friend; watch your six, and do one more roll… just for me.”
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Re: Does MP replay put objects back onto the map?

Post by GottaLove88s »

Would a coder have to do anything clever to keep this backward/forward compatible with Husky as well as 2.0.6?
SCENARIO LINKS
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
pipfromslitherine
Site Admin
Site Admin
Posts: 9928
Joined: Wed Mar 23, 2005 10:35 pm

Re: Does MP replay put objects back onto the map?

Post by pipfromslitherine »

Compatibility between versions shouldn't be an issue. And you can use any of the tile or object functions, so long as you use them consistently in the player turn and in the replay.

Basically you shouldn't be trying to store ANYTHING across turns - it just won't work correctly. The game saves the state of the game at the start of the turn, and then all the orders that are given. It then loads the initial state, and plays out the game, 'giving' the orders at the appropriate time.

If you want to give an order, you cannot rely on data set via the UI - this data will not have been set during the replay. It needs to get all the data from the map, unit, etc. Attribs should be safe (provided, again, they are not set by UI code during the player turn).

Enric did find a bug with Universals where they were being saved wrongly - basically they save the value at whatever point you save your final turn, but this is almost certainly going to be fixed as soon as we can determine it won't break anything official :).

MP logic is pretty confusing - if it's any concilation I hate it as much as I am sure you do by now!

Cheers

Pip
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: Does MP replay put objects back onto the map?

Post by enric »

I use object data across turns, (tile data don't work), I hope it will continue like this, because several actions depend on it:

Remove a tank traps cost, in my scenarios four actions of unit's capable of do this, each unit action on the object is annotate in the object data, an when reached the defined as removing value, the object is removed.

This is the same procedure followed to place a pontoon on the water. After several engineers actions the pontoon is placed.

If not able to keep data across turns we should put, or remove, a tank trap or a pontoon, in a turn, that seems exaggerated.
pipfromslitherine
Site Admin
Site Admin
Posts: 9928
Joined: Wed Mar 23, 2005 10:35 pm

Re: Does MP replay put objects back onto the map?

Post by pipfromslitherine »

Can you tell me which tile data doesn't work (the calls you use) - as it should be saved in the state. I'll get it fixed for the update post Husky.

Cheers

Pip
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: Does MP replay put objects back onto the map?

Post by enric »

Can you tell me which tile data doesn't work (the calls you use) - as it should be saved in the state. I'll get it fixed for the update post Husky.
I do not remember now, I'll look into my posts.
We already talked about this, I think it was when I was trying to place a pontoon on the water (maybe the water tile was the issue).
To place a pontoon I place a new object (invisible) on the water tile on the first action of the engineer, then I put data in the object, next engineer action, looks if there is such object in the tile, a +1 is added at the object data, and so on. Probably, if a did it this way was because tile data was lost across turns.
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: Does MP replay put objects back onto the map?

Post by enric »

I found:
viewtopic.php?f=104&t=39008&hilit=tile

Look at the last post, your task list should be overloaded :D

pipfromslitherine wrote:I'll add it to the task list.

Cheers

Pip
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Re: Does MP replay put objects back onto the map?

Post by GottaLove88s »

enric wrote:
Can you tell me which tile data doesn't work (the calls you use) - as it should be saved in the state. I'll get it fixed for the update post Husky.
I do not remember now, I'll look into my posts.
We already talked about this, I think it was when I was trying to place a pontoon on the water (maybe the water tile was the issue).
To place a pontoon I place a new object (invisible) on the water tile on the first action of the engineer, then I put data in the object, next engineer action, looks if there is such object in the tile, a +1 is added at the object data, and so on. Probably, if a did it this way was because tile data was lost across turns.
Aha, wondered how you did that Enric... Using invisible objects to keep track of multiple stage events is really cunning...!
SCENARIO LINKS
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
pipfromslitherine
Site Admin
Site Admin
Posts: 9928
Joined: Wed Mar 23, 2005 10:35 pm

Re: Does MP replay put objects back onto the map?

Post by pipfromslitherine »

enric wrote:I found:
viewtopic.php?f=104&t=39008&hilit=tile
Look at the last post, your task list should be overloaded :D
pipfromslitherine wrote:I'll add it to the task list.
Cheers
Pip
My task list is an abyss that is quite open about gazing back at me...

;)

Cheers

Pip
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Re: Does MP replay put objects back onto the map?

Post by GottaLove88s »

:roll: :lol:
SCENARIO LINKS
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
Post Reply

Return to “Battle Academy : Modders Corner ”