Post Pacific

Post Pacific (https://postpacific.mmorpg-game.online/index.php)
-   Lineage 2 Server Modifications ONLY! (https://postpacific.mmorpg-game.online/forumdisplay.php?f=28)
-   -   Current developments on Geodata (https://postpacific.mmorpg-game.online/showthread.php?t=278)

Digital 30.04.2005 04:34

well some c3 maps' /loc using l2j...
apparently not really correct :p

这是从SYL的JAVA版服务端里抄出来的,å œ¨这要谢谢SYL大大


三章地区

-84460 111315 -3135 黎明之神殿

-84700 87200 -3430 黄昏之神殿

-41570 209666 -5086 苦行者之地下古墓

45990 127215 -3645 祭品之地下古墓

109710 173900 -3445 烈士之地下古墓

-26255 77395 -3360 巡礼者之地下古墓

-55310 79890 -3030 圣者之地下古墓

112625 131860 -2870 殉教者之地下古墓

81190 209095 -3670 参拜者之地下古墓

169755 -17955 -3130 使徒之地下古墓

43135 171270 -3670 凶兆之地下宫殿

39615 144475 -3595 异端者之地下宫殿

74059 77240 -3335 烙印之地下宫殿

137290 78530 -3465 异教徒之地下宫殿

-22150 13650 -3150 密启之地下宫殿

110630 82285 -2860 魔道之地下宫殿

Stazis 30.04.2005 05:55

one more idea how to get layer 00 data

there is an ValidatePosition packet in protocol wich makes client to report current pawn position.

What is to write a program teleporting a character point by point with step of 128 and getting data from this ValidatePosition packet.

One of L2J developers i know just collects this data but not forced.

His players just play the game and one of java-classes hooks the data from packets.

flakka 30.04.2005 06:49

I was thinking about something. How does L2J do it? There's no geodata files for the emu, yet you can freely walk on the surfaces as long as you have the client that supports the areas. Maybe it will be easier to convert that string of code and find out how to make it tick? It would probably save a lot of trouble in the long run when clients get updated as well.

Just a thought. Someone slap me if I'm talking out of my ass. :P

yellowperil 30.04.2005 06:55

from what I beleive l2j has items and mobs falling through the floor, also if a mob has to change its hieght to much, it also has problems.

I dont know if these were fixed or not now though.

flakka 30.04.2005 07:22

Well they disabled the keyboard movement functions, so it's all pretty much fixed. The problem was the world collision boxes they were having with the Z axis. When you used the keyboard to move and then stop, your character would skip one step forward and fall through. Same with the loot. It didn't calculate the Z axis where the mob was so when it spawned items, it dropped through. It's something they could never fix, so they just disabled them I guess. :roll:

Now here's something interesting.

Code:

package net.sf.l2j.gameserver.clientpackets;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

import net.sf.l2j.gameserver.ClientThread;
import net.sf.l2j.gameserver.Connection;
import net.sf.l2j.gameserver.model.L2MonsterInstance;
import net.sf.l2j.gameserver.model.L2Object;
import net.sf.l2j.gameserver.model.L2PcInstance;
import net.sf.l2j.gameserver.model.L2World;
/**
 * This class ...
 *
 * @version $Revision: 1.13 $ $Date: 2004/10/05 20:02:47 $
 */
public class ValidatePosition extends ClientBasePacket
{
        private static Logger _log = Logger.getLogger(ValidatePosition.class.getName());
        private static final String _C__48_VALIDATEPOSITION = "[C] 48 ValidatePosition";
        /**
        * packet type id 0x48
        * format:                cddddd
        * @param decrypt
        */
        public ValidatePosition(byte[] decrypt, ClientThread client) throws IOException
        {
                super(decrypt);
                int x  = readD();
                int y  = readD();
                int z  = readD();
                int heading  = readD();
                int data  = readD();
               
               
                L2PcInstance activeChar = client.getActiveChar();
                if (activeChar != null)
                {
                        Connection con = client.getConnection();
                       
                        int realX = activeChar.getX();               
                        int realY = activeChar.getY();               
                        int realZ = activeChar.getZ();               
                        int realHeading = activeChar.getHeading();
                       
                        //TODO we have to trust the client on the z-coord right now, so just copy the value we got back
                        activeChar.setZ(z);
                       
                        //                _log.fine("client pos: "+ x + " "+y+ " "+z +" head "+heading);
                        //                _log.fine("server pos: "+ realX + " "+realY+ " "+realZ +" head "+realHeading);
                       
                        // check for objects that are now out of range
                        activeChar.updateKnownCounter += 1;
                        if (activeChar.updateKnownCounter >3)
                        {
                                int delete = 0;
                                List known = activeChar.getKnownObjects();
                                ArrayList toBeDeleted = new ArrayList();
                               
                                for (int i = 0; i < known.size(); i++)
                                {
                                        L2Object obj = (L2Object) known.get(i);
                                        if (distance(activeChar, obj) > 4000*4000)
                                        {
                                                toBeDeleted.add(obj);
                                                delete++;
                                        }
                                }
                               
                                if (delete >0)
                                {
                                        for (int i = 0; i < toBeDeleted.size(); i++)
                                        {
                                                activeChar.removeKnownObject((L2Object) toBeDeleted.get(i));
                                                if (toBeDeleted.get(i) instanceof L2MonsterInstance)
                                                {
                                                        ((L2MonsterInstance)toBeDeleted.get(i)).removeKnownObject(activeChar);
                                                }
                                                else
                                                {
                                                        ((L2Object)toBeDeleted.get(i)).removeKnownObject(activeChar);
                                                }
                                               
                                        }
                                        _log.fine("deleted " +delete+" objects");
                                }
                               
                               
                                // check for new objects that are now in range
                                int newObjects = 0;
                                L2Object[] visible = L2World.getInstance().getVisibleObjects(activeChar, 3000);
                                for (int i = 0; i < visible.length; i++)
                                {
                                        if (! activeChar.knownsObject(visible[i]))
                                        {
                                                activeChar.addKnownObject(visible[i]);
                                                visible[i].addKnownObject(activeChar);
                                                newObjects++;
                                        }
                                }
                               
                                if (newObjects >0)
                                {
                                        _log.fine("added " + newObjects + " new objects");
                                }
                                activeChar.updateKnownCounter = 0;       
                        }
                }
        }
       
       
        private long distance(L2Object a, L2Object b)
        {
                long dX = a.getX() - b.getX();
                long dY = a.getY() - b.getY();
                return ( dX*dX + dY*dY );
        }
       
        /* (non-Javadoc)
        * @see net.sf.l2j.gameserver.clientpackets.ClientBasePacket#getType()
        */
        public String getType()
        {
                return _C__48_VALIDATEPOSITION;
        }
       
}

I know java sucks, but maybe we can use L2J's coding to our advantage, LOL. Here's the thing. Maybe we can use the code looking at the geodata files and strip it down and use L2J's coordinates code to go back and forth from the client and the server? It sounds simple, but maybe it's doable? We could use the code the guy made for the L2 C# and see where he changed it and maybe apply them. I think it would be more functional and less of a hassle than stripping down the geodata files. I can't make any friggin sense from those files, lol.

I'll dig more info up and see if I can find something. :D

[highlight=red:d78ab1de78]EDIT[/highlight:d78ab1de78] Whoa... I found some stuff.:D

Here's what the guy put in the C# server code for ValidatePosition. As you can see, it's 100x better than the java code, using real mathematical equations.

Code:

using System;
using net.sf.l2cs.logging;
using net.sf.l2cs.gameserver.l2class;

namespace net.sf.l2cs.gameserver.clientpackets
{
        /// <summary>
        /// Summary description for ValidatePosition.
        /// </summary>
        public class ValidatePosition:ClientBasePacket
        {
                private const string _C__48_VALIDATEPOSITION = "[C] 48 ValidatePosition";
                private int[][] testarea = new int[][]
                {
                        new int[]{-72791,257365},
                        new int[]{-72099,256792},
                        new int[]{-72256,256529},
                        new int[]{-73011,257148}
                };
                public ValidatePosition(byte[] decrypt, ClientThread client):base(decrypt)
                {
                        int x  = ReadD();
                        int y  = ReadD();
                        int z  = ReadD();
                        client.ActiveChar.X = x;
                        client.ActiveChar.Y = y;
                        client.ActiveChar.Z = z;
                }
                /// <summary>
                /// Reference from http://ouray.cudenver.edu/~na0alber/computational_geometry/Project.htm
                /// </summary>
                /// <param name="x"></param>
                /// <param name="y"></param>
                /// <param name="area"></param>
                /// <returns></returns>
                public bool CheckInArea(int x, int y, int[][] area)
                {
                        int i=0, j=0;
                        double angle = 0.0;
                        double cross_product = 0.0;
                        double magnitude1, magnitude2;
                        double temp0x, temp0y;
                        double temp1x, temp1y;
                        for(i = 0; i < area.Length; i++)
                        {
                                j++;
                                if (j==area.Length) j = 0;
                                // the following will make equations more readable below
                                temp0x = area[i][0] - x;
                                temp0y = area[i][1] - y;
                                temp1x = area[j][0] - x;
                                temp1y = area[j][1] - y;
                                // check to see if test point is same as vertex
                                if((temp0x == 0 && temp0y == 0) || (temp1x == 0 && temp1y == 0))return true;
                                // calculate the dot product and magnitudes for equation
                                cross_product = (temp0x * temp1x) + (temp0y * temp1y);
                                magnitude1 = Math.Sqrt(Math.Pow(temp0x,2) + Math.Pow(temp0y,2));
                                magnitude2 = Math.Sqrt(Math.Pow(temp1x,2) + Math.Pow(temp1y,2));
                                // check to see if turning left or right
                                if (((temp0x * temp1y) - (temp1x * temp0y)) > 0.0  )

                                {

                                        angle += Math.Acos((double)cross_product/(magnitude1*magnitude2));

                                }

                                else

                                {

                                        angle -= Math.Acos((double)cross_product/(magnitude1*magnitude2));

                                }

 

                        }

                        angle /= 2*Math.PI;

                        angle = Math.Abs(angle);

 
                        if (angle > 0.0001) // angle should be close to zero if point outside

                        {

                                return true;

                        }

                        else

                        {

                                return false;

                        }

 

                }

                public override string GetType()
                {
                        return _C__48_VALIDATEPOSITION;
                }
        }
}

As you know, he converted the L2J stuff to C#. Now if you look at this code, you'll notice this website, it starts to make a bit more sense. He used this equation.
http://ouray.cudenver.edu/~na0alber/...ry/Project.htm

Now is there any way we can disassemble the server.exe or perhaps compare the two? I have no clue about VS or how to use it... yet. :D Can someone maybe check out the older post I made in the General section of the modders forum so they can maybe let me know if I'm talking out of my ass? LOL. :shock:

badjoe 01.05.2005 10:20

Quote:

Originally Posted by Digital
http://bbs.99nets.com/attachment/42_84716.jpg

some interesting stuff. lol...
oh well... i suppose the data is read from left to right... top down.

only 4 layers for ToI ? Oo

yellowperil 01.05.2005 16:17

the main issue here in not in the exe files, but were we can extract the data from.
Reading through this post you can see we are almost 90% sure how the data file is created, the next main step would be to find a way to extract this information out into a file that can then be converted into a conv.dat

I have spoken to digital abou this, and we cam to the same conclusion, its gonna be tough extracting this data.

For example if we can get each layers out as an image, not a B&W one, but a grayscal hieght map image for each layer (this would give us the max and minimum hieght for that layer), we can really move forward on this, as I believe vaskes has already been able to convert some data from a table like this already.

Until we can get our hands on this type of data, we are gonna end up running around in circles.

The only other possible solution I could come up with, is for a bot to walk the entire area and log each and every walkable x,y,z. then we could xtract the data we need and convert it into the conv.dat.

Anyways I aint supposed to be here atm, see you in a couple of days.

Yellowperil

Digital 09.05.2005 11:12

thx to torune

on lv2 map maker... lets look thru this shall we :)

/*
MAP GENERATOR V1.0
CODED BY TORUNE(torune @ gmail . com)
*/
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
#include <stdio.h>

int main () {

int MAP_HEIGHT[] = {
//38-3F
(0xE318E318), (0xE46DE46D), (0xE5C2E5C2), (0xE717E717),
(0xE86CE86C), (0xE9C1E9C1), (0xEB16EB16), (0xec6bec6b),
//40-4f
(0xedc0edc0), (0xef15ef15), (0xf06af06a), (0xf1bff1bf),
(0xf314f314), (0xf469f469), (0xf5bef5be), (0xf713f713),
(0xf868f868), (0xf9bdf9bd), (0xfb12fb12), (0xfc67fc67),
(0xfdbcfdbc), (0xff11ff11), (0x00670067), (0x01bc01bc),
//50-5f
(0x03110311), (0x04660466), (0x05bb05bb), (0x07100710),
(0x08650865), (0x09ba09ba), (0x0b0f0b0f), (0x0c640c64),
(0x0db90db9), (0x0f0e0f0e), (0x10631063), (0x11b811b8),
(0x130d130d), (0x14621462), (0x15b715b7), (0x170c170c),
//60-6f
(0x18611861), (0x19b619b6), (0x1b0b1b0b), (0x1c601c60),
(0x1db51db5), (0x1f0a1f0a), (0x205f205f), (0x21b421b4),
(0x23092309), (0x245e245e), (0x25b325b3), (0x27082708),
(0x285d285d), (0x29b229b2), (0x2b072b07), (0x2c5c2c5c),
//70-7f
(0x2db12db1), (0x2f062f06), (0x305b305b), (0x31b031b0),
(0x33053305), (0x345a345a), (0x35af35af), (0x37043704),
(0x38593859), (0x39ae39ae), (0x3b033b03), (0x3c583c58),
(0x3dad3dad), (0x3f023f02), (0x40574057), (0x41ac41ac),
//80-8f
(0x43014301), (0x44564456), (0x45ab45ab), (0x47004700),
(0x48554855), (0x49aa49aa), (0x4aff4aff), (0x4c544c54),
(0x4da94da9), (0x4efe4efe), (0x50535053), (0x51a851a8),
(0x52fd52fd), (0x54525452), (0x55a755a7), (0x56fc56fc),
//90-9f
(0x58515851), (0x59a659a6), (0x5afb5afb), (0x5c505c50),
(0x5da55da5), (0x5efa5efa), (0x604f604f), (0x61a461a4),
(0x62f962f9), (0x644e644e), (0x65a365a3), (0x66f866f8),
(0x684d684d), (0x69a269a2), (0x6af76af7), (0x6c4c6c4c),
//a0-a5
(0x6da16da1), (0x6ef66ef6), (0x704b704b), (0x71a071a0),
(0x72F572F5), (0x744A744A)
};

int RGB[] = {
//0x3
(0x38), (0x39), (0x3a), (0x3b), (0x3C), (0x3D), (0x3E), (0x3F),
//0x4
(0x40), (0x41), (0x42), (0x43), (0x44), (0x45), (0x46), (0x47),
(0x48), (0x49), (0x4a), (0x4b), (0x4c), (0x4d), (0x4e), (0x4f),
//0x5
(0x50), (0x51), (0x52), (0x53), (0x54), (0x55), (0x56), (0x57),
(0x58), (0x59), (0x5a), (0x5b), (0x5c), (0x5d), (0x5e), (0x5f),
//0x6
(0x60), (0x61), (0x62), (0x63), (0x64), (0x65), (0x66), (0x67),
(0x68), (0x69), (0x6a), (0x6b), (0x6c), (0x6d), (0x6e), (0x6f),
//0x7
(0x70), (0x71), (0x72), (0x73), (0x74), (0x75), (0x76), (0x77),
(0x78), (0x79), (0x7a), (0x7b), (0x7c), (0x7d), (0x7e), (0x7f),
//0x8
(0x80), (0x81), (0x82), (0x83), (0x84), (0x85), (0x86), (0x87),
(0x88), (0x89), (0x8a), (0x8b), (0x8c), (0x8d), (0x8e), (0x8f),
//0x9
(0x90), (0x91), (0x92), (0x93), (0x94), (0x95), (0x96), (0x97),
(0x98), (0x99), (0x9a), (0x9b), (0x9c), (0x9d), (0x9e), (0x9f),
//0xA
(0xa0), (0xa1), (0xa2), (0xa3), (0xa4), (0xa5)
};
char BREAK = '00';
char MAP_HEAD[] = { 22, 25, 128};
char MAP_NAME[] = "output_conv.dat";
int HEADER[] = {0x00001000,0x00,0x00000100,0x00000100};
int count = 0;
int ch;
char BmpFile[256] = "lineage2.bmp";

ifstream fin(BmpFile, ios::binary);
ofstream fout(MAP_NAME, ios::binary);

fout.write((char *)(&MAP_HEAD),MAP_HEAD);
fout.write((char *)(&HEADER),HEADER);
while (!fin.eof()) {

ch = fin.get();
count++;
if (count >= 52){
fin.get();
fin.get();
for (int i = 0; i < 110; i++){
if (ch == RGB[i]){
fout.write((char *)(&BREAK),BREAK);
fout.write((char *)(&MAP_HEIGHT[i]),MAP_HEIGHT[i]);
fout.write((char *)(&BREAK),BREAK);
}
}
}
}
fout.close();
}

vaskes 10.05.2005 07:22

to my mind - this is a shit. one layered simple geo

Digital 10.05.2005 08:41

yeah... we'll need to figure out 40 00 identifier block of code...
and we'll be complete with our conv.dat analysis

other than that we are doing quite well
we probably need a program that would load multiple .bmp
which could be allocated to different layers
and from that convert into conv.dat
i believe this is how ncsoft does it as well

yellowperil 10.05.2005 08:53

is each layer set at a specific height then ?
if thats the case its should be a lot easier to implement.

Digital 10.05.2005 08:56

yes i'd presume to think that way.
and 40 00 "maybe" an indictor to state
for layer01 it's aa bb cc dd
for layer02 it's ee ff gg hh
....
which would probably make more sense...
and starting from 41 00 it's all layering info.
just need someone to comfirm with me if this is the case
if so... we could make any kind of maps already :D

Rhea 15.05.2005 06:39

Okay... so... the l2 world is nothing but a big sandwich.
I've got a couple questions.
First off, they've said outright that the whole game is based off the unreal engine.
So I'm wondering, what PARTS of the engine did they use, and what parts seem modified.
The second thing is, aren't there map makers for unreal? Although I doubt they're anywhere as complex as the lineage world is, could an editor, or an adjusted editor be used to modify at least one section of the mapworld?
I'm wondering also about object placements.
Could you actually call forth various objects and place them however you please?

Say for example, you wanted to make a 'test' area in one of the unused map sections, and made what might be a 'garden of stone' useing say... various objects, and placed them around like a garden.
Is it also possible to reuse objects, but give them different textures, or would they have to be the same no matter what.
(example: put a fountain from the forgotten temple in, but change it's surface to look stony)
One other thing I don't know if you guys have addressed,
Not only is there 'water damage', but in c2 I belive people take damage from fire (blazeing swamp).
Is there a code for this in the system?

flakka 15.05.2005 07:47

Not sure if that would work because we don't have the libraries for the items they used to make the maps.

Usually, if you were able to open up the editor and make a certain area, you would need the textures and items you wanted to place in it. Just imagine it like the NeverWinter Nights world builder. You'll need those objects to place on the terrain and make sure they all have the right collision boxes attached to them.

As of now, we can go into the editor and edit the textures for the weapons and stuff because the item is basically the same - we're just adding the different skin to it. Without the libraries, I think we're pretty much screwed. :?

Dubie 22.05.2005 16:31

lol nvm Dig posted the code here ;)
my bad

Peace,
Dubie

yellowperil 23.05.2005 06:36

well heres some news, I wrote an app that can create a bmp from the info stored in a conv.dat

now if we take 00 00 as the base grayscale image, each and every map should contain 256x256 00 00 entries. Stop me if I am wrong.....

I ran my app, and discovered this IS NOT the case, every file I have tried so far does not contain 256x256 00 00 entries. I may have missid something, but I dont think so.

This could either mean that the base 00 00 layer is made up of more than just 00 00 ?

Any ideas would be nice....

Stazis 24.05.2005 00:40

Ok - wrote the code able to parse any geodata file to structures

Conclusion - only 3 types of structures are present

00 00 - following by two words (meaning of which is known already)
40 00 - following by 64 words (think 8 groups of 8 words)
>40 00 - following by substructures
Substructures are started with 01 00, 02 00 .... 09 00 following by 1,2...9 words correspondently

Words are height coordinates.

any ideas what 40 00 structure describes?

Digital 24.05.2005 02:33

yes, that's what i've came to conclusion as well stazis. :)
just that nobody had time to help proof my logic :S
imo 40 00 is definition for spliting the rest of the height into different layer slots.
that's y their data is actually stacked
e.g AA BB BB CC CC DD DD EE ....
and that'd make the layer system work
e.g 41 00 01 00 where 01 00 is AA BB BB CC
and of cuz, AA BB BB CC is the floor and ceiling for that layer :)
and that's what geodata should be.

