Early Work on a World Editor

Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Alpha Member GlaphanKing is offline
    MemberRank
    Sep 2008 Join Date
    World of MorrowLocation
    2,594Posts

    Early Work on a World Editor

    This was done using the help of Xadet breaking down the LND file. My first attempts were in vain but after I completed the DYO Editor, I decided to tackle this big pile of crap.

    Let me just start off by saying who the hell programs this way? In all my years in the business (programming), I've never had a file structure quite like this.

    Let me break it down on how the LND file is made. Bear in mind there are many holes in this.

    You will notice upon opening the word (wld) file you see something like this.

    Code:
    // World script
    
    size 30, 30
    indoor 0
    ambient 0xff808080
    bgColor 0xffe0e0ff
    fly 1
    camera 3800.164 89.044 4447.954  1.039  2.857 
    revival 0 "" 
    diffuse 0xff000000
    lightDir  0.000  0.000  0.000 
    fogSetting 70.000 400.000  0.000 
    bgm 0 
    pkmode 4194304
    ^^ This is the main file. It sets the stage for what is about to be loaded. The most important part of this file that pertains to the LND file is the size. Notice Madrigal is a 30 x 30 map size. You have one section at 128x128, 30 of those across and 30 of those down. That is one big ass array! Note that not every file is that big.

    Height Restrictions
    This tells the player where he/she can walk/no walk, fly/no fly, etc. It parses the entire heightmap and sets a restriction on EVERY COORDINATE!

    Next is an 16x16 array that contains heights that I'm not too sure about. I know some are water and some are clouds so need some more info on that.

    Next is an unknown 16x16 array which even xadet doesn't know about. More info is needed.

    Next is a byte that tells how many layers are in the map. I'm guessing this is where there are ceilings, walls, caves, etc.

    Next is an int for the amount of objects present on the map. Dyo file goes along with this later.

    After that is an int for the amount of SFX objects. SFX I believe refers to particles, fog, steam, explosions, etc. Don't know the structure for the SFX so skipping that for now.

    If you have followed me so far, then good. if not, I don't blame you honestly. This shit isn't for the beginner by far. Sorry, but its true.

    Now we have the heightmap. This is what my 3d program will read and create the landscape.

    OK. Take a Tylenol and a Pepsi and pat yourself on the back for learning one of the most complex, over the top, bad programming you will ever see.

    If that wasn't enough, you still need to load in all the world objects, NPCs, models, doors, load lights, etc. But that is another thread way off.

    OK. So when I get a more stable release I will post it. Right now I'm extracting the heightmaps from each file. Then I'm loading them into another program designed to create 3D landscapes from a grayscale height map. Made it myself in XNA.


  2. #2
    Valued Member damian9000z is offline
    MemberRank
    Dec 2008 Join Date
    118Posts

    Re: Early Work on a World Editor

    Let me just start off by saying who the hell programs this way?
    Mentally challenged men who got lucky enough to make it work.

    Was I supposed to take 8 tylenols and vodka?
    Last edited by damian9000z; 06-11-09 at 04:29 AM.

  3. #3
    Account Upgraded | Title Enabled! divinepunition is offline
    MemberRank
    Dec 2008 Join Date
    FranceLocation
    621Posts

    Re: Early Work on a World Editor

    i wish you luck with this, yes it will be a big task to do ^^

  4. #4
    Valued Member Duotone is offline
    MemberRank
    Jun 2009 Join Date
    107Posts

    Re: Early Work on a World Editor

    Quote Originally Posted by GlaphanKing View Post

    Next is an 16x16 array that contains heights that I'm not too sure about. I know some are water and some are clouds so need some more info on that.
    From http://xadet.net/file-formats/flyff/
    077. for (int x = 0; x < 16; x++)
    078. {
    079. for (int y = 0; y < 16; y++)
    080. {
    081. byte Height;
    082. PatchType[byte] Type;
    083. }
    084. }
    Each element represents a 8*8 square of water block (in heigthmap coordinates)
    Type = 0 means this field is invisible, just ignore it
    Type = 1 means its a cloud
    Type = 2 means water
    Also, there is an exception: If Type = 1 (cloud) and Height = 0, than you need to set the Heigth to 80. I haven't seen this to be appling to waters (Type 2).

    No clue whats the next 16*16 byte is.

    Quote Originally Posted by GlaphanKing View Post
    Next is a byte that tells how many layers are in the map. I'm guessing this is where there are ceilings, walls, caves, etc.
    They are texture layers, mapped onto the heightmap, so they cannot represent ceilings.
    Also, they are stretched down (this part is irritateing), only the first 113*113 color values are used on the 128*128 color map (beats me why). So the stretch factor is (128.0f / 113.0f). I don't know what is the use of the rest data, since it leaves the last 15 columsn and last 15 rows unused. Some layers contain alpha 1.0 values there, some not, some even has a pattern, but usually the first 1-2 layer only. Beats me so far.

    Also, rendering this is preatty slow, since each texture layer has own RGBA for each vertex (and usually there are at least 10 texture layers), kinda eliminates the use of multitextureing, forceing to render each primitive as much times as many visible texture layers the current area has.
    Last edited by Duotone; 06-11-09 at 10:01 AM.

  5. #5
    Alpha Member GlaphanKing is offline
    MemberRank
    Sep 2008 Join Date
    World of MorrowLocation
    2,594Posts

    Re: Early Work on a World Editor

    well I have pulled out the heightmap from the LND. Can't understand why they only use a 112x110 when clearly it should be 128x128.

    I counted 29 layers just on the guildwar map alone. Now that I know what this entails I can start making changes to the code to layer the height maps on one another and see what effect there is.

    There is something I have been wanting to do and that is render the o3d models. Unfortunately the code is in Python and I code in C#. It will take some time to get this done.

    For now I'm going to get the layers done and then start painting the landscape.

    This is turning out to be a successful test I might add.

  6. #6
    Valued Member Duotone is offline
    MemberRank
    Jun 2009 Join Date
    107Posts

    Re: Early Work on a World Editor

    Heigthmap uses all values in it. the 129*129 floats defines' 128*128 blocks, and looking at the raw 129*129 float array, the last value in each column should equal to the next map-file given column's first value, same applies to rows. If they doesn't equal, the next file's first value should be used (for each given row/column). Basically thats what chains map-files togeather.

  7. #7
    Alpha Member GlaphanKing is offline
    MemberRank
    Sep 2008 Join Date
    World of MorrowLocation
    2,594Posts

    Re: Early Work on a World Editor

    Sounds more like a jigsaw puzzle.

    Well once I chain the maps together I'm going to release the source so everyone can get a chance to work on it. I only know so much and with the help of the community, we can get it going more quickly.

  8. #8
    Account Upgraded | Title Enabled! divinepunition is offline
    MemberRank
    Dec 2008 Join Date
    FranceLocation
    621Posts

    Re: Early Work on a World Editor

    like you said another task we have to do will be to manage this o3d structure but if we have this structure we could probably write a o3D => obj converter with last version of o3d (v14 have add some line in it)
    Unfortunatelly i don't know anything about modeling and all those "vertex" lol but i will try to take a look to when i will have more time

  9. #9
    Valued Member Duotone is offline
    MemberRank
    Jun 2009 Join Date
    107Posts

    Re: Early Work on a World Editor

    Quote Originally Posted by divinepunition View Post
    like you said another task we have to do will be to manage this o3d structure but if we have this structure we could probably write a o3D => obj converter with last version of o3d (v14 have add some line in it)
    Unfortunatelly i don't know anything about modeling and all those "vertex" lol but i will try to take a look to when i will have more time
    I dont think they added anything :P

  10. #10
    Member zentre12345 is offline
    MemberRank
    May 2009 Join Date
    70Posts

    Re: Early Work on a World Editor

    hey can u give me a linck to download world editor?? does it work for any game ?

  11. #11
    Account Upgraded | Title Enabled! AccountDeleted is offline
    MemberRank
    Jul 2008 Join Date
    296Posts

    Re: Early Work on a World Editor

    The LND structure is rather simple besides the texture layering which was something I was stumbled on upon trying to write a basic map viewer.

    I'll figure it out when I'm done with my PVP system/World hook though when I'm done I'll throw some of my research at you via PM.

  12. #12
    Found a place to live. Blackbox is offline
    MemberRank
    Sep 2008 Join Date
    2,412Posts

    Re: Early Work on a World Editor

    Good luck Glaphan =)

  13. #13
    Account Upgraded | Title Enabled! jason145 is offline
    MemberRank
    Sep 2008 Join Date
    My Computer, AULocation
    350Posts

    Re: Early Work on a World Editor

    Good Luck with it. :D 100% support from me.

  14. #14
    Alpha Member GlaphanKing is offline
    MemberRank
    Sep 2008 Join Date
    World of MorrowLocation
    2,594Posts

    Re: Early Work on a World Editor

    Quote Originally Posted by zentre12345 View Post
    hey can u give me a linck to download world editor?? does it work for any game ?
    No. If you want a half working editor. Find Beast.

    Quote Originally Posted by DeadlyData View Post
    The LND structure is rather simple besides the texture layering which was something I was stumbled on upon trying to write a basic map viewer.

    I'll figure it out when I'm done with my PVP system/World hook though when I'm done I'll throw some of my research at you via PM.
    Appreciate that. The maps I extracted don't really work in the editor. There are a lot of "spike mountains". I'm going to show everyone what I mean. Some heightmaps are colored differently. I might rework the code so it extracts only grayscale images. Maybe that will work better. I'll keep working on it until you throw some info my way when you are done.

    Quote Originally Posted by Blackbox View Post
    Good luck Glaphan =)
    Thanks.

  15. #15
    Valued Member Duotone is offline
    MemberRank
    Jun 2009 Join Date
    107Posts

    Re: Early Work on a World Editor

    Quote Originally Posted by GlaphanKing View Post
    There are a lot of "spike mountains".
    Try integer divide. Float divide produced me that too.



Page 1 of 2 12 LastLast

Advertisement