About Store Forum Documentation Contact



Post Reply 
[Solved]Strange error ;)
Author Message
Harry Offline
Member

Post: #1
[Solved]Strange error ;)
I've got and error in my game wchic stops game like pause but without any crashes. Yesterday I tried to found it and the result was that game stops in draw game function in Renderer(Render); line.

Code:
LogN("1");
    Renderer(Render);
    LogN("2");

File log.txt show last number as 1.


So I checked Render function. But here everything was ok without any error. I decided to comment one by one draw functions for objects in World. But it doesn't show anything too. Now I don't know what to check so I write here. Maybe someone has any tips which help me wink
(This post was last modified: 09-15-2010 05:47 PM by Harry.)
09-12-2010 10:40 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Strange error ;)
You can start in debugging mode, once you experience pause, you can select menu debug brak all and check the call stack.
09-12-2010 12:39 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #3
RE: Strange error ;)
Call Stack show mi this:

http://yfrog.com/ccerrsj

As I know ntdll.dll is a Windows file. Is reinstall Windows necessery? Or use programs like Combobox to check computer? Or try to restore this file?
09-12-2010 02:00 PM
Visit this user's website Find all posts by this user Quote this message in a reply
menajev Offline
Member

Post: #4
RE: Strange error ;)
I had situations when debugger showed .dlls as a problem and all time that was something in code.
If render functions is empty ( Render(){} ) problem still exists? What if map is not loaded?
09-12-2010 05:52 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #5
RE: Strange error ;)
Well when Render is empty I can't do anything because world isn't draw too. And this situation is only in specific places. I don't check it precisly but I think that this error is between two world areas.

EDIT: I started my world and I saw it only with Physics.draw (Render function was empty). In this situation error wasn't occured.
(This post was last modified: 09-12-2010 06:40 PM by Harry.)
09-12-2010 06:23 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #6
RE: Strange error ;)
I look closer at this and error is probably somewhere here:

Code:
struct Car : Item
{virtual void drawBlend  ();}


    if(mesh && Frustum(mesh->box,matrix()))
    {
        if(MaterialPtr m= Game::World.hmMaterial(matrix().pos.xz()))
        {
            if(m->user_type==MUT_STONE)
            {...
            }else if(m->user_type==MUT_EARTH)
            {...
            }else if(m->user_type==MUT_MUD)
            {...
            }else if(m->user_type==MUT_SAND)
            {...
            }
        }
    }
}

or here

Code:
struct PoliceCar : Car
{MaterialPtr frontlgtG,
                stoplgtG,
                redsiglgt,
                redsiglgtG,
                whitesiglgt,
                whitesiglgtG,
                frontlgt,
                stoplgt ;

virtual UInt drawPrepare(); // object draw prepare
}

UInt PoliceCar::drawPrepare()
{
    // front lights
    if(frontLights)
    {          
        frontlgt=mesh->part(4).material();
        mesh->part(4).setMaterial(frontlgtG);
    }
    // stop lights
    if(stopLights || frontLights)
    {
        stoplgt=mesh->part(3).material();
        mesh->part(3).setMaterial(stoplgtG);
    }
    if(signalTime)
    {
        mesh->part(1).setMaterial(horn ? whitesiglgt : whitesiglgtG);
        mesh->part(2).setMaterial(horn ? redsiglgtG  : redsiglgt   );
    }

    UInt modes=__super::drawPrepare();

    //front lights reset
    if(frontLights)
    {
        mesh->part(4).setMaterial(frontlgt);
    }
    // stop lights reset
    if(stopLights || frontLights)
    {
        mesh->part(3).setMaterial(stoplgt);
    }
    if(signalTime)
    {
        mesh->part(1).setMaterial(whitesiglgt);
        mesh->part(2).setMaterial(redsiglgt  );
    }
    return modes;
}

Is here everything ok? I can't find antyhing.
(This post was last modified: 09-12-2010 07:56 PM by Harry.)
09-12-2010 07:56 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: Strange error ;)
not sure what's the problem,