hopefully someone would proof this theory. derived it weeks ago :S

Stazis 26.05.2005 09:18

here is my analyser - i'm not the programmer =)

[php:1:5f0e77eb5e]<?php
$m="25_12";
$i=fopen($m."_conv.dat","rb");
$o=fopen($m.".dat","w+b");
$h=fread($i,18);
fwrite($o,$h);
// init the counters
$zero=0;
$forty=0;
$un=0;
$fourx=0;
$maxd=0;
while (!feof($i)) { // start reading
$tr=fread($i,1);
$tr2=fread($i,1); // first indictor
$d=ord($tr)+ord($tr2)*256; //convert 2 bytes to word
if ($d>$maxd) $maxd=$d; // remember if is maximal indictor
switch($d) {
case 0: // 00 00
$zero++;
$data=fread($i,4); // read xx xx yy yy
fwrite($o,$tr);
fwrite($o,$tr2);
fwrite($o,$data); // write to output
break;
case 64: // 40 00
break;
$forty++;
$fr=fread($i,128); // read 64 bytes following
fwrite($o,$tr);
fwrite($o,$tr2);
fwrite($o,$fr); // write to output
break;
default: // 41 00 and ++
break;
if ($d>64 && $d<512) {
$fourx++;
$j=0;
fwrite($o,$tr); // write to output
fwrite($o,$tr2);
while ($j<$d) { // reads subindictor and its data until indictor count is not reached
$dr1=fread($i,1); // read subindictor
$dr2=fread($i,1);
$dr=ord($dr1)+ord($dr2)*256;
if ($dr>10) {echo "DR>10"; exit(); // if subindictor >10 - FAIL
}
$sd=fread($i,$dr*2);
fwrite($o,$dr1);
fwrite($o,$dr2);
fwrite($o,$sd);
$j=$j+$dr;}
} else {
echo "Unknown sig: ".$d."\n"; // raise unknown indictor failure
echo $zero." ".$forty." ".$fourx." ".$un;
exit();
}
break;
}
}
echo $zero." ".$forty." ".$fourx." ".$un."\n"; // output summary info
echo "Maximum descriptor ".$maxd;
fclose($i);
fclose($o);
?>[/php:1:5f0e77eb5e]

Digital 26.05.2005 10:50

http://xx.xx6.2xx.xx4/~digital/analyzer.php

Digital 26.05.2005 20:57

report of research on geodata headers

map 25_12
header 19 0C 80 00 10 00 DA 61 4e 00 A5 C9 00 00 3F 10 00 00

0C 19 = 25 12
00 80 = 128
00 10 = 16
00 4E 61 DA = 5136858 = Words for heights in 40 00 and 41++
00 00 C9 A5 = 51621 = 00 00 + 40 00
00 00 10 3F = 4159 = 00 00

many big thx to Stazis :)

Digital 27.05.2005 11:34

current development
http://c2hybrid.sceneoracle.com/geodata/analyzer.php

Awhite 15.06.2005 13:31

Digital, where could i get the source of that last php file ?


All times are GMT. The time now is 15:50.