True to form, I kicked some major ass last night on the afore mentioned replication issue. I am going to take a moment to explain how it works now in order of events. At the end of this post you will see an (few) idea(s) I have for what I want to add to my mutators. My code is, as always, available on my svn.
When a player joins the server they are ushered through a function called NotifyLogin, where I am first given access to their PlayerController. I chose to create and bind the Info_JumpMod object to the player at this point because it appeared to be the most efficient. I wanted the player to be given the proper info as soon as was digitally possible. I do a quick check to confirm that it is a UTPlayerController and then I let it go to the wolves.
In the Info_JumpMod class there is a new ReplicatedEvent block that is notified whenever the Pawn value is set. At this point it hasn’t, but because of how replication works… sending the values as things change on the server or client… I have got the data for setting the pawn’s values and allowing them to jump. I still don’t have the pawn because I have not spawned into the game yet. I have to wait until I get into the game in order to set my values on the pawn, otherwise this is complete.
Back to the mutator. Each mutator has access to a function called ModifyPlayer which is passed each pawn as it is spawned. In here I am controlling the replication, as well as setting the values on the server. The jump variables are not replicated normally, hence having to do this in the first place, but it is compounded by a need for each variable on both sides of the wire. You are in effect unable to jump unless the client and server agree to allow you to do so. I use the iterator ChildActors in order to traverse through all of the Info_JumpMod items that are children, or owned by, the Pawn and I set its pawn variable which triggers the ReplicatedEvent function on the client and sets the appropriate variables. There is of course a bit of an issue here where if these setting variables are not replicated prior to the pawn there will be 0 values applied, but I don’t think its worth the time to do the bit twiddling (since UScript is so unkind to it) to keep track of the variables transmission to the client.
In my testing I found that he variables were sent over the wire long before the pawn was spawned so I don’t think this is ever going to be an issue. If it becomes one I can do the work with an array of Booleans if need be.
Alright so that’s a relief off of my chest.
Got that all worked out and now onto new things.
First and foremost I need to correct an issue with my configuration that has cropped up in the latest version, but that shouldn’t be anything difficult. After this I plan to jump into Exec functions to allow the jump and speed mutators in particular to be tweaked during play.