you can try commenting some parts of the codes

side note: accessing "mesh->part(4)" and similar
can be potentially dangerous without first checking if "mesh!=NULL" and if there is 4-th part
09-13-2010 04:55 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #8
RE: Strange error ;)
Error is even when I put this functions empty or only with __super. Error disappear only when I comment virtual void draw....() in structure. But I'll check it anyway.

Edit: Now error is only withe drawBlend() not comment.

EDIT2: I tried put everything from drawBlend to void Render() function and render it in RM_BLEND but I had error too.
(This post was last modified: 09-13-2010 09:31 PM by Harry.)
09-13-2010 06:28 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #9
RE: Strange error ;)
so this causes the freeze?
Code:
{virtual void drawBlend  ();}


    if(mesh && Frustum(mesh->box,matrix()))
    {
        if(MaterialPtr m= Game::World.hmMaterial(matrix().pos.xz()))
        {
            if(m->user_type==MUT_STONE)
            {...
            }else if(m->user_type==MUT_EARTH)
            {...
            }else if(m->user_type==MUT_MUD)
            {...
            }else if(m->user_type==MUT_SAND)
            {...
            }
        }
    }
}
please paste full code of this method
09-15-2010 03:48 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #10
RE: Strange error ;)
I found problems and fixed it. They are related to materials in drawBlend and drawPrepare functions:

1. In drawBlend() I changed this code:
Code:
if(MaterialPtr m= Game::World.hmMaterial(matrix().pos.xz()))

to

Code:
struct Car : Game::Item
{
MaterialPtr m;
...
};
void Car::drawBlend()
{
...
if(m= Game::World.hmMaterial(matrix().pos.xz()))
...
}

2. In drawPrepare from:

Code:
struct PoliceCar : Car
{
MaterialPtr frontlgt,
stoplgt;
}

void PoliceCar::drawPrepare()
{
...
    if(frontLights)
    {          
        frontlgt=mesh->part(4).material();
        mesh->part(4).setMaterial(frontlgtG);
    }
    if(stopLights || frontLights)
    {
        stoplgt=mesh->part(3).material();
        mesh->part(3).setMaterial(stoplgtG);
    }
...
        if(frontLights)
        {
            if(mesh->part(4).is())mesh->part(4).setMaterial(frontlgt);
        }
        if(stopLights || frontLights)
        {
            if(mesh->part(3).is())mesh->part(3).setMaterial(stoplgt);
        }
...
}

to

Code:
struct PoliceCar : Car
{
MaterialPtr frontlgt,
stoplgt;
}
void PoliceCar::create(Game::ObjParams &obj)
{
...
frontlgt.require("...");
    stoplgt.require("...");
...
}
void PoliceCar::drawPrepare()
{
...
    if(frontLights)
    {          
        mesh->part(4).setMaterial(frontlgtG);
    }
    if(stopLights || frontLights)
    {
        mesh->part(3).setMaterial(stoplgtG);
    }
...
        if(frontLights)
        {
            if(mesh->part(4).is())mesh->part(4).setMaterial(frontlgt);
        }
        if(stopLights || frontLights)
        {
            if(mesh->part(3).is())mesh->part(3).setMaterial(stoplgt);
        }
...
}

I checked places where an error was occured about 10 times and everything works ok.
(This post was last modified: 09-15-2010 05:28 PM by Harry.)
09-15-2010 05:24 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #11
RE: [Solved]Strange error ;)
I think I know what's the problem, I've improved the codes to avoid this kind of issue.

Side note:
you'll have better performance when using MaterialLock instead of mesh_part. setMaterial, like this:

MaterialLock=material; mesh_part.draw(..)
MaterialLock=NULL;

also when I've said you're not checking if 4-th part exists,
I didn't mean something like this:
if(mesh->part(4).is())

but like this

if(InRange(4,mesh->parts()))
09-15-2010 06:51 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #12
RE: [Solved]Strange error ;)
Ok thanks for this smile I'll update my codes.
09-15-2010 07:02 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply