viewtopic.php?f=2&t=5597&start=10
First part is a mod which writes to the replay log file the current gametime in seconds, and reads from a lua file the gametimes from the other players. If another player falls too far behind(2-3 seconds) the game will be paused and resumed again later.
The basic operations in lua mod:
- Code: Select all
local lasttimer = GetGameTimeSeconds()
function MyBeat()
if SessionIsReplay() then
if (GetGameTimeSeconds()-lasttimer) > 5.0 then
lasttimer = GetGameTimeSeconds()
local playertimes = import('/mods/MyMod/modules/playertimes.lua').Playertimes
LOG("MyBeat: " .. GetGameTimeSeconds())
LOG( playertimes )
--SessionRequestPause()
--SessionResume()
end
end
end
The second part should be integrated in to the lobby. I looked at the IRC chat channel code and i think it should be realized with a chat room, like the "post-game channel". So anyone should be allowed to create exactly one replay session room. In the context menu of the replay vault, there could be added the function "create replay session". The replay will be downloaded but not started and the replay room is created as "#replay-playername-replayuid" . Now you can invite other users ( context menu of users in chat). They get a popup where they can accept invitation(there should be an option "ready for replay session" which is disabled by default). After accepting, the replay is downloaded and the chat room is opened. While / after users joined your replay channel they can chat normally. The session creator can start the replay by typing "START". The replay is started on everyones computer. The mod pauses all replays at the beginning and writes a status message. After all participants have loaded their replay, the lobby writes resume command which will be read by all. The lobby is reading the gametime written by mod from replay.log and writes the time to the chat channel. At the same time lobby is reading messages from channel and writing them to lua script file which will be read by mod.
Where can i insert the context menu items. And can i create a new channel and invite others only based on modifications of the lobby. Or is there a modification on server needed? I looked at "def processGameExit(self):" in _chatwidget.py Perhaps someone can give me some hints on python code.