Jump to content

[SOLVED] Syncker Script


photo

Recommended Posts

It would be useful to slave and master scripts for the syncher samples...

 

Can I clarify a few things.

The slave runs first?

The master_address is the ip address of the master machine?

how do I know when the slave has picked up the master?

 

Thanks

Link to comment

Hi,

 

The slave runs first?

Yes, usually slaves are run first and wait for the master to start broadcasting messages so that they connect to it.

But you can also run a master and then slaves. The only thing in such order is that you need to restart a master script (for example, reload the editor, in case you specified a master script as an editor one, or reload the editor plugin) after all slaves are launched.

 

The master_address is the ip address of the master machine?

No, master_address specifies a broadcast address in your network (e.g. if all your computers is located in network 192.168.0.xxx, broadcast address will be 192.168.0.255). After specifying a master broadcast address via master_address command, reload the script or reload the world for changes to take effect.

 

how do I know when the slave has picked up the master?

 

You can see the following notification in the console on the master computer:

 

Connection from 192.168.0.64 "slave_name" accepted

This message indicates that a slave has successfully connected to a master.

 

I've attached launchers for Syncker slaves. You just need need to:

  1. Unpack them into <SDK>/your_folder_name and run.
  2. After the engine is loaded, type editor_reload in the console.

To run Syncker master, simply run from the SDK browser (High-Level Systems -> Syncker) after all the slaves are launched. Don't forget to change master_address variable and that's all!

 

More information about syncker you can find in our documenation: https://developer.un...nigine_syncker/

syncker_slave_scripts.zip

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Thankyou very much... That helps

More questions/observations

1) there doesn't seem to be any master_ or slave_ commands available from the demo so setting up a grid doesn't seem possible.

2) running this setup makes accesing the internet impossible, is that normal?

3) can you mix 32 bit and 64 bit clients? (this might have been where I came unstuck before?)

Link to comment
there doesn't seem to be any master_ or slave_ commands available from the demo so setting up a grid doesn't seem possible

In this case, load a Syncker master script as the editor plugin first. Follow these steps:

  1. Run Demo Browser.
  2. Choose any sample (e.g. Cool Materials Library).
  3. Type in console editor_load.
  4. Press T.
  5. On the Plugins tab select Add to add the editor plugin.
  6. Choose data/core/systems/syncker/syncker_master.cpp.
  7. Press Reload.

After this you can type master_* and slave_* console commands.

 

 

running this setup makes accesing the internet impossible, is that normal?

Yes, Syncker can cause packets loss in your LAN, and in the result you can't access the internet.

 

can you mix 32 bit and 64 bit clients?

Yes, there's absolutely no problem with this.

 

I hope this helps.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
  • 1 year later...

Hi,
 
i am evaluating the Unigine Engine and i do not understand how to use the syncker, even after reading the documentation.
I think i need some basic informations.
 
I have created a new project. i have added a collada mesh in it using the editor. Nothing else.
I have made a copy of this project in an another folder in order to have the same project for slave and master.
 
In the slave project. i have modifier my project.cpp:
 

#include <core/unigine.h>
#include <core/systems/syncker/syncker_master.h>

int init() {
	PlayerSpectator camera = new PlayerSpectator();
	camera.setPosition(Vec3(2.0f,0.0f,1.5f));
	camera.setDirection(Vec3(-1.0f,0.0f,-0.5f));
	engine.game.setPlayer(camera);
	
	// Set a fixed FPS value to make simulations consistent across all computers.
	engine.game.setFTime(1.0f / 60.0f);
	
	return 1;
}

int shutdown() {
	return 1;
}

int update() {
	return 1;
}

I launched the slave project using this .bat:

 

@echo off
setlocal EnableDelayedExpansion

IF %processor_architecture% == AMD64 (
	SET arch=x64
	if not exist bin\main_!arch!.exe (
		SET arch=x86
	) else (
		SET PATH=x64;!PATH!;
	)
) else (
	SET arch=x86
)

start bin\main_%arch%.exe -video_app opengl -video_fullscreen 0 -video_multisample 0 -video_mode -1 -video_height 900 -video_width 1200 -sound_app auto -data_path "../" -system_script "MyProject/unigine.cpp" -engine_config "../data/MyProject/unigine.cfg" -engine_log "../MyProject_log.htm" -editor_script core/systems/syncker/syncker_slave.cpp -console_command "render_anisotropy 0 && world_load  MyProject/MyProject" -extern_define ",QUALITY_HIGH" -extern_plugin ",Collada,Interface" -extern_define "SYNCKER_SLAVE"

In the master project. i have modifier my project.cpp:

#include <core/unigine.h>
#include <core/systems/syncker/syncker_master.h>

int init() {
	PlayerSpectator camera = new PlayerSpectator();
	camera.setPosition(Vec3(2.0f,0.0f,1.5f));
	camera.setDirection(Vec3(-1.0f,0.0f,-0.5f));
	engine.game.setPlayer(camera);
	
	// Set a fixed FPS value to make simulations consistent across all computers.
	engine.game.setFTime(1.0f / 60.0f);
	
	// Initialize Syncker using a given broadcast address.
	Unigine::Syncker::Master::init("192.168.0.255");

	int index = engine.editor.findNode("FalconGreg");
	if(index != -1) {
		Node falconNode = engine.editor.getNode(index);
		Unigine::Syncker::Master::syncNode(falconNode);
	}	
	
	
	return 1;
}

int shutdown() {
	// Run a console command on all slave applications, if necessary.
	// The command being called is run from a system script of slaves.
	Unigine::Syncker::Master::systemCall("engine.console.run",("world_quit"));
	
	// Shut down Syncker.
	Unigine::Syncker::Master::shutdown();

	return 1;
}

int update() {

// Synchronize frame information.
	Unigine::Syncker::Master::syncFrame();
	
	// Synchronize player position.
	Unigine::Syncker::Master::syncPlayer();
	
	// Synchronize render parameters.
	Unigine::Syncker::Master::syncRender();
	
	// Synchronize nodes.
	Unigine::Syncker::Master::syncNodes(meshes);

	
	return 1;
}

 
I launched the master project using this .bat:
 

@echo off
setlocal EnableDelayedExpansion

IF %processor_architecture% == AMD64 (
	SET arch=x64
	if not exist bin\main_!arch!.exe (
		SET arch=x86
	) else (
		SET PATH=x64;!PATH!;
	)
) else (
	SET arch=x86
)

start bin\main_%arch%.exe -video_app opengl -video_fullscreen 0 -video_multisample 0 -video_mode -1 -video_height 900 -video_width 1200 -sound_app auto -data_path "../" -system_script "MyProject/unigine.cpp" -engine_config "../data/MyProject/unigine.cfg" -engine_log "../MyProject_log.htm" -console_command "render_anisotropy 0 && world_load  MyProject/MyProject" -extern_define ",QUALITY_HIGH" -extern_plugin ",Collada,Interface"

When i launch the slave program and after the master program, i do not have any message on the master program telling my the slave is connected.

Could you explain me how to render the same simple scene (a simple cube for example) on 2 computers, step by step.
Maybe with a complete and ready to run minimalistic slave application and a complete minimalistic Master application.
 
Best regards

Link to comment

Hi Eric,

 

You can find slightly modified sample <SDK>/data/samples/syncker/mesh_00 in attached zip archive. Please, extract files from zip archive to your project folder. After that you can run launch_slave.bat on slave machine and then run launch_master.bat on master machine. Please, take note, that you should launch slave script before launching master script.

 

Value of master_address variable is defined in common/syncker.h file.

my_project.zip

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...