PDA

View Full Version : Strangeness


KingMort
06-14-2009, 03:09 PM
Well we have been having very strange issues from what I can tell looks like a Map issue perhaps? Anyway after we moved to the new server and are running in 64 bit.. Well mobs just agro right through walls... And now instead of AE's being blocked by everything (which sucked) Outdoor hills, rocks, tree's everything anyway now NOTHING blocks them...

Sucks for new players to be in the n00b zone and try and pull a mob and have 15 aggro them through the wall...

Any Ideas folks ?

King

gaeorn
06-14-2009, 06:04 PM
I'll see if I can reproduce this on my system. If so, then I should be able to track it down eventually.

KingMort
06-14-2009, 06:06 PM
Sure if you need our source let me know.. I doubt it's any of our customizations but hell you never know..

King

gaeorn
06-15-2009, 09:03 PM
I've not had a chance to look into this much thus far. I just wanted you to know I haven't forgotten about it.

gaeorn
06-18-2009, 12:29 AM
Found some significant problems with the map code for 64bit. I've made some changes but have not yet tested them. I'll post a patch as soon as I have tested.

gaeorn
06-18-2009, 01:20 AM
So, because of the problems with the way the code was written to load map files, they actually were not being loaded at all under 64bit. This patch should correct this for regular maps.

Index: zone/map.h
================================================== =================
--- zone/map.h (revision 687)
+++ zone/map.h (working copy)
@@ -56,11 +56,11 @@
}FACE, *PFACE;

typedef struct _mapHeader {
- unsigned long version;
+ uint32 version;
// unsigned long vertex_count;
- unsigned long face_count;
- unsigned short node_count;
- unsigned long facelist_count;
+ uint32 face_count;
+ uint16 node_count;
+ uint32 facelist_count;
} mapHeader;

/*
@@ -95,12 +95,12 @@
float maxx;
float maxy;

- unsigned char flags;
+ uint8 flags;
union {
- unsigned short nodes[4]; //index 0 means NULL, not root
+ uint16 nodes[4]; //index 0 means NULL, not root
struct {
- unsigned long count;
- unsigned long offset;
+ uint32 count;
+ uint32 offset;
} faces;
};
} nodeHeader, NODE, *PNODE;
@@ -111,7 +111,7 @@
#define NODE_NONE 65534
#define MAP_ROOT_NODE 0

-typedef unsigned short NodeRef;
+typedef uint16 NodeRef;

/*typedef struct _node {
nodeHeader head;
@@ -145,7 +145,7 @@
bool LineIntersectsZone(VERTEX start, VERTEX end, float step, VERTEX *result, FACE **on = NULL) const;

// inline unsigned int GetVertexNumber( ) {return m_Vertex; }
- inline unsigned int GetFacesNumber( ) const { return m_Faces; }
+ inline uint16 GetFacesNumber( ) const { return m_Faces; }
// inline PVERTEX GetVertex( int _idx ) {return mFinalVertex + _idx; }
inline PFACE GetFace( int _idx) {return mFinalFaces + _idx; }
inline PFACE GetFaceFromlist( int _idx) {return &mFinalFaces[ mFaceLists[_idx] ]; }
@@ -161,13 +161,13 @@
bool LineIntersectsZoneNoZLeaps(VERTEX start, VERTEX end, float step_mag, VERTEX *result, FACE **on);
private:
// unsigned long m_Vertex;
- unsigned long m_Faces;
- unsigned long m_Nodes;
- unsigned long m_FaceLists;
+ uint32 m_Faces;
+ uint32 m_Nodes;
+ uint32 m_FaceLists;
// PVERTEX mFinalVertex;
PFACE mFinalFaces;
PNODE mNodes;
- unsigned long *mFaceLists;
+ uint32 *mFaceLists;


int mCandFaces[100];
Index: zone/Map.cpp
================================================== =================
--- zone/Map.cpp (revision 687)
+++ zone/Map.cpp (working copy)
@@ -119,11 +119,11 @@
if(head.version != MAP_VERSION) {
//invalid version... if there really are multiple versions,
//a conversion routine could be possible.
- printf("Invalid map version 0x%lx\n", head.version);
+ printf("Invalid map version 0x%lx\n", (unsigned long)head.version);
return(false);
}

- printf("Map header: %lu faces, %u nodes, %lu facelists\n", head.face_count, head.node_count, head.facelist_count);
+ printf("Map header: %lu faces, %u nodes, %lu facelists\n", (unsigned long)head.face_count, (unsigned int)head.node_count, (unsigned long)head.facelist_count);

m_Faces = head.face_count;
m_Nodes = head.node_count;
@@ -134,24 +134,24 @@
// mFinalVertex = new VERTEX[m_Vertex];
mFinalFaces = new FACE [m_Faces];
mNodes = new NODE[m_Nodes];
- mFaceLists = new unsigned long[m_FaceLists];
+ mFaceLists = new uint32[m_FaceLists];

// fread(mFinalVertex, m_Vertex, sizeof(VERTEX), fp);

//this was changed to this loop from the single read because valgrind was
//hanging on this read otherwise... I dont pretend to understand it.
#ifdef SLOW_AND_CRAPPY_MAKES_VALGRIND_HAPPY
- unsigned long r;
+ uint32 r;
for(r = 0; r < m_Faces; r++) {
if(fread(mFinalFaces+r, sizeof(FACE), 1, fp) != 1) {
- printf("Unable to read %lu faces from map file, got %lu.\n", m_Faces, r);
+ printf("Unable to read %lu faces from map file, got %lu.\n", (unsigned long)m_Faces, (unsigned long)r);
return(false);
}
}
#else
- unsigned long count;
+ uint32 count;
if((count=fread(mFinalFaces, sizeof(FACE), m_Faces , fp)) != m_Faces) {
- printf("Unable to read %lu face bytes from map file, got %lu.\n", m_Faces, count);
+ printf("Unable to read %lu face bytes from map file, got %lu.\n", (unsigned long)m_Faces, (unsigned long)count);
return(false);
}
#endif
@@ -159,27 +159,27 @@
#ifdef SLOW_AND_CRAPPY_MAKES_VALGRIND_HAPPY
for(r = 0; r < m_Nodes; r++) {
if(fread(mNodes+r, sizeof(NODE), 1, fp) != 1) {
- printf("Unable to read %lu nodes from map file, got %lu.\n", m_Nodes, r);
+ printf("Unable to read %lu nodes from map file, got %lu.\n", (unsigned long)m_Nodes, (unsigned long)r);
return(false);
}
}
#else
if(fread(mNodes, sizeof(NODE), m_Nodes, fp) != m_Nodes) {
- printf("Unable to read %lu nodes from map file.\n", m_Nodes);
+ printf("Unable to read %lu nodes from map file.\n", (unsigned long)m_Nodes);
return(false);
}
#endif

#ifdef SLOW_AND_CRAPPY_MAKES_VALGRIND_HAPPY
for(r = 0; r < m_FaceLists; r++) {
- if(fread(mFaceLists+r, sizeof(unsigned long), 1, fp) != 1) {
- printf("Unable to read %lu face lists from map file, got %lu.\n", m_FaceLists, r);
+ if(fread(mFaceLists+r, sizeof(uint32), 1, fp) != 1) {
+ printf("Unable to read %lu face lists from map file, got %lu.\n", (unsigned long)m_FaceLists, (unsigned long)r);
return(false);
}
}
#else
- if(fread(mFaceLists, sizeof(unsigned long), m_FaceLists, fp) != m_FaceLists) {
- printf("Unable to read %lu face lists from map file.\n", m_FaceLists);
+ if(fread(mFaceLists, sizeof(uint32), m_FaceLists, fp) != m_FaceLists) {
+ printf("Unable to read %lu face lists from map file.\n", (unsigned long)m_FaceLists);
return(false);
}
#endif
@@ -188,7 +188,7 @@
/* mRoot = new NODE();
RecLoadNode(mRoot, fp );*/

