Rex's plugins for Construct2
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About

rex_MPsyncfunction

Plugin, ACE table, Discussion thread
Dependence: rex_MPwrap plugin

Introduction
Trigger "On function" for each peer like using function object. Actually, the interface of function is referenced to rex_function2 plugin.
This is an advance plugin, user still need to know how to use the official multi-player plugin first.

Usage
Sample capx
Call function
Like rex_function2 plugin, this plugin also has 2 kinds of interface of function call. One is using parameter list, the other is using parameter table.
Parameter list
Call "Action:Call function" in "Parameter list" category to assign parameters in a list, like official function object.
Parameter table
Call "Action:Set parameter" to assign value with a string or number index for each parameter. Then call "Action:Call function" in "Parameter table" category, like rex_function2 object.

On function
After call a function, the "Condition:On function" will be triggered for each peer. There are 2 modes to trigger this condition, "Immediate", "Sendback".
  • Immediate : trigger "Condition:On function" immediate. It has no delay of responding, but the execution order of each peer might not be the same.
  • Sendback : trigger "Condition:On function" while the package sent from host. The execution order will be the same for each peer, but it has a network delay.
"Immediate" mode might be enough for turn-based game.
The alias of sender could be got by "Expression:SenderAlias" under "Condition:On function".
Declare parameters
User need to declare parameters if using parameter table by call "Action:Declare parameter". See the document of rex_function2 for more detail.
Parameter indexes
  • The parameters could be got by number index 0,1,2,... in parameter list mode.
  • The parameters could be got by string or number index in parameter table mode. Remember to declare parameters if using string index.
Call official function object or rex_function2 object
This plugin will also trigger
"Condition:On function" of official function object or rex_function2 object, after trigger "Condition:On function" of this plugin, with the same function name and parameters.
User could develop game without multi-player supported (i.e. standalone) by using official function object or rex_function2 object, then replaces "Action:Call function" of official function object or rex_function2 object to this plugin's.

Pending mode
Command need to be executed at right time. Consider this case at below figure
图片
It might cause an error that peer B receives command and run it before "Process stage" finished. This command should be executed during "Input stage". So that this command need to be pending until "input stage" shown at blow figure.
图片
To use blocking mode to pending command, set "Blocking mode" to "Yes" in properties table. The received command will be pended until call "Action:Accept" in "Pending" category.
When
call "Action:Accept" -
  • Pop and run a command if there has any pending command already
  • Run a command when received, then pending others
"Action:Close" could close the acceptance. "Action:Discard&Close" could discard pending commands and close the acceptance.
Ignored list
Call "Action:Add" in "Pending - ignored list" category to exclude blocked commands by function name. For example, chat command might be run at all times, it could be add to ignored list to run it directly without any checking.
"Action:Remove" in "Pending - ignored list" category could remove this function from ignored list.

Trace the execution of commands
"Condition:On any function" will be triggered by all executed commands. Trace the execution of these commands by "Expression:FunctionName", and "Expression:FunctionParams" at "action:Log" of official browser object.
Create a free web site with Weebly
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About