About Store Forum Documentation Contact



Post Reply 
MESH can't load (or Cache fail?).
Author Message
mizukami Offline
Member

Post: #1
MESH can't load (or Cache fail?).
I encounted runtime error on iOS (iOS only).
When loading a MESH, i got error message "Can't load Mesh" and app terminated (always some same MESHs).
Code below.

Code:
MeshPtr  m_mesh;
m_mesh = ObjectPtr(uid)->mesh();

and terminated in this point.
Code:
template<typename TYPE, Cache<TYPE> &CACHE>  CacheElmPtr<TYPE,CACHE>:: CacheElmPtr(C UID         & id  ) {              T._data=(TYPE*)CACHE._require(    id   , null, true);}

The Mesh datas can see on EE editor (Windows/Mac OS).

In this case, What's the possible factor?
(Data broken? Cache control fail? or?)
04-19-2016 07:01 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: MESH can't load (or Cache fail?).
Hi,

This error could be because you've used SVN to synchronize the project, and not Esenthel Server.

The Editor on Windows/Mac loads files directly from the "Project/Game" folder.

So even if the element is not listed in the "Project/Data" project file, but the element's file is located in "Project/Game", then Editor will display the object.

However when the Editor publishes apps (or build for mobile platforms, as in your case for iOS), then it will not copy all files from "Project/Game", but it will iterate all elements that are stored in the "Project/Data" file (the same elements that you obtain during EditorInterface.getElms), and it will copy only the files of those elements into the published PAK.
This PAK contains the element file data, and is loaded on iOS.

For example you can do this to check if the mesh element is listed in "Project/Data" list of elements:
Write an Application on Windows:
Code:
UID mesh_id=ObjectPtr(uid)->mesh().id(); // get the UID of the mesh element
then connect to the Editor using Editor Inferface:
EI.connect(..)
EI.getElms(elms);
if(!Edit::FindElm(elms, mesh_id))Exit("This mesh is not listed in the Project");

In short:
-having just file present in "Project/Game" is not enough
-you need to have this element listed in the list of elements, stored in the "Project/Data" file, because only then the Editor will include element's files when publishing (or building for Mobile platforms)
-you can't use SVN to synchronize the project
-you need to use Esenthel Editor + Esenthel Server

If that's indeed the issue, that the mesh element is not listed in the "Project/Data" list of elements, then I recommend:
-removing existing "object" element from the Editor (just right-click and select remove)
-create a completely new object, and use it instead of the old one
-however you need to start using Esenthel Server for synchronization of the project.

Please let me know if you need more help.
04-19-2016 07:39 AM
Find all posts by this user Quote this message in a reply
mizukami Offline
Member

Post: #3
RE: MESH can't load (or Cache fail?).
Thanks for reply.

The MESH files are listed in EE editor. also, corresponding files found at "Project/Game".
But, runtime error occurred somehow. What's happen?

iOS (and iOS emulator) failed to run. However Androids OK.
(This post was last modified: 04-19-2016 08:35 AM by mizukami.)
04-19-2016 08:30 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: MESH can't load (or Cache fail?).
Hi,

Objects are composed out of multiple elements:
ELM_OBJ:
-ELM_MESH
-ELM_SKEL
-ELM_PHYS

Editor will display only ELM_OBJ on the list.
However it appears that the problem is when loading ELM_MESH.
So please verify that this ELM_MESH is listed in the element list obtained via EI.getElms.
04-19-2016 08:33 AM
Find all posts by this user Quote this message in a reply
mizukami Offline
Member

Post: #5
RE: MESH can't load (or Cache fail?).
A resource (had a problem, i guess) and relational datas found in EI.getElms(); (below).

ELM_MESH: Image/Weapon/wp01/wp01_2401500001
ELM_OBJ: Skin/Weapons/2401500001/mtSword
ELM_MTRL: Skin/Weapons/2401500001
ELM_IMAGE:Skin/Weapons/2401500001/2401500001
04-19-2016 08:47 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: MESH can't load (or Cache fail?).
Hi,

This ELM_MESH that you've listed, I don't think it's the one you need.
It should be a child of the ELM_OBJ.

