vbGore Free Online RPG Engine

Revolutionizing Visual Basic ORPG Development
It is currently Wed May 22, 2013 3:55 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 39 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Charindex = 0 Client crash
PostPosted: Sun May 11, 2008 4:23 am 
Bytewise Operator

Joined: Sat Oct 27, 2007 5:17 am
Posts: 139
Every so often I'll run into this error when changing maps. The error highlights

Charlist(charindex) = Emptychar

where charindex = 0, and the subscript is of course out of range.

this is in the engine_char_make sub, and I can't seem to track it down. It just comes on randomly out of nowhere, maybe 1 out of 100 times that I change maps. Anyone else ever get this?

Also still trying to fix the ip bug, where the user logs in with a different IP than last time and the whole server crashes.


Top
 Profile  
 
 Post subject: Re: Charindex = 0 Client crash
PostPosted: Sun May 11, 2008 5:55 am 
Aleron Coder

Joined: Fri Jan 05, 2007 5:36 am
Posts: 2964
Location: Germany
well,
this is...interesting

Char_Make?

So it has an error reading the userindex maybe?

When i track down a bug i spam my code with debug.print
have my client run windowed

and debug.printing all important values to me in each function i believe can be important.
checking 1 point at a time,
minimizing the possibilities till you have 1 left ;)


Top
 Profile  
 
 Post subject: Re: Charindex = 0 Client crash
PostPosted: Sun May 11, 2008 7:25 am 
Bytewise Operator

Joined: Tue Jan 08, 2008 7:31 pm
Posts: 127
Location: Phoenix, AZ.
did you change anything on the packets or anything for players or npcs?


Top
 Profile  
 
 Post subject: Re: Charindex = 0 Client crash
PostPosted: Sun May 11, 2008 2:03 pm 
Bytewise Operator