- unsigned long i;
+ uint32 i;
float v;
for(i = 0; i < m_Faces; i++) {
v = Vmax3(x, mFinalFaces[i].a, mFinalFaces[i].b, mFinalFaces[i].c);
@@ -210,7 +210,7 @@
if(v < _minz)
_minz = v;
}
- printf("Loaded map: %lu vertices, %lu faces\n", m_Faces*3, m_Faces);
+ printf("Loaded map: %lu vertices, %lu faces\n", (unsigned long)m_Faces*3, (unsigned long)m_Faces);
printf("Map BB: (%.2f -> %.2f, %.2f -> %.2f, %.2f -> %.2f)\n", _minx, _maxx, _miny, _maxy, _minz, _maxz);
return(true);
}
@@ -454,7 +454,7 @@
unsigned long i;

PFACE cur;
- const unsigned long *cfl = mFaceLists + _node->faces.offset;
+ const uint32 *cfl = mFaceLists + _node->faces.offset;

for(i = 0; i < _node->faces.count; i++) {
if(*cfl > m_Faces)
@@ -508,7 +508,7 @@
//
for(zAttempt=1; zAttempt<=2; zAttempt++) {

- const unsigned long *cfl = mFaceLists + _node->faces.offset;
+ const uint32 *cfl = mFaceLists + _node->faces.offset;

#ifdef DEBUG_BEST_Z
printf("Start finding best Z...\n");


I have a patch to get water maps to load, but when I use it, I get segfaults when it starts to check if the character is in water or not. I'm still working on it.

gaeorn
06-18-2009, 01:33 AM
A minor correction to the prior patch:

--- eqemu64/zone/map.h 2009-06-17 22:21:42.000000000 -0700
+++ EQEmuServer/zone/map.h 2009-06-17 22:22:24.000000000 -0700
@@ -145,7 +145,7 @@
bool LineIntersectsZone(VERTEX start, VERTEX end, float step, VERTEX *result, FACE **on = NULL) const;

// inline unsigned int GetVertexNumber( ) {return m_Vertex; }
- inline uint16 GetFacesNumber( ) const { return m_Faces; }
+ inline uint32 GetFacesNumber( ) const { return m_Faces; }
// inline PVERTEX GetVertex( int _idx ) {return mFinalVertex + _idx; }
inline PFACE GetFace( int _idx) {return mFinalFaces + _idx; }
inline PFACE GetFaceFromlist( int _idx) {return &mFinalFaces[ mFaceLists[_idx] ]; }

gaeorn
06-18-2009, 01:34 AM
Here's a patch for water maps.

Index: zone/watermap.h
================================================== =================
--- zone/watermap.h (revision 687)
+++ zone/watermap.h (working copy)
@@ -22,11 +22,11 @@

#pragma pack(1)
typedef struct ZBSP_Node {
- long node_number;
+ sint32 node_number;
float normal[3], splitdistance;
- long region;
- int special;
- long left, right;
+ sint32 region;
+ sint32 special;
+ sint32 left, right;
} ZBSP_Node;
#pragma pack()

@@ -43,7 +43,7 @@

public:
static WaterMap* LoadWaterMapfile(const char* in_zonename, const char *directory = NULL);
- WaterRegionType BSPReturnRegionType(long node_number, float y, float x, float z) const;
+ WaterRegionType BSPReturnRegionType(sint32 node_number, float y, float x, float z) const;
bool InWater(float y, float x, float z) const;
bool InLava(float y, float x, float z) const;

Index: zone/watermap.cpp
================================================== =================
--- zone/watermap.cpp (revision 687)
+++ zone/watermap.cpp (working copy)
@@ -41,7 +41,7 @@
}


-WaterRegionType WaterMap::BSPReturnRegionType(long node_number, float y, float x, float z) const
+WaterRegionType WaterMap::BSPReturnRegionType(sint32 node_number, float y, float x, float z) const
{
float distance;

gaeorn
06-22-2009, 05:45 PM
Well we have been having very strange issues from what I can tell looks like a Map issue perhaps? Anyway after we moved to the new server and are running in 64 bit.. Well mobs just agro right through walls... And now instead of AE's being blocked by everything (which sucked) Outdoor hills, rocks, tree's everything anyway now NOTHING blocks them...

Sucks for new players to be in the n00b zone and try and pull a mob and have 15 aggro them through the wall...

Any Ideas folks ?

King

Did the above patches resolve the problems you were seeing?

KingMort
06-25-2009, 03:47 PM
Not sure yet hopefully... We are in the process now of upgrading to the newest build.. So should put that in when that happens...

Thanks a ton for the help , I will let you know how it goes..

King

gaeorn
06-25-2009, 04:29 PM
The above patches are in the SVN repo now. KLS was kind enough to integrate some of my 64bit patches into the code base.

KingMort
06-26-2009, 01:47 PM
Sweet ! Suprised more people haven't encountered stuff like this or are we the only ones in the community compiling with 64bit ?? I haven't heard a word from VZ/TZ even though they also upgraded to a 64 bit system... They have given us no input which makes me believe they compiled with 32bit...

King

gaeorn
06-26-2009, 04:30 PM
Sweet ! Suprised more people haven't encountered stuff like this or are we the only ones in the community compiling with 64bit ?? I haven't heard a word from VZ/TZ even though they also upgraded to a 64 bit system... They have given us no input which makes me believe they compiled with 32bit...

King

They very well may have. I have not seen any indications of people running 64bit servers on a regular basis. I think I'm the first to be stubborn enough to try to fix the 64bit bugs rather than going back to a 32bit compile.

So you know, I have my repository of the 64bit code available at:
svn checkout https://www.tsahosting.net/svn/eqemu64/trunk eqemu64

It has all the patches I have come up with for 64bit already applied. I generally keep it within a day of the upstream trunk SVN changes. You can see what revision it is up to by checking the log:
svn log https://www.tsahosting.net/svn/eqemu64/trunk

It has quite a number of additional patches, including makefile changes, to get it to compile and run cleanly for me. And I keep updating it as I find additional issues.

staticmg
07-08-2009, 02:36 PM
Hey thanks for the work gaeorn, I will try and use yours on my 64 and let you know if it works.

gaeorn
07-08-2009, 04:26 PM
Hehe, I actually got busy with other things so my SVN is a little out of date at the moment. I'll see about getting it caught up.

gaeorn
07-08-2009, 04:44 PM
Ok, it's up to date again :D

staticmg
07-08-2009, 04:48 PM
thanks for the heads up!

staticmg
07-13-2009, 12:38 AM
gaeorn,

Thank you again, I was finally able to get my 64bit Debian running tonight after a lot of work. Still much more to do but was finally able to log in and run around. I am getting some rule_errors but I don't think they will hurt.

Thanks everyone who puts so much time and help into this project. I have been following this forum for many years and finally set my mind to getting this going. I learned so much in this process, I hope to be able to help contribute in the future.

You guys rock!