IRC logs for #openttd.dev on OFTC at 2012-10-06
⏴ go to previous day
07:21:41 *** Alberth has joined #openttd.dev
07:21:41 *** ChanServ sets mode: +v Alberth
08:22:29 *** FLHerne has joined #openttd.dev
08:58:22 *** frosch123 has joined #openttd.dev
08:58:22 *** ChanServ sets mode: +v frosch123
09:14:14 *** _Terkhen has joined #openttd.dev
09:14:44 *** Hirundo has joined #openttd.dev
09:38:20 *** Zuu has joined #openttd.dev
09:50:14 *** _Terkhen has joined #openttd.dev
10:49:58 <Zuu> Would it be bad if a game script is allowed to execute DoCommands when the game is paused even if if the game setting to allow commands while paused is set to none?
10:51:01 <Zuu> A different approach would be to give each GS the option to decide if it should be paused or not when the game is paused. Then it is more clear that they need to be careful to not call DoCommands when the game is paused.
10:51:24 <Zuu> In that case we would need to fix so that the DoCommand fail rather than hanging the script.
10:52:27 <frosch123> the latter needs to be done anyway
10:52:47 <frosch123> in multiplayer commands are just dropped if they happen to occur in the same frame as the pause
10:56:17 <Zuu> so there is really no way to keep the problem of having to check all DoCommand return values out of GSs?
10:56:40 <Zuu> Because a patch could happen anywhere in their logic flow.
10:59:01 <Zuu> But I guess, unless we are able to pause the GS and resume it after this frame, we will have this problem.
10:59:32 <frosch123> well, or you need some method to schedule the commands of scripts :)
10:59:41 <frosch123> at least they can only run one command at a time
11:01:15 <Zuu> Ideally this dropped command would be delayed one frame and then executed transparently to the GS. Though, for this effort to be worth, it needs to be allowed to execute DoCommands in pause mode. Otherwise its quite a worthless effort.
11:03:10 <frosch123> well, you could generally ignore pause for commands from scripts
11:03:13 <frosch123> might be easiest actually
11:04:17 <frosch123> that will work for ai and deity commands
11:04:22 <frosch123> but not for companymode commands
11:04:26 <frosch123> for human companies
11:14:37 *** Yexo has joined #openttd.dev
11:14:37 *** ChanServ sets mode: +v Yexo
11:15:50 <frosch123> i like the idea of just ignoring pause on the server for ai and deity commands
11:16:46 <frosch123> maybe it is just easiest to add some server internal command flag to also ignore pause for commands in companymode from gs
11:28:58 <Zuu> From what I can see if IsCommandAllowedWhilePaused is given a new company parameter, it can be made to return true if the company is OWNER_DEITY. In that case, I don't see any other reason why a server would drop a command.
11:29:34 <frosch123> if the gs runs a command in companymode for a human company
11:29:53 <frosch123> you have to mark the commands from a gs in a different way
11:29:59 <frosch123> e.g. using a command flag
11:31:23 <Zuu> Hmm, I guess we don't need to send this over the network, still the most convinent place to have it would probably be in the command packet.
11:31:44 <frosch123> you don't want to send it over the network :)
11:31:49 *** Supercheese has joined #openttd.dev
11:31:54 <frosch123> that would allow to cheat :)
11:32:00 <Zuu> At least as far as I can understand, some places that call IsCommandAllowedWhilePaused do not have _current_company set to the company to execute it.
11:33:23 <Zuu> But maybe CommandPacket is not just sent as a binary blob over the network.
11:34:18 *** Hirundo has joined #openttd.dev
11:34:49 *** Yexo- has joined #openttd.dev
11:35:10 <frosch123> a CMD_FLAGS thingie should be the right thing
11:35:15 *** planetmaker has joined #openttd.dev
11:35:15 *** ChanServ sets mode: +v planetmaker
11:35:21 <frosch123> though currrently i am not sure how clients handle pause mode
11:35:32 <frosch123> i know that the server checks pause for commands
11:35:38 *** Webster has joined #openttd.dev
11:35:38 *** ChanServ sets mode: +v Webster
11:35:46 <frosch123> but i am not sure whether clients execute whatever they get from the server
11:36:18 *** Terkhen has joined #openttd.dev
11:36:18 *** ChanServ sets mode: +v Terkhen
11:38:11 <Zuu> So this flag should be allowed to be sent from server to clients but not the other way around.
11:39:02 <Zuu> Or clients need to execute commands they receive when the game is paused if such commands are received.
11:39:11 <frosch123> no idea whether it is needed for clients
11:39:37 <frosch123> ReceiveCommand drops all CMD_FLAGS_MASK
11:40:43 <frosch123> in a first try i would just put a flag into the CMD_FLAGS_MASK thingie for gs commands, and hope that clients do not check pause at all
12:38:20 <Zuu> I'm sure I've overlooked something important and possible made some bit operations in a non-ideal way.
12:38:43 <Zuu> But first I probably should figure out a good test.
12:40:06 <Zuu> Currently all existing cmd flags are known on complie time, but this one is set by a specific DoCommand caller, so it's not just another flag.
12:40:51 <frosch123> Zuu: be careful with sending it over the network
12:40:57 <frosch123> that will open the doors for cheating
12:41:12 <frosch123> the server should not accept such commands from the network
12:41:15 <Zuu> Yes, currently it doesn't block clients to send the command to servers.
12:41:38 <frosch123> and actually i would expect clients to just execute all commands the server sends
12:41:54 <frosch123> so, sending it might not be needed at all
12:42:20 <frosch123> if CommandFlags don't work
12:42:27 <frosch123> you can also try some DC_ flag
12:46:25 <Zuu> I would assume that clients call CommandQueue::Pop and/or CommandQueue::Peek. Both of these check if the command can be executed while the game is paused.
12:48:25 <Zuu> From what I can see it does.
12:49:19 <Zuu> So either clients must be changed to not check if the command is allowed in pause at all, or this flag has to be sent over the network.
12:55:23 <Zuu> I've updated the patch so that servers should now block out the network flags to protect from cheating. I still suspect that I don't have the whole picture.
12:57:58 <frosch123> CMD_NETWORK_SEND_FLAGS <- maybe define that using the CMD_ constant
12:58:11 <frosch123> i.e. CMD_NETWORK_SEND_FLAGS = CMD_ALLOW_WHEN_PAUSED
12:58:41 <frosch123> also, put a space in front of "?" :)
12:59:07 <Zuu> I did that at one location, but apparently forgot another.
12:59:43 <Zuu> However CMD_ALLOW_WHEN_PAUSED is defined after CMD_NETWORK_SEND_FLAGS, but nothing blocks swaping the define order.
13:00:31 <Zuu> The network_send_flags constant should probably be renamed to include the server->client direction concept.
19:21:14 *** Alberth has left #openttd.dev
21:05:35 *** FLHerne has joined #openttd.dev
22:00:31 *** Cyberworm has joined #openttd.dev
22:00:46 *** Cyberworm has left #openttd.dev
22:39:26 *** mib_uhd59b has joined #openttd.dev
continue to next day ⏵