Scenarios for online gamesI do not know if this is possible, but it would be good to use scenaros for change the rules of game in online mode.I would like to make this a scenario: http://forum.simutrans.com/index.php?topic=9898.msg93647#msg93647 (http://forum.simutrans.com/index.php?topic=9898.msg93647#msg93647)
Upedate:
Scenario: regions-v4.3.zip (http://www.mediafire.com/download/w1r0bzuzccuc1cc/regions-v4.3.zip) (Using r7880.)
The changes are:
- Shared regions is now easier, you only need to place a label text to share region, the coordinates are obtained using remover tool.
- Now the region is shared in the info is displayed.
Test In: Rive's Server http://forum.simutrans.com/index.php?topic=14806.msg146173#msg146173 (http://forum.simutrans.com/index.php?topic=14806.msg146173#msg146173)
(https://www.mediafire.com/convkey/4125/ysx5rr8qhzhgzc66g.jpg)
There is a patch for AI players. I am not sure if the API is more restricted for such scripts. But if not, just attach an AI to a player (maybe even player one) could achieve this too.
Your idea is certainly possible with scripting, also for online games. Needs some work, though.
-----
Here is a script that can be used for online games:
https://github.com/Dwachs/simutrans-scenarios/tree/master/pak/scenario/achieve
Each player earns point for certain activities / achievements. I do not know, whether it still works.
Somehow these scripts need to be downloaded with the savegame to each player, or do we have this already?
No, this script solely runs at the server. No need for downloads to clients.
But how do you forbid to built something on the client (like those borders)? The action will work on the client, the server forbid it, desync? In that case the script would need to god with the savegame, or?
This is entirely possible without desyncs. One can restrict way building by specifying regions that are forbidden for certain players: These regions are broadcasted to the clients, and the client wills will respect these regions in the way building pathfinder.
The api commands that control these regions are here
http://dwachs.github.io/simutrans-sqapi-doc/classrules.html
I think it would be good to create a test server for this, do not you think ?. ;)
Quote from: Dwachs on May 11, 2016, 06:19:43 AM
This is entirely possible without desyncs. One can restrict way building by specifying regions that are forbidden for certain players: These regions are broadcasted to the clients, and the client wills will respect these regions in the way building pathfinder.
The api commands that control these regions are here
http://dwachs.github.io/simutrans-sqapi-doc/classrules.html (http://dwachs.github.io/simutrans-sqapi-doc/classrules.html)
For some reason the function "rules.for id_way_tool_rect" does not work in your scenario. ???
Edit
Increase in the number of player (player_nr) is not working as it should. ???
I need to exclude a player but somehow adds it all.
yona_cuadro <- [
{x=179, y=108},
{x=191, y=100},
]
tools <- [tool_build_bridge, tool_build_tunnel, tool_raise_land, tool_setslope, tool_remover ]
error <- "Esta region pertenece a otro jugador "
function forbid_tools()
{
for(local j=0; j<tools.len(); j++) {
for(local i=0; i<yona_cuadro.len()-1; i++) {
local player=0
for(local p=0; p<16; p++) {
if (p != player) rules.forbid_way_tool_rect(p, tools[j], wt_all, yona_cuadro[i], yona_cuadro[i+1], ttext(error + player_x(player).get_name()))
}
}
}
}
What do you want to achieve with this code? As it is written, it should forbid the region for all players except player 0 (the first player).
What I want to achieve is that the area is accessible only to a player, but this is not fulfilled with my code. ???
the other is that "rules.forbid_way_tool_rect" seems to be incompatible with its Scenario online games.
Remember that my goal is to make a map divided into regions. ;)
Please upload the complete script file.
I could already solve, I had exceeded the number of players that was the whole problem. ;)
I created a list of coordinates to the respective rectangles, but does not work correctly in server mode.
I would also like to draw lines at the edges of the rectacgulos to indicate the boundaries of each region, that would be very nice.
To test a map of 512x512 is needed.
Quote from: Yona-TYT on May 31, 2016, 02:28:46 AM
I could already solve, I had exceeded the number of players that was the whole problem. ;)
Player index is from 0 to 14, 1 is public player. Number 15 has special meanings: it means ownerless stuff, or for to forbid tools can be used to mean 'all players'.
Quote
I created a list of coordinates to the respective rectangles, but does not work correctly in server mode.
What does not work?
Drawing something is not implemented. You could place text markers at the corners of the rectangle.
QuoteWhat does not work?
In a local game works fine, but when it comes to a client in online mode, the link sends it to another party ... how can I correct this?
(https://www.mediafire.com/convkey/03c7/qv8v4ememo5u5wq6g.jpg)
QuoteDrawing something is not implemented. You could place text markers at the corners of the rectangle.
It can be done automatically, as?
There should be no difference when viewing these texts on client and servers (only maybe some time delay).
Quote from: Dwachs on May 31, 2016, 12:50:59 PM
There should be no difference when viewing these texts on client and servers (only maybe some time delay).
Resolved, thanks.
now I need to know how to restrict the use of tools climatica edition.
This almost completed ... Still are lacking restrict the use of editing tools climate and mark the limits of the regions (would be good to see this on the mini map).
In my tests I found some errore in the script when players are activated.
Quote from: Yona-TYT on June 02, 2016, 09:06:26 AM
Still are lacking restrict the use of editing tools climate
In r7805 there will be new constants tool_change_water_height, tool_set_climate to catch this.
Quote from: Dwachs on June 02, 2016, 12:15:03 PM
In r7805 there will be new constants tool_change_water_height, tool_set_climate to catch this.
thanks. ;D
Something like this: minimap_rect(coord, coord, name)(https://www.mediafire.com/convkey/7ae6/2074ompjaml74ez6g.jpg)
One of the problems that exist in the online games are public stations, because they can be created but not deleted. We need a function that allows to eliminate the public service stations.
And because the map is divided in regions, public stations are much needed here.
(https://www.mediafire.com/convkey/4fe5/jd9cx2g5loa8gko6g.jpg)
The script is taking too long to load, using the latest revisions. ???
(https://www.mediafire.com/convkey/47b3/ncd5mper4d65wct6g.jpg)
There were some changes to the scripting engine recently. I am guessing one of them broke it.
Could you please upload the recent version of your script? Attachments are broken currently.
Edit: please try with r7853
Quote from: Dwachs on July 17, 2016, 03:40:08 PM
Could you please upload the recent version of your script? Attachments are broken currently.
Edit: please try with r7853
Works fine ... thanks !!
This error occurs when active new players.
(http://www.mediafire.com/convkey/40ec/sc5hq64i1ky834h6g.jpg)
This is a bug in the script you copied from my scenario. It should work if you replace (lines 472++)
local player = player_x(pl)
if (pl != 1 && player.is_active()) {
st.append( clone active_players[pl] )
}
by
if (pl != 1 && active_players[pl]) {
st.append( clone active_players[pl] )
}
@Dwachs
is there a way to get size of the map? ???
not yet, unfortunately.
@Dwachs
A small detail, I would like to see the scenario information window after loading the server. It does not seem to be somewhat difficult to implement.
isn't this show at menu -> scenario info? or are you looking for the debug information?
Quote from: River on August 28, 2016, 12:51:24 AM
isn't this show at menu -> scenario info? or are you looking for the debug information?
I mean automatically display the info window when you load the game. Like when a scenario is loaded locally, the first thing that appears is the info window.
you could call gui.open_info_window() in resume_game. Does this work?
Quote from: Dwachs on August 28, 2016, 02:54:52 PM
you could call gui.open_info_window() in resume_game. Does this work?
Not on the servers I'm afraid.
By the way, "gui.open_info_win ()" always shows the "Progress" tab, I would like to choose the tab to show.
@Dwachs
Something is restricting the tool "found a new city" for the players but I can not find the cause ... maybe an error ?.
regions2-pak64-1024x1024v3.0_.zip (http://www.mediafire.com/download/n9ccakd5k4m4567/regions2-pak64-1024x1024v3.0_.zip)
Quote from: Yona-TYT on August 23, 2016, 02:53:50 PM
@Dwachs
is there a way to get size of the map? ???
yes, from r7863 on: world.get_size()
Quote from: Yona-TYT on September 11, 2016, 04:11:02 PM
@Dwachs
Something is restricting the tool "found a new city" for the players but I can not find the cause ... maybe an error ?.
regions2-pak64-1024x1024v3.0_.zip (http://www.mediafire.com/download/n9ccakd5k4m4567/regions2-pak64-1024x1024v3.0_.zip)
Please report each new issue in its own thread from now on. It is really hard to follow all that different bug reports and extension requests.
Quote from: Dwachs on September 11, 2016, 04:13:40 PM
yes, from r7863 on: world.get_size()
Thank you !.
Quote from: Dwachs on September 11, 2016, 04:15:25 PM
Please report each new issue in its own thread from now on. It is really hard to follow all that different bug reports and extension requests.
OK I understand .
Quote from: Yona-TYT on September 11, 2016, 04:11:02 PM
@Dwachs
Something is restricting the tool "found a new city" for the players but I can not find the cause ... maybe an error ?.
regions2-pak64-1024x1024v3.0_.zip (http://www.mediafire.com/download/n9ccakd5k4m4567/regions2-pak64-1024x1024v3.0_.zip)
This is the default implementation of is_tool_allowed in script/scenario_base.nut. You have to implement this function yourself to overwrite the default behavior.
Resolved, thanks. ;D
Upedate:
Scenario: regions-v4.0.zip (http://www.mediafire.com/download/48njvuq3wvuvbr1/regions-v4.0.zip)
The changes are:
- You can configure regions using the public service
- Delete stations is now easier to use, only you need remover tool.
- It's not possible to remove oil platforms. XD
Test In: Rive's Server http://forum.simutrans.com/index.php?topic=14806.msg146173#msg146173 (http://forum.simutrans.com/index.php?topic=14806.msg146173#msg146173)
(https://www.mediafire.com/convkey/f2ed/hfdqm75m6vgbob96g.jpg)
Upedate:
Scenario: regions-v4.3.zip (http://www.mediafire.com/download/w1r0bzuzccuc1cc/regions-v4.3.zip) (Using r7880.)
It is recommended to use r7880 for this: http://forum.simutrans.com/index.php?topic=15748.msg154484#msg154484 (http://forum.simutrans.com/index.php?topic=15748.msg154484#msg154484) ;)
The changes are:
- Shared regions is now easier, you only need to place a label text to share region, the coordinates are obtained using remover tool.
- Now the region is shared in the info is displayed.
Test In: Rive's Server http://forum.simutrans.com/index.php?topic=14806.msg146173#msg146173 (http://forum.simutrans.com/index.php?topic=14806.msg146173#msg146173)
(https://www.mediafire.com/convkey/4125/ysx5rr8qhzhgzc66g.jpg)
@River, I will add connections rails and powerlines (it works now), what do you think this ?.
(https://www.mediafire.com/convkey/cd0e/nf36v94s7wo9gd26g.jpg)
all it does is remove the requirement to share the end of your lines. its a nice added thing but not very important if you ask me.
It would be nice explains this with pictures, but the patch still not incorporated...http://forum.simutrans.com/index.php?topic=15049.0
Though not if work in online mode. ???
@Dwachs
River encountered an error from your server: http://forum.simutrans.com/index.php?topic=14806.msg155358#msg155358
Scenario: regions-4.7-test.zip (http://www.mediafire.com/file/ajr5ngavd1lbbav/regions-4.7-test.zip)
It seems that something broke in one of the last nights, now this error:
(https://www.mediafire.com/convkey/6db9/ot66eu7bhhwqqk26g.jpg)
It does not seem to be a problem with the script. ???
I fixed it in my script:
https://github.com/Dwachs/simutrans-scenarios/blob/master/pak/scenario/achieve/scenario.nut
It was there from the beginning. There were no recent changes that could have triggered the error. Just bad luck :)
It is strange that this has never been seen. :o
Thank you so much. :thumbsup: