Hey everyone, I'm back to update you all on my development.
The week ago, I had a weird issue with my source. From previous problems, I learned that sending an invalid packet to NetDragon's Conquer Online client will do nothing (if the packet body is incorrect) or disconnect it (if the packet header is incorrect). The problem I experienced a week ago, however, disconnected the client on random valid packets. This led me to conclude that I was sending corrupted packets to the client at random times. Upon further investigation, I found that my send method wasn't thread-safe because the cipher algorithm in use by the client and server wasn't thread-safe. By adding a queue, I was able to create a worker for sending packets to the client in sequence. I had to set it up in this manor because the algorithm encrypts data in sequence using a counter. With a thread-safe worker working on sending packets correctly, I was able to focus my attention back to what I was working on: NPC (Non-Playable Character) spawns. NPCs now spawn in the world and using an Iron Python scripting engine I imported from a previous project I wrote, I was able to quickly make them talk. I'm very thankful that I wrote the engine for universal use. It takes 120 to 240 milliseconds to initialize (similar to NetDragon's MySQL method which I reproduced for research), but once initialized, it only takes between 1 and 2 milliseconds to read a script. That allows me to have efficient, dynamic NPC dialogs that I can code during runtime. Here's a picture.
[Only registered and activated users can see links. Click Here To Register...]
EDIT: Btw, the NPC dialog here was fixed of my small grammar mistake.
A few days ago, I started working on items. First, I started with the item information packet. By sending the packet, I was able to successfully show the item in the client. Next, I worked on the statistics behind items (the item types and plus information). I created a table in the database and imported the types from the client's itemtype.dat file. It took me a while to ensure that I knew what each field represented. After creating the database handler for item types, I combined the packet with an item type and plus information entry in a wrapper class. The class handles saving of the item upon change (similar to my character class) and handles statistics about the item's base type. Sending the item to the client is easy after that. Upon change, the packet is changed as well, making for a clean and accurate send (because the packet is already constructed). Then, I worked on the character's inventory. The inventory class manages item creation (inserting it into the database). It also manages deleting items and updating them as variables change. With the inventory complete, I worked on loading the items upon login. Now, the character has a working inventory.
[Only registered and activated users can see links. Click Here To Register...]
Next, I'll be working on shops (so the character can buy items). I've been playing around a little with my NPCs as well. I really hate the way TQ has clumped them together in random locations. I'll be changing that as I develop.
That's it for now.
Cheers,
Spirited Fang