Quote:
Originally Posted by Davincibg
jMerliN why are you dealing at all with the other projects? I respect you and your work and I believe that you are the only one that can create a Server-like emu, but I don't see what's the point of arguing with child about other stuff. If I were you I would've assemble a team and really work on an emu that can be as good as the original files. I don't think that working alone is perfect for you.
|
All I need is packets. Get someone to give them to me and I'll be done.
Quote:
Originally Posted by Shadowz75
those are the old version. dont you look at your vb emu , too and then you think its bad?so i dont see the point in insulting me
edit: 30+ queries?
i only see 1 query
|
Lol, that's not the code I saw on page 1. And you're using a DataSet object? That's a behemoth of a class and is quite slow on instantiation and requires you to index like 4 arrays to get what you need, each one kills performance.
Further, you're making much more rudimentary mistakes. While caching accounts is a GOOD thing in general, you have implemented it in an abhorrent manner. The array resizes and constant indexing is a bad thing, you're keeping track of many parallel and related arrays rather than creating a class or structure of some kind and keeping a simple array of them, using OOP. This would allow you to grab just the object needed and resize just 1 array, all around a large performance boost. Also, what you're doing really prevents you from multi-threading...
In what you're currently doing, I guarantee you a SQL db running locally would do inserts/selects on a DB of under 100,000 rows faster than the rest of your code executes, so while you still insert on char creation (rather than queueing those up for batch processing), you're destroying any performance caching could possibly provide. And the idea of caching isn't "mirror the database in the local application." It's "mirror the most active entries of the database in local memory." The database has that entire table loaded into memory already, in all likelihood, so you're being redundant, and a local connection would have 0 latency probably implemented with a pipe rather than a socket, so it's not much of an overhead. You should probably load the most recently used ~700 accounts into memory, then you have the concept of a cache hit and miss, if it's a miss, you have to go to the DB to get the info, then you might add it into your cache and every 20 minutes trim off the older entries, depending on how you manage memory (you might not worry about it, which is 1 approach but that lends itself to a need for maintenance, you might look at how much memory you have free and try to clear it up from places where you have cached objects, but this can also cause fragmentation of your heap(s), so it's a lot more complex a subject than just black/white).
You won't notice these issues with fewer than 100 players joining your server but when you try hosting 5000, you'll notice them, or if someone tries to attack your server, which would be easy because I could cause just 1 bit of bad code like that to become very busy starving the system of CPU (and/or memory) which could crash the server or time out users. Think big when you design something, look @ the guys working on betamax, they tried spawning and tracking millions of mobs, I suggested using a quadtree for locale and it made millions of mobs which took a lot of power to process and a long time to compute locality take almost nothing to process. Stress testing is the key to stability and efficiency; if you code like only 20 people will ever use your emulator, then in all likelihood, only 20 people will be able to use your server with any semblance of stability or speed.