Synchronized Replay Sessions / Streams

Post here if you want to help developing something for FAF.

Synchronized Replay Sessions / Streams

Postby RoLa » 28 Oct 2013, 18:26

I made a suggestion how to realize this feature.
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.
User avatar
RoLa
Contributor
 
Posts: 313
Joined: 23 Apr 2013, 22:14
Has liked: 5 times
Been liked: 19 times
FAF User Name: RoLa

Re: Synchronized Replay Sessions / Streams

Postby RoLa » 31 Oct 2013, 00:35

I need a bit of help understanding the qt decorations, signal handling. how to fire /add events in Classes / Modules

I have added an item "Replay session" to replay menu in replayitem.py.
I want to call from within my action handler a function from _chatwidget.py or should can i directly connect a function from _chatwidget.py as action handler?

EDIT:
My preferred programming languages are Java for bigger things with GUI and FreeBasic for small console/fullscreen programs. I tried to dig around in the source files. It's like looking for a needle in a haystack. What i would really apreciate is if someone just tell me: look in that file at function ... and in that file at function ...
User avatar
RoLa
Contributor
 
Posts: 313
Joined: 23 Apr 2013, 22:14
Has liked: 5 times
Been liked: 19 times
FAF User Name: RoLa

Re: Synchronized Replay Sessions / Streams

Postby Ze_PilOt » 31 Oct 2013, 09:33

You need to create a new signal (like the ones on top of the client.py class), and emit it (check any handle_xxx in client.py at the end).

Then on the chat widget, you need to connect a function to a signal. Look at any other class, search for
Code: Select all
self.client.<signalName>.connect(self.<function>)
Nossa wrote:I've never played GPG or even heard of FA until FAF started blowing up.
User avatar
Ze_PilOt
Supreme Commander
 
Posts: 8985
Joined: 24 Aug 2011, 18:41
Location: fafland
Has liked: 18 times
Been liked: 376 times
FAF User Name: Ze_PilOt

Re: Synchronized Replay Sessions / Streams

Postby RoLa » 31 Oct 2013, 11:02

Thanks for illuminating me! So is this procedure right?

to client class
Code: Select all
newReplaySession = QtCore.pyqtSignal(str)


to chatwidget
Code: Select all
self.client.newReplaySession.connect(self.openReplayChat)

Code: Select all
@QtCore.pyqtSlot(str)
def openReplayChat(self, uid)
        ...


and to replayitem
Code: Select all
def pressed(self, item):
        ...
        actionReplaySession = QtGui.QAction("Replay Session", menu)
        actionReplaySession.triggered.connect(self.startReplaySession)
        menu.addAction(actionReplaySession)
        ...

def startReplaySession(self,uid):
        self.parent.client.newReplaySession.emit(uid)
User avatar
RoLa
Contributor
 
Posts: 313
Joined: 23 Apr 2013, 22:14
Has liked: 5 times
Been liked: 19 times
FAF User Name: RoLa

Re: Synchronized Replay Sessions / Streams

Postby Ze_PilOt » 31 Oct 2013, 11:19

Yeps.
Nossa wrote:I've never played GPG or even heard of FA until FAF started blowing up.
User avatar
Ze_PilOt
Supreme Commander
 
Posts: 8985
Joined: 24 Aug 2011, 18:41
Location: fafland
Has liked: 18 times
Been liked: 376 times
FAF User Name: Ze_PilOt

Re: Synchronized Replay Sessions / Streams

Postby Nombringer » 31 Oct 2013, 20:58

If you manage to do this I will give you a big sloppy kiss...
BC_Blackheart: i just copy his shit and do it 5% better leads to easy win usually xD

Need help? Are you a new player? Feel free to message me any time in the lobby :) Lessons may cost a portoin of your soul.... (Noms are included but not guaranteed)
Nombringer
Supreme Commander
 
Posts: 1036
Joined: 16 Nov 2012, 06:31
Has liked: 210 times
Been liked: 65 times
FAF User Name: Nombringer

Re: Synchronized Replay Sessions / Streams

Postby RoLa » 31 Oct 2013, 21:52

Nombringer wrote:If you manage to do this I will give you a big sloppy kiss...
:o :shock: :? :oops:

Can i install the server part for develpment on a local machine? Or how can i test my modifications without connecting every time to the server?
Last edited by RoLa on 31 Oct 2013, 22:08, edited 3 times in total.
User avatar
RoLa
Contributor
 
Posts: 313
Joined: 23 Apr 2013, 22:14
Has liked: 5 times
Been liked: 19 times
FAF User Name: RoLa

Re: Synchronized Replay Sessions / Streams

Postby RoLa » 31 Oct 2013, 23:01

I made some very basic steps to start a replay session:
https://bitbucket.org/rola/modular-clie ... bd8bad5982

In the next step i will try to add the invitation for replay and team chats. I would suggest to have some options to enable/disable auto accept invitations.
Menu->Chat->Accept Invitiations
->None
->From Friends
->Not Foe
->All

You should be able to right click on a chatter in any chat room to invite him in any of your other open chatrooms. Of course all standard chat rooms should be excluded from the invitation list. Perhaps we should limitate these channels per user to "#team-nickname" for team/clan game preperation and "#replay-nickname" for replay sessions. These team/replay/game channels could be also used in conjunction with mumble. What do you think?
User avatar
RoLa
Contributor
 
Posts: 313
Joined: 23 Apr 2013, 22:14
Has liked: 5 times
Been liked: 19 times
FAF User Name: RoLa

Synchronized Replay Sessions: How to get UID

Postby RoLa » 03 Nov 2013, 11:23

How can I get an UID for the mod?
User avatar
RoLa
Contributor
 
Posts: 313
Joined: 23 Apr 2013, 22:14
Has liked: 5 times
Been liked: 19 times
FAF User Name: RoLa


Return to Contributors

Who is online

Users browsing this forum: No registered users and 1 guest