About Store Forum Documentation Contact



Post Reply 
Need help with Game.World.Update Crash
Author Message
SamNainocard Offline
Member

Post: #1
Need help with Game.World.Update Crash
When I create multiple of same objects (Game.World.objCreate) at same time, sometimes game would crash and call stack pointed to this error, from my knowledge this will crash when create object at invalid position (FLT_MAX) but the problem is my position are valid from debug, so I don't know what cause this.

Anyone have a insight on this?
(This post was last modified: 05-28-2015 07:10 PM by SamNainocard.)
05-28-2015 05:33 PM
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #2
RE: Need help with Game.World.Update Crash
You are making sure you are not creating objects in areas that aren't fully loaded?
if you want to create objects you should use objCreateNear(if it exists anymore) or you should use WORLD_FULL or just simply prevent objects from being created outside of active areas.

Also got to ask are you creating them in a separate thread(this can cause issues unless you sync the thread in which case the creation performance is probably equal or worse or even just tiny bit faster than doing it on a single thread due to the create is not thread safe to my knowledge)
05-28-2015 06:05 PM
Find all posts by this user Quote this message in a reply
SamNainocard Offline
Member

Post: #3
RE: Need help with Game.World.Update Crash
Hmm, I used WORLD_FULL and 200 active range, objects are create not far from player/camera too much (~20m), so it probalby in active range, and I also didn't use thread. (I didn't learn it yet smile )

But I have yet to try Game.World.objCreateNear, will see if it crash.

Edit: Still crash.
By the way I created 3-5 of same objects at same time around that position and offset a bit so they're not spawn inside each others.
(This post was last modified: 05-28-2015 06:40 PM by SamNainocard.)
05-28-2015 06:26 PM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Member

Post: #4
RE: Need help with Game.World.Update Crash
i use this:
if(Kb.bp(KB_K ))
{
Game.ObjParamsPtr op = Game.ObjParamsPtr(UID(4207078662, 1144901524, 262883225, 3227955895));
Game.World.objCreateNear(*op, Matrix(op->scale3(), (Plr.pos()+Vec(2, 2, 2))));
}

and so far it never crashed or did any issue to me
05-28-2015 06:38 PM
Find all posts by this user Quote this message in a reply
Pixel Perfect Offline
Member

Post: #5
RE: Need help with Game.World.Update Crash
I do likewise and have never experienced any problems:

Code:
// Get a pointer to the NPC model
Game::ObjParamsPtr obj=Game::Objs.ptrRequire(modelUID);

// Create the new NPC object and return a pointer to it (This also adds it to the npcObjs collection by virtue of its type).  
Game::Obj* myObj = Game::World.objCreateNear(*obj, Matrix(obj->scale(), Vec(position.x,position.y+0.1,position.z)));

myObj pointer is subsequently cast to my npc class for my own internal use.
05-28-2015 08:48 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Need help with Game.World.Update Crash
Hello,

I think it would be best if you could attach a sample project with the issue reproduced, this way we could figure out the source of the problem much faster.
05-29-2015 12:00 AM
Find all posts by this user Quote this message in a reply
SamNainocard Offline
Member

Post: #7
RE: Need help with Game.World.Update Crash
I'm using something like these code.
PHP Code:
UID enemy    =UID(xxxx);
Vec pos      =Game::World.findWaypoint(xxxx).points[0];
flt cossin,  offset=RandomF(PI2);
size             =Random(35);
      
REP(size)
      {
         
SinCos(sincosoffset+i*(PI2/size));
         
Vec p=pos+Vec(2*cos02*sin);
         
pos.y=Game::World.hmHeight(pos.xz())+0.15;
         if (
Game::ObjParamsPtr tmp=Game.Objs.ptrRequire(enemy))
         {
             
Game::ObjParams obj;
             
obj.base(tmp);
             
// add a few custom params, like starting HP
             
Game::World.objCreate(obj,Matrix(obj.scale(), pos));
         }
      } 

The problem is, it isn't always happens, sometime it crash on first object, sometimes it never happens even after 1k+ objects.

I'll use Game::World.objCreateNear() for a while and will try to narrow it down.
(This post was last modified: 05-29-2015 06:04 AM by SamNainocard.)
05-29-2015 05:15 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #8
RE: Need help with Game.World.Update Crash
The code itself looks ok I think.
05-30-2015 01:42 AM
Find all posts by this user Quote this message in a reply
SamNainocard Offline
Member

Post: #9
RE: Need help with Game.World.Update Crash
I still can't pinpoint of what cause this, it's rarely happens now though, but here's call stack if someone could help me.

This crash on changing world, in very rare case though.
Code:
    PhysX3_x86.dll!52722e32()    Unknown
    [Frames below may be incorrect and/or missing, no symbols loaded for PhysX3_x86.dll]    
    PhysX3_x86.dll!52721a47()    Unknown
    PhysX3_x86.dll!52600527()    Unknown
    ntdll.dll!76f6de3c()    Unknown
    Xenocrystalloid - The Eradications (Alpha 2).exe!EE::PhysicsClass::stopSimulation(void)    C++
    Xenocrystalloid - The Eradications (Alpha 2).exe!EE::Game::WorldManager::update(struct EE::Vec2 const &)    C++
>    Xenocrystalloid - The Eradications (Alpha 2).exe!EE::Game::WorldManager::update(const EE::Vec & pos) Line 193    C++
    Xenocrystalloid - The Eradications (Alpha 2).exe!BackgroundLoader::BackgroundLoad(EE::Thread & thread) Line 10    C++
    Xenocrystalloid - The Eradications (Alpha 2).exe!EE::Free<struct EE::Threads::ThreadEx>(struct EE::Threads::ThreadEx * &)    C++
    Xenocrystalloid - The Eradications (Alpha 2).exe!_callthreadstartex() Line 376    C
    Xenocrystalloid - The Eradications (Alpha 2).exe!_threadstartex(void * ptd) Line 354    C
    kernel32.dll!76d27c04()    Unknown
    ntdll.dll!76f8ad1f()    Unknown
    ntdll.dll!76f8acea()    Unknown

Something about physics perhaps?
07-25-2015 06:22 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #10
RE: Need help with Game.World.Update Crash
When using background loader, you need to make sure you have the code at start of the functions:

Code:
bool Update()
{
   if(BL.update())return true; // this needs to be at the start of 'Update' function

..

void Draw()
{
   if(BL.draw())return; // this needs to be at the start of 'Draw' function


Please see tutorial "19 - Loading Screen"
07-25-2015 11:26 PM
Find all posts by this user Quote this message in a reply
SamNainocard Offline
Member

Post: #11
RE: Need help with Game.World.Update Crash
Because I have network, so I update Connection and ClientServer before BL.update(), do I have to move it somewhere? I think MMO source also update before BL.update.

Code:
bool GameUpdate()
{
   if(ClientServer.is()) ClientServer.update(); // host
   ServerConnection.gameUpdate();
   if(BL.update()) return true;
....
}

void GameDraw()
{
   if(BL.draw())return;
....
}

Edit: Perhaps because I put BL.start() in middle of other function, will try to move to the end of function.
(This post was last modified: 07-26-2015 05:50 AM by SamNainocard.)
07-26-2015 05:07 AM
Find all posts by this user Quote this message in a reply
Post Reply