ELM_OBJ: Skin/Weapons/2401500001/mtSword
ELM_MESH: Skin/Weapons/2401500001/mtSword/*

But yours is located in a different path, "Image/.."
ELM_MESH are always a child of ELM_OBJ (their parent_id = id of ELM_OBJ

Please use the code I've posted above:
Code:
UID mesh_id=ObjectPtr(uid)->mesh().id(); // get the UID of the mesh element
then connect to the Editor using Editor Inferface:
EI.connect(..)
EI.getElms(elms);
if(!Edit::FindElm(elms, mesh_id))Exit("This mesh is not listed in the Project");
04-19-2016 09:07 AM
Find all posts by this user Quote this message in a reply
mizukami Offline
Member

Post: #7
RE: MESH can't load (or Cache fail?).
(04-19-2016 09:07 AM)Esenthel Wrote:  ELM_OBJ: Skin/Weapons/2401500001/mtSword
ELM_MESH: Skin/Weapons/2401500001/mtSword/*

its copy miss. sorry...

ELM_MESH: Skin/Weapons/2401500001/2401500001
ELM_OBJ: Skin/Weapons/2401500001
ELM_MTRLJ: Skin/Weapons/2401500001/mtSword
ELM_IMAGE:Image/Weapon/wp01/wp01_2401500001

Code:
UID mesh_id=ObjectPtr(uid)->mesh().id(); // get the UID of the mesh element
then connect to the Editor using Editor Inferface:
EI.connect(..)
EI.getElms(elms);
if(!Edit::FindElm(elms, mesh_id))Exit("This mesh is not listed in the Project");

included. thanks.
Then, "Can't load Mesh" error encounted at ...

Code:
UID mesh_id=ObjectPtr(uid)->mesh().id(); // get the UID of the mesh element

Traced inner of EE. So, it crashed at ...

Code:
template<typename TYPE, Cache<TYPE> &CACHE>  CacheElmPtr<TYPE,CACHE>:: CacheElmPtr(C UID         & id  ) {              T._data=(TYPE*)CACHE._require(    id   , null, true);}

"uid" has something a value (not UIDZero).
However, "mesh_id" cannot get a value.
04-19-2016 10:42 AM
Find all posts by this user Quote this message in a reply
mizukami Offline
Member

Post: #8
RE: MESH can't load (or Cache fail?).
XCode said.
> Can't load Mesh "!zc83d4y#zu43dbpf#tp9sl1"

File ID "!zc83d4y#zu43dbpf#tp9sl1" is in our EE Editor, ofcourse is in EI.getElms(elms);
But cannot load it...
04-19-2016 11:44 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #9
RE: MESH can't load (or Cache fail?).
Hi,

That's good news the element is in the project.

You can send me the "!zc83d4y#zu43dbpf#tp9sl1" mesh file from "Project/Game" folder and I will investigate why does it fail to load.

Or if you want to investigate it yourself if you don't want to send it:
-You can compile the Engine in Debug mode
-open the https://github.com/Esenthel/EsenthelEngi....xcodeproj project in Xcode, and compile in debug mode
-then go to your game project in Esenthel Editor, click "Build/Open in Xcode"
-once your game project is visible in Xcode, right click on the application to set properties, and replace the engine static library "EsenthelEngine*.a" from "Editor/Bin/EsenthelEngine*.a" to the one that was just compiled in Debug mode.
-modify your game CPP file in Xcode, the "Init" function to the following:
Code:
bool Init()
{
   Mesh mesh;
   mesh="!zc83d4y#zu43dbpf#tp9sl1";
   return true;
}
Select a breakpoint, at the "mesh=.." line, and do "Step Into" in the Xcode debugging menu.
Because engine is compiled in debug mode, you should be able to see engine source code responsible for loading the mesh.
Continue stepping into, until some error occurs, then you can attach a screenshot for me of the current code location and call stack.
04-19-2016 01:28 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #10
RE: MESH can't load (or Cache fail?).
Some additional ideas:
-perhaps when running the game on iOS, an older version of the engine was used, than the one that created the mesh?
If you use the binary version of the engine, please try updating engine to latest version, or if you use the source license, then recompile the engine with latest source.

-perhaps the mesh file was for some reason not included in the iOS PAK file of game data.
To verify this, you can check in your game codes on iOS:
Code:
bool Init()
{
   if(!Paks.find("!zc83d4y#zu43dbpf#tp9sl1"))
      Exit("File not found in PAK");

   File f;
   if(!f.readTry("!zc83d4y#zu43dbpf#tp9sl1"))
      Exit("failed to read the file");

   return true;
}

The mesh could not be included in the game package if it has "Publishing disabled" in the element properties.
You can check element properties using Editor Interface on Windows or Mac:
Code:
EI.connect(..);
EI.getElms(elms);
if(Edit::Elm *elm=Edit::FindElm(elms, UID of the mesh here))
{
   Exit(S+"removed:"+elm->final_removed
         +"\nwill be included in game files:"+elm->final_publish);
}else
{
   Exit("element not found");
}
"removed" should be 0
and
"will be included in game files" should be 1
04-19-2016 09:59 PM
Find all posts by this user Quote this message in a reply
mizukami Offline
Member

Post: #11
RE: MESH can't load (or Cache fail?).
Many thanks.

(04-19-2016 09:59 PM)Esenthel Wrote:  -perhaps the mesh file was for some reason not included in the iOS PAK file of game data.
To verify this, you can check in your game codes on iOS:

"Paks.find();" and "File.readTry();" had ended with no problem.
So, data "!zc83d4y#zu43dbpf#tp9sl1" was found at iOS build, i think.
04-20-2016 02:58 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #12
RE: MESH can't load (or Cache fail?).
Thank you for the update, in that case I recommend trying things from this post:
http://www.esenthel.com/forum/showthread...7#pid53687

BTW: I've just tried running my Dungeon Hero game with latest engine version, on iPad Mini 2, and it works OK, all meshes are loaded.
04-20-2016 03:00 AM
Find all posts by this user Quote this message in a reply
mizukami Offline
Member

Post: #13
RE: MESH can't load (or Cache fail?).
(04-19-2016 09:59 PM)Esenthel Wrote:  The mesh could not be included in the game package if it has "Publishing disabled" in the element properties.
You can check element properties using Editor Interface on Windows or Mac:

i checked, and "final_publish" is 1. "final_removed" is 0.
(This post was last modified: 04-20-2016 06:31 AM by mizukami.)
04-20-2016 03:04 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #14
RE: MESH can't load (or Cache fail?).
Hi,

It would be best if I had access to the mesh file and could test it myself.

But you can test it too, please check the instructions how to do so, in this post:
http://www.esenthel.com/forum/showthread...7#pid53687
04-20-2016 07:02 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #15
RE: MESH can't load (or Cache fail?).
Also I wanted to provide a hint for you how to reduce the size of your game package:
Quote:ELM_IMAGE:Image/Weapon/wp01/wp01_2401500001
I'm assuming that this image is used as the Material texture.
In case you don't know yet, you can disable it from publishing, because Material will have its own optimized copy of textures generated, so the source images don't need to be present.
This is described in the documentation here:
http://www.esenthel.com/?id=doc#Material
http://www.esenthel.com/?id=doc#Reducing_App_Size
04-20-2016 09:08 AM
Find all posts by this user Quote this message in a reply
Post Reply