Jump to content

Archiving issues


photo

Recommended Posts

Hi, I've run into an interesting problem with archiving.  From what I understand of archiving, the ung file is opened at load time and treated like its internal files are just there.

 

I have each level archived into its own archive file, and all the other common files in a common.ung file under my data file.

 

If I use world_load to load a level, they work just fine like I'd expect.

 

However, it seems my unigine.cpp script file in my common.ung file does not load.  Just to make sure it was there, I used the inventory feature of the archiver, and the unigine.cpp file is there in the archive.  It is just in the root folder.  (And since the common.ung file is in my data folder, unigine.cpp is effectively sitting in my data folder).

 

This is also part of my command line:   -system_script unigine.cpp

 

If I leave unigine.cpp unarchived and just sitting in the folder, then it works.  But if I archive it, the code in unigine.cpp never gets run. 

 

Thanks

Link to comment

Thanks for looking into it.  For now as a workaround, I just leave unigine.cpp unarchived.

 

It seems all the other files work ok in the archive.

 

I was wondering if it had to do with loading the unigine.cpp from the command line parameters passed to the engine constructor?  Like maybe if you do it that way it loads the unigine.cpp script before it decrypts and loads the archives?  Just a thought.

 

Thanks

Link to comment

hello Joseph

 

please, try the following solution:

  1. put your script-file unigine.cpp into separate folder, for example in "data/common_script/"
  2. compress folder "common_script" into ung-file
  3. part of command line for loading script will be next: -system_script "common_script/unigine.cpp"

This solution should help you and custom code will start to work

Link to comment

Hi paralyzah,

 

I still can't get it to work.

 

I created a file called Common.ung.  Doing an inventory on that file (just to make sure the script is there), gives me:

 

common_script/unigine.cpp 2.5KB

 

Command line parameters:

 

-system_script common_script/unigine.cpp

 

And still nothing.  However, if I leave that file unarchived in that same location, works just fine.

Link to comment

1. For example: this is code for unigine.cpp:

#include <core/unigine.h>
#include <core/scripts/system/system.h>
#include <core/scripts/system/stereo.h>
#include <core/scripts/system/wall.h>

/*
 */
int init() {
	systemInit();
	stereoInit();
	wallInit();
	log.warning("code is running 1 \n");
	return 1;
}

/*
 */
int shutdown() {
	log.warning("code is running 2 \n");
	systemShutdown();
	stereoShutdown();
	wallShutdown();
	return 1;
}

/*
 */
int update() {
	log.warning("code is running 3 \n");
	systemUpdate();
	stereoUpdate();
	return 1;
}

/*
 */
int render() {
	log.warning("code is running 4 \n");
	wallRender();
	return 1;
}

2. I put unigine.cpp in the directory "data/123" 

3. I put ung_x64.exe into data folder and run it with next parameters: 

ung_x64.exe 123 -o common.ung

and i get next situation: : 

post-20-0-03794600-1459410180_thumb.png

 

4. Next steps: deletion of folder "123" and start of project with next command line (i used batch-file in project folder): 

 

start bin\unigine_project_x64.exe  -data_path "../" -system_script "123/unigine.cpp"

6. All custom lines from unigine.cpp will be executed, see log.html:

log.html

 

 

-----

Link to comment

Paralyzah,

 

The only difference I see between what you're doing and what I am doing is that I am actually running Unigine through a dll instead of an exe.  Unigine for us is just a window that is part of our larger app.  Our larger app is written in java and we interface with unigine through jni.  Could that have anything to do with it?

 

Anyways, I've tried unigine.cpp in various folders, archived and unarchived.  Everytime I archive it, it just doesn't run.  If I leave it unarchived, it runs just fine.  I think this is the one and only file this applies to.  Every other script/file we try loading works just fine archived.

 

I'm a little busy the next few days.  If I get a chance, I'll try running your specific Unigine.cpp and see if that makes a difference for some reason.

 

Thanks paralyzah.

Link to comment
×
×
  • Create New...