Jump to content

[SOLVED] is it possible to create multiple instance in a single process?


photo

Recommended Posts

I'm still trying to finish my web player part, now everything works fine, including the javascript interaction with engine.

 

But it seems engine have some problem.

 

1.in debug version of engine, initalize engine works fine, but with release version of engine, if I need to create engine multiple times(not multiple instance), then when second time initalize, the engine will tell me a fetal error that can not load system script. And after a little debug, I found in release version, the system_script variable are cleared before.

if(engine.interpreter->load(system_script.get(),(system_script.get() == SYSTEM_SCRIPT) ? (cache_path + SYSTEM_CACHE).get() : NULL) == 0) {
  	 Log::fatal("Engine::init(): can't load \"%s\" system script\n",system_script.get().get());
   }

 

but in debug version these codes works, also there are some other things, like sound_app are set to null..

 

2.It's not possible to create two browser tab to open two web player, the second player will issue a error message "Unigine::Engine::init(): is already initialized", then all engine instance crashed.

 

first problem can be solved by adding a argv to set -system_script to core/unigine.cpp, but I think if unigine can support to create multiple instance of Engine in a single process will be much much better.

 

Because of this limitation, the web player is somehow a joke, becase you can only open one page contain one web player in it. but really more common case is you can open multpile page contains multiple web player, just like flash player, You can not limit user to use only one flash inside a browser process right?

Link to comment
  • 2 weeks later...

Multiple instances of the engine in a single process are in no way not possible, I'm afraid. The only approach you can use is to create different system process for engine instances. (You can also use sockets for intercommunication).

Link to comment

ha, right, I know this require a looot of work, so... there is no way to do this :)

for application, it works fine, but for npapi plugin working with firefox/chrome, there is no way to create multiple instance of plugin-container.exe in firefox and multiple plugin process in chrome. But the strange thing is, ie 8/9 create seperate process for each tab no matter what plugin that tab uses.

 

So, my web player plugin can only open multiple plugin page in internet explorer B)

 

anyway, my plugin is done, written in native activex and npapi with full scripting support( well, not so full, :D because the c++ api only have very limited function)

Link to comment
×
×
  • Create New...