Utilizing the CIGI Protocol in Unigine


photo

Recommended Posts

Hello,

We have been looking into using the CIGI protocol in Unigine with C#, however there is very little in the documentation on it, and we are unable to use the samples.

Is there a demonstration of a CIGI client and potentially a CIGI Server that is available for download for testing and review to better understand it.

Thanks in advance,

Off Planet Simulation

Link to post

Hi!

Unfortunately, CIGIClient plugin only works with UnigineScript. All that it can do is automatically parsing the packets from the Host. All responses to incoming packets have to implement by yourself.
CIGI Host Emulator you can download here: Host Emulator 3.3.3

Sample of CIGIClient you can find here: SDK Browser -> Samples -> UnigineScript -> App -> cigi_client_00

You can work with the plugin in C # using interpreter/reflection methods (but it's a little complicated):

// find all function pointers

int cigi_init = -1;
int cigi_shutdown = -1;

Unigine.Reflection reflection = new Reflection(Engine.get().getWorldInterpreter(), new Variable("engine.cigi"));
for (int i=0; i<reflection.getNumFunctions(); i++)
{
	if (reflection.getFunctionName(i) == "init")
		cigi_init = reflection.getFunctionID(i);
	else if (reflection.getFunctionName(i) == "shutdown")
		cigi_shutdown = reflection.getFunctionID(i);
	// ...
}

// sample of use

reflection.callExternFunction(cigi_init, new Variable(51), new Variable("127.0.0.1"), new Variable(8888), new Variable(8889));


In version 2.6, CIGIClient plugin was significantly improved. Added automatic logic for managing entities / views / articulated parts. Added automatic communication with Syncker and much, much more. Added C++ API support (C# API will be added later in the next versions).

Best regards,
Alexander

Link to post