[Dev] Map Structure

Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25
  1. #16
    struct { int:-!!(1); } Aesir is online now
    True MemberRank
    May 2015 Join Date
    MadnessLocation
    261Posts

    Re: [Dev] Map Structure


    RaGEZONE Recommends

    RaGEZONE Recommends

    Quote Originally Posted by DragonLord View Post
    This is getting really sad at this point.
    You guys have the source available and you're making all this enormous mess and pointless threads.

    Every .dat file is essentially an .obj container.
    By default, the first entry of a .dat file is the map info itself, and it consists of the following:

    Code:
    struct MAP_DATA
    {
        float    fTileSize;
        int        nVertexNumber;
        int        nTileInfoNumber;
        int        nObjectNumber;
    };
    
    struct VERTEXINFO
    {
        float[3]    pos;
        float[3]    nor;
    };
    
    struct TILEINFOCLIENT
    {
        int                useTexNumber;
        unsigned int    dwWaterType;
        int                waterHeight;
        short            waterTexNumber;
        unsigned char    bMove;
        int                bEnableLand;
        unsigned char    bEventType;
    }
    
    struct OBJECTINFOCLIENT
    {
        unsigned int    dwObjType;
        int                nObjCount;
        float[3]        vPos;
        float[3]        vVel;
        float[3]        vUp;
        unsigned int    dwObjectMonsterUniqueNumber;
        unsigned char    bObjectTexIndex;
        unsigned int    nObjectSrcIndex;
        unsigned char    bBodyCondition;
        int                bIsEvent;
        unsigned char    bEventType;
        short            sEventIndexFrom;
        short            sEventIndexTo;
        short            sEventIndex3;
        char            strEventParam[40];
    }
    MAP_DATA, followed by VERTEXINFO * nVertexNumber, followed by TILEINFOCLIENT * nTileInfoNumber, and finally OBJECTINFOCLIENT * nObjectNumber.

    Was it really so hard to gather all this information from the source?
    The problem here is that i see a lot of guys reading the structures value by value like this:
    Code:
    using (BinaryReader BR = new BinaryReader(Path, Encoding.ASCII))
    {
        MyStruct str = new MyStruct();
        str.x = BR.ReadInt etc etc.;
        str.j = BR.ReadBoolean etc etc;
    }
    and after complaining because it dont work <_<

  2. #17
    Member Hellowen is online now
    MemberRank
    Mar 2014 Join Date
    World!Location
    70Posts

    Re: [Dev] Map Structure

    Are you able to post the .dat extension?

  3. #18
    Newbie ThatGuy is offline
    MemberRank
    Jan 2016 Join Date
    2Posts

    Re: hey guys, my little project

    Quote Originally Posted by St34lth4ng3l View Post
    ...
    I started my own one in Unity, but got stuck on model positioning, rotation etc.
    Out of sheer curiosity, did you write your own DirectX X file parser or did you use the Microsoft one through .NET's DirectX API?

    Because if you did and it also supports correctly reading/parsing animations, I could trade you the correct rotation/translation matrices you're missing for it.

  4. #19
    [Dev] Map Structure St34lth4ng3l is offline
    True MemberRank
    Apr 2013 Join Date
    __FILE__Location
    816Posts

    Re: hey guys, my little project

    Quote Originally Posted by ThatGuy View Post
    Out of sheer curiosity, did you write your own DirectX X file parser or did you use the Microsoft one through .NET's DirectX API?

    Because if you did and it also supports correctly reading/parsing animations, I could trade you the correct rotation/translation matrices you're missing for it.
    I'm using an external program during runtime to export them, because natively unity only supports a few meshtypes.

  5. #20
    Newbie ThatGuy is offline
    MemberRank
    Jan 2016 Join Date
    2Posts

    Re: hey guys, my little project

    Quote Originally Posted by St34lth4ng3l View Post
    I'm using an external program during runtime to export them, because natively unity only supports a few meshtypes.
    meshconvert from the Direct X SDK?

  6. #21
    Hardcore Member Murat Yereseren is offline
    MemberRank
    Nov 2014 Join Date
    132Posts

    Re: [Dev] Map Structure

    if i didn't make this simple wrong, you are would not to share your informations.
    :)

  7. #22
    Retired (Goddamn idiots) DragonLord is offline
    True MemberRank
    Dec 2003 Join Date
    /dev/urandomLocation
    553Posts

    Re: [Dev] Map Structure

    Quote Originally Posted by Murat Yereseren View Post
    if i didn't make this simple wrong, you are would not to share your informations.
    :)
    Are you bleeping kidding me!?
    It's as easy as reading the goddamn code!
    Don't try to pin the blame on people like just because you're a blithering idiot!
    Insanity - Doing the same thing over and over again, expecting different results - Albert Einstein


    R.I.P. Akaruz - We miss ya buddy

  8. #23
    Member bergi9 is offline
    MemberRank
    Dec 2011 Join Date
    54Posts

    Re: [Dev] Map Structure

    just if anyone need to know how to read .dat files in c# (.net).

    dat.zip

  9. #24
    Retired (Goddamn idiots) DragonLord is offline
    True MemberRank
    Dec 2003 Join Date
    /dev/urandomLocation
    553Posts

    Re: [Dev] Map Structure

    bergi, BOOL in C++ is an int, not a bool type.
    So you're looking at 4 bytes versus one byte.
    As well as char being 2 bytes due to unicode. I recommend using byte instead.
    Last edited by DragonLord; 06-01-16 at 10:55 PM.
    Insanity - Doing the same thing over and over again, expecting different results - Albert Einstein


    R.I.P. Akaruz - We miss ya buddy

  10. #25
    [Dev] Map Structure Future is online now
    SupervisorRank
    Dec 2011 Join Date
    1,826Posts

    Re: [Dev] Map Structure

    Quote Originally Posted by DragonLord View Post
    bergi, BOOL in C++ is an int, not a bool type.
    So you're looking at 4 bytes versus one byte.
    As well as char being 2 bytes due to unicode. I recommend using byte instead.
    This is all about Marshaling in C# really. You can apply native / unmanaged type attributes like he did with:
    Code:
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)]
    or optionally
    Code:
    [MarshalAs(UnmanagedType.Bool)]
    which will make a C# bool always a 4-byte integer. This is the default btw. so it's not necessary to specify it explicitly!

    The struct posted by @bergi9 works because:




    Quote Originally Posted by A Wise Man
    P-Servers are NOT dead. Bugs need squishing. Quests need fixing. Unfortunately, majority of people don't know the difference between a computer and a toaster so...




Page 2 of 2 FirstFirst 12

Advertisement