Jump to content

[SOLVED] Miminum Hello World App


photo

Recommended Posts

Posted

Hi there.

I have a newbie question :) Have been searching through the forum, and C++ Api documentation, but still there are some doubts. I am trying to understand the packaging/resources system in Unigine.

As for now I know that alll initialization happens when m_pEngine = Unigine::Engine::init(UNIGINE_VERSION, argc, argv); is called.
My minimum unigine.cfg file looks like:
<?xml version="1.0" encoding="utf-8"?>
<config version="1.00">
</config>

However when I start my app, I get Engine::init(): can't initialize filesystem error. I had to add to my config section <item name="data_path" type="string">./media/unigine/</item>

In the media/unigine/data directory I had to put core.ung package.

 

My app is supposed to be remotely run, for my reasons it is important that we can change the databases dynamically. My goal is to make a filesystem with one package(or directory) to one terrain database. Also additional packages will be added for objects (vehicles, aircrafts etc.). Questions:

Q1) I assume core.ung is a must, to run any Unigine-based app. Is it right?

Q1.1) Why do I need to put core.ung to ./media/unigine/data - instead of ./media/unigine/ ??

Q2) What is the meaning for Filesystem class? Can I have more than 1 filesystem in my app?

Q3) What is the meaning for Package class?  Do I understand it right that all media files (textures, models, etc) are stored in Packages, and there are no other data sources for Unigine?

Q4) What is the relation between <item name="data_path" type="string">./some_path/</item> and these two classes? Can I have more than one data_path?

Q5) Can I dynamically enable and disable data_paths. It may happen that some files in different terrains can have same name so it might be useful?

 

Thanks in advance.

Thomas

Posted

1) core.ung is required for any unigine based application. This archive contains base material/shaders and scripts.

1.1) "data/" postfix is an hardcoded path inside the engine.

 

2) FileSystem class from UniginePackage file is just an interface for external Package management. You can't have more than one filesystem. But you can have multiple Packages.

 

3) Package class is a data provider for internal FileSystem class. You can load all resources via this class even resources from core.ung archive. But you can't have an archive inside the Package.

 

4) There is no relationship between data_path and Package class. data_path is to the engine resources. The engine data directory is data_path + "data/". You can create absolutely data-less engine if you have Package class with all resources.

 

5) You can create multiple Package classes for resources. There is only one engine data directory. Please look through source/samples/Api/Packages sample.

 

The data folder must exist if you don't provide an external Package to the engine before Engine::init() call.

The path to data folder is relative to engine executable file and it's located inside the data_path cmd/config/console variable.

×
×
  • Create New...