Joined: Sat Oct 27, 2007 5:17 am
Posts: 139
Well...as far as changes, it's a complete game, so there's as much new code as there was original code. But this bug is something I was getting a long time ago before most of my changes. And since the problem shows up so rarely, (probably more like 1 in several hundred times since I can't recreate it, or even 1 in several thousand times) it makes it really hard to track down even with debug statements everywhere.

here's what I'm looking into:

Did I have a summon at the time? Perhaps the charindex was supposed to be for the summon, and the error lies there. I can't remember if I had a summon last time it happened, unfortunately. Also, the routine gets called by makecharcached, so maybe something to do with that?

It might be something I added, but it doesn't seem to have any connections to my code. I know a lot of people get that random map changing crash once in awhile, maybe this is the reason.


Top
 Profile  
 
 Post subject: Re: Charindex = 0 Client crash
PostPosted: Sun May 11, 2008 2:16 pm 
Bytewise Operator

Joined: Tue Jan 08, 2008 7:31 pm
Posts: 127
Location: Phoenix, AZ.
the routine is called on NPC creation also. So make sure you are getting all the data your suppose to.


Top
 Profile  
 
 Post subject: Re: Charindex = 0 Client crash
PostPosted: Sun May 11, 2008 9:28 pm 
Bytewise Operator

Joined: Sat Oct 27, 2007 5:17 am
Posts: 139
when you say the routine is called on npc creation, you mean where it calls the makecharcached right? That's what I was talking about in my last post, sorry I didn't make it clear. The thing is that there's nothing wrong in npc_makechar either, I haven't changed that part at all. Anyhow, does anyone have a suggestion on how to fix this? the problem is that recreating the error takes forever, and when it happens I can't trace the data back to anywhere it might be going wrong. Everything looks perfectly fine, and no code I've added should be affecting character creation at all. If it is something I added, does anyone real knowledgeable on how vbgore handles character creation (especially the cache, where I think my problem lies) have any suggestions on what kind of thing might cause this?

edit: figured it out, for anyone interested. I eventually got other random errors popping up that suggested a packet was messed up somewhere. I tracked it down, and sure enough I was killing my buffer with some messy packets. All fixed now.


Top
 Profile  
 
 Post subject: Re: Charindex = 0 Client crash
PostPosted: Sat May 17, 2008 4:44 am 
Bytewise Operator

Joined: Sat Oct 27, 2007 5:17 am
Posts: 139
Well turns out fixing my packets solved other problems, but not this one. I just got it again today. I got it in the same spot as last time, changing maps to my most npc filled map. The code still looks perfectly fine, and the error only shows up randomly, regardless of any other variables. So is what I suggested earlier possible, that I run out of cache space so it comes up with the error after makecharcached gets called? It would make sense since its the map with the most npcs, maybe they all get stored in cache and it runs out of space if its already low from other programs/maps etc. Anyone know if this is possible?

Edit: its def not the cache, I got the error again and looked at all the variables. The character being made was an npc with nothing special about it, just a typical walk around town npc. the error originated in Data_Server_MakeChar, not makecharcached. its body was read correctly in Data_Server_MakeChar but everything after that was received as zero, so for some reason the server didn't send it right. Still no idea why though. The server is sending a whole lot of information with all those npcs on my map (happened on same map again), maybe that has something to do with it? nothing wrong with the code, I suppose a packet somewhere else could still be screwy, but wouldn't I get other errors too, not just this one error showing up randomly on one map?


Top
 Profile  
 
 Post subject: Re: Charindex = 0 Client crash
PostPosted: Sun May 18, 2008 5:24 am 
Bytewise Operator

Joined: Sat Oct 27, 2007 5:17 am
Posts: 139
Still nothing, but repeated error showing the body value being sent and the rest of the values after it being messed up. Body was a different npc than last time. Does this sound like a packet problem, with only this one error showing up? I've been through every packet and they all checked out, though it is easy to miss something when searching through all the code. Am I the only one who gets this error?


Top
 Profile  
 
 Post subject: Re: Charindex = 0 Client crash
PostPosted: Sun May 18, 2008 5:30 am 
Aleron Coder

Joined: Fri Jan 05, 2007 5:36 am
Posts: 2964
Location: Germany
somewhere the function/sub is beeing called with false parameters if u ask me

assuming your packets are 100% correct


Top
 Profile  
 
 Post subject: Re: Charindex = 0 Client crash
PostPosted: Sun May 18, 2008 7:01 am 
Bytewise Operator

Joined: Sat Oct 27, 2007 5:17 am
Posts: 139
I'm really thinking it is an incorrect packet somewhere. I dunno how it would get called with false parameters, especially since it works fine 99% of the time. It would be pretty strange for the same function to get called in the same place, for the same npc, and work hundreds of times then randomly not work. That kind of randomness just sounds like a packet screwing me up, but I can't for the life of me find out where it is.

I should probably go to sleep, I'm pushing 20 hours straight pouring through endless code without accomplishing anything. But I know when I do sleep, "Charindex = 0" will haunt my dreams. Back to the code :?


Top
 Profile  
 
 Post subject: Re: Charindex = 0 Client crash
PostPosted: Sun May 18, 2008 7:51 am 
Bytewise Operator

Joined: Tue Jan 08, 2008 7:31 pm
Posts: 127
Location: Phoenix, AZ.
ya I still think on one of the packets you forgot to add something. When I added guilds to mine I forgot to put it in one spot so switching maps or when some npcs spawned it would cause an issue


Top
 Profile  
 
 Post subject: Re: Charindex = 0 Client crash
PostPosted: Sun May 18, 2008 8:23 am 
Bytewise Operator

Joined: Sat Oct 27, 2007 5:17 am
Posts: 139
Yeah I keep going through them all, just can't find where I messed up. Does it sound like I just over preallocated somewhere, and I'm getting extra empty variables?


Top
 Profile  
 
 Post subject: Re: Charindex = 0 Client crash
PostPosted: Sun May 18, 2008 9:16 am 
Bytewise Operator

Joined: Tue Jan 08, 2008 7:31 pm
Posts: 127
Location: Phoenix, AZ.
theninjamaster wrote:
Yeah I keep going through them all, just can't find where I messed up. Does it sound like I just over preallocated somewhere, and I'm getting extra empty variables?


no.... your either forgetting to send a value or your forgetting to get a value. Check all the character packets (NPC and Player) Not just the cache ones. They should all have the same number of variables being sent.


Top
 Profile  
 
 Post subject: Re: Charindex = 0 Client crash
PostPosted: Sun May 18, 2008 9:50 am 
Bytewise Operator

Joined: Sat Oct 27, 2007 5:17 am
Posts: 139
The character packets are untouched from the original vbgore, and sending all the variables they should be. If I'm missing sending or receiving one, wouldn't it always come out as zero, not just once in awhile? The same npcs that get the error load fine in the same maps 99% of the time. The character packets im almost 100% sure are okay, since they're not only the original code, but I have quadrazillion-checked them (meaning, I've checked them a LOT of times) to make sure they're perfect. Is it possible that loading too many npcs into memory at the same time is killing the buffer, or anything random like that? The maps are always my most npc filled maps that it crashes on, usually the same one (only happened on 2 other ones for one of my testers, for me its always the same big map). I still think its a packet error somewhere, somehow, but I'm looking at other stuff since I can't find anything wrong in the packets.


Top
 Profile  
 
 Post subject: Re: Charindex = 0 Client crash
PostPosted: Sun May 18, 2008 1:20 pm 
Aleron Coder

Joined: Fri Jan 05, 2007 5:36 am
Posts: 2964
Location: Germany
output every variable often with debug.print

helps you find when values are going out of order


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 39 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 8 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group