May I request a feature for 1.13 or 1.14?

Discussion of all aspects of the game engine, including development of new and existing features.

Moderators: Forum Moderators, Developers

May I request a feature for 1.13 or 1.14?

Postby enclave » May 12th, 2017, 9:22 pm

I'm coding an era and some mods from time to time.. And I'm not sure what the current situation is, because i'm not familiar with many 1.13 features as I am currently on 1.12 where all the players are.. Sorry if I ask for something that already exists..

Could you make possible to fire unsynced event? for example..
Code: Select all
[event]
   name=my_custom_event
   first_time_only=no
   synchronized=no
...
[/event]


It is needed if you would like to add some graphics only visible to current player.. for example paint all hexes where you are allowed to build new village into green color.. Currently you can do it with [item] which is much slower than lua similar thing wesnoth.add_tile_overlay, but your allies also see it, which may not be wanted at all. Plus it could be used for other all kind of content.
Again, currently I possibly could call for unsynced event like so (untested):
Spoiler:

This would show red hex only for current player in coordinates (5,5). The example is very basic for simplicity of explanation..
It's too complicated.. if it even works at all. I think what I ask could be really useful.. Obviously a single red hex on some coordinate would be nearly useless, but just think what else could be done and visible only to current player.
Thanks for your time.
enclave
 
Posts: 469
Joined: December 15th, 2007, 8:52 am

Re: May I request a feature for 1.13 or 1.14?

Postby gfgtdf » May 12th, 2017, 10:54 pm

I am unusre whether you understand what unsynced means. Unsynced that this is code is not garenteed to run on all clients. The game always tries to know whetehr the current code is unsynced and tries to pervent certain actions that'd result in inndiate OOS. Note the 'not garenteed' part, so while select events are unsynced it is of course possible that all players randomly happen to click at the same unit at the same time so that the select even is executed on all clients.

If you want an action to only be executed on the currently plaing side you should do (1.13 code)
Code: Select all
if wesnoth.sides[wesnoth.current.side].is_local == true then
     ... your code
end

the check will only evaluate to true on the client that controlls the currenty playing side. Of course then changing the gamestate inside that inner code is dangerous, in order to help the game engine noticing that this code is intentionally onyl executed on one client you shodul wrap it in a [unsynced] tag. But note that [unsynced] alone will not make the code run only one clients, its just a hint to the game engine that the code thats inside it should not change the gamestate if possible.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
gfgtdf
Developer
 
Posts: 842
Joined: February 10th, 2013, 2:25 pm

Re: May I request a feature for 1.13 or 1.14?

Postby enclave » May 12th, 2017, 11:05 pm

Code: Select all
if wesnoth.sides[wesnoth.current.side].is_local == true then
     ... your code
end
is it working on 1.12 also? or only available from 1.13? Thanks very much.

I don't know too much about unsynced events, but only what I used in my codes.. and when I select unit with [select_unit] fire_event=yes.. it executes select event which seems to be unsynced because I never could see the graphics executed in that select event.. unless wesnoth.add_tile_overlay is visible only to current side playing.. which you explained me that is visible to everyone if event is synchronized. As observer I was able to perform select and see the graphics, but only for current playing side and it was never a problem for me. Without clicking and selecting observer could not see the graphics either, only the current playing side..
enclave
 
Posts: 469
Joined: December 15th, 2007, 8:52 am

Re: May I request a feature for 1.13 or 1.14?

Postby gfgtdf » May 12th, 2017, 11:23 pm

enclave wrote:
Code: Select all
if wesnoth.sides[wesnoth.current.side].is_local == true then
     ... your code
end
is it working on 1.12 also? or only available from 1.13? Thanks very much.


in 1.12 it's probably
Code: Select all
if wesnoth.sides[wesnoth.current.side].controller == "human" then
     ... your code
end

enclave wrote:

I don't know too much about unsynced events, but only what I used in my codes.. and when I select unit with [select_unit] fire_event=yes.. it executes select event which seems to be unsynced because I never could see the graphics executed in that select event.. unless wesnoth.add_tile_overlay is visible only to current side playing.. which you explained me that is visible to everyone if event is synchronized. As observer I was able to perform select and see the graphics, but only for current playing side and it was never a problem for me. Without clicking and selecting observer could not see the graphics either, only the current playing side..


hmm completeley forgot this one when i wrote my foirst post. This is probably becasue you can maybe only 'select' your own units so [select_unit] simply won't work one units that you don't controll? not really sure though.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
gfgtdf
Developer
 
Posts: 842
Joined: February 10th, 2013, 2:25 pm

Re: May I request a feature for 1.13 or 1.14?

Postby Pentarctagon » May 13th, 2017, 12:19 am

Also, while not exactly what you were asking about, [set_menu_item] has a built in "synced" attribute is 1.13.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Pentarctagon
Forum Administrator
 
Posts: 2783
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: May I request a feature for 1.13 or 1.14?

Postby enclave » May 13th, 2017, 5:39 pm

Pentarctagon wrote:Also, while not exactly what you were asking about, [set_menu_item] has a built in "synced" attribute is 1.13.


Oh, that's a great one! This is nearly what I was asking for.. Or it could be very closely used the way i meant in this topic..
Still custom unsynced event would probably be easier for a developer (not for you guys who is making this possible) or would be a nice addition. But if there is a set_menu_item with "synced" attribute it could serve the purpose very well.. and do the trick, without a real need of unsynced event.. while unsynced event could be a nice addition, but not a requirement.

gfgtdf, I just realized what you wrote to me.. and I don't think it is the way you mean.. or maybe we misunderstood each other..
Code: Select all
if wesnoth.sides[wesnoth.current.side].is_local == true then
     ... your code
end
If you want an action to only be executed on the currently plaing side you should do (1.13 code)
To the best of my understanding.. and actually it's again what you told me before.. anything you do will be visible to others if it happens in synced event.. and invisible if it happens in unsynced event (for example select event). So if I draw an item in select event then only me (and not even observer) will be able to see the item (while it will be visible to everyone, if it happened from synced event, like moveto.. or any other).. so I don't think that your code above has any influence on visibility of the item.. or has it?
enclave
 
Posts: 469
Joined: December 15th, 2007, 8:52 am


Return to Coder’s Corner

Who is online

Users browsing this forum: No registered users and 1 guest