[Development] KraHen`s devblog

12/06/2011 14:00 KraHen#1
Okay, so I thought I`d create a separate blog for my dev process of ProjectX and leave the other thread for everything else related to the server, such as discussions about design, gameplay, etc. I need something like this to keep reminders, etc.

So basically, if you don`t know what this is for, check out [Only registered and activated users can see links. Click Here To Register...]

About :
Source written in C# using .NET. External libraries used so far : NHibernate, CSScript. One more time, special thanks to pro4never for the packets in Albetros.

Done
  • Auth server (handles login, ban, etc.)
  • Game encryption setup
  • Characters properly saving/loading from MySQL (using NHibernate)
  • Proper login if the user has a character
  • Move/Run (no steed considered yet), have to add speedhack protection
  • Jump (have to add speedhack protection + DMap validation)
  • Screening system for Players and NPCs (this was bugging me a lot)
  • Chat (Talk, Whisper)
  • NPC loading from cq_npc using MySQL / NHibernate
  • NPC dialogs, face, options, etc. you know
  • NPC scriping using C# via CSScript
  • Item information classes (like the domains for NHibernate)
  • Item information loading from SQL
  • Item-related packets` implementation
  • Inventory
  • Item equipment (and finish the spawnpacket as well, at least the part I did finish)
  • Proficiencies
  • Sync packet, stat calculations(besides mana), stat window (for the stats I use so far)

Latest screenshot
[Only registered and activated users can see links. Click Here To Register...]

Latest addition
External scripting for NPCs using C#. Here`s how the first script looks like :
PHP Code:

using System
;
using ProjectXGame;
using ProjectXGame.NPC;
using ProjectXGame.Client;


    public class 
NPCScript
    
{
        
// GuildChief in Twin City
        
private byte m_Face 6;    // Face nr - avatar
        
public byte Face() { return m_Face;}

        public 
void Execute(byte linkPlayerNPCHandler NPC)
        {
            switch (
link)
            {
                case 
0:
                    {
                        
NPC.AddTextLine("Welcome, " NPC.MyClient.Character.Data.Name "! I was sent here to aid developers with their needs! What can I help you with?");
                        
NPC.AddOption("KraHen`s TODO list"2);
                        
NPC.AddOption("Nothing, thanks."255);
                        break;
                    }
                case 
2:
                    {
                        
NPC.AddTextLine("TODO : " Kernel.TODO);
                        
NPC.AddOption("Thanks."255);
                        break;
                    }
            }
            
NPC.SendNPCData();
        }
    } 
SOON-TODO list - stuff I plan to implement in the near future
  • Portals
  • DMap support for setting the client`s location, also portal validation so there`s no teleport exploit using this
  • Attack handler - melee, weapon skills
12/06/2011 14:32 BaussHacker#2
Without you it wouldn't be this far :3<3
12/06/2011 23:00 Spirited#3
Looks bad-ass. =p It's scary seeing more and more people knowing how to code well.
Tell me more about how you're doing things.
12/06/2011 23:05 BaussHacker#4
Quote:
Originally Posted by Fаng View Post
Looks bad-ass. =p It's scary seeing more and more people knowing how to code well.
Tell me more about how you're doing things.
Lol. He was a good coder, before you joined this community :P
12/06/2011 23:15 Spirited#5
Quote:
Originally Posted by BaussHacker View Post
Lol. He was a good coder, before you joined this community :P
Mk. Well he's better than he was when I first saw him.
12/06/2011 23:16 pro4never#6
Looking good. You mentioned you're using npcs from binaries though. I assume that's just to fill in missing npcs cause then you go on to show a custom scripting system you're writing so I'm a tad confused there ahah.

Looks nice though ^^.
12/07/2011 10:20 KraHen#7
Let me explain a bit clearer, lol. I`m using the binary database (cq_npc) for the NPC spawns only.

And don`t praise my skills until this gets tested in a larger scale as well lol. Also this would be nowhere so far without Albetros, that thing makes my work a lot easier, having to code only my systems and not structure stuff.

By the way, I`d like to get your opinions about coding the inventory. I mean the database part. I was thinking of coding a DB for all items that were added throughout the games, and looping through that when I retrieve the items. When I`d add them, I wouldn`t store them immediately, just on logout. UID`s won`t be a problem since I`ll calculate next item UID everytime I add an item (I actually store the last item UID in a txt file lol). Any better ideas?
12/07/2011 10:43 Arco.#8
Quote:
Originally Posted by KraHen View Post
Let me explain a bit clearer, lol. I`m using the binary database (cq_npc) for the NPC spawns only.

And don`t praise my skills until this gets tested in a larger scale as well lol. Also this would be nowhere so far without Albetros, that thing makes my work a lot easier, having to code only my systems and not structure stuff.

By the way, I`d like to get your opinions about coding the inventory. I mean the database part. I was thinking of coding a DB for all items that were added throughout the games, and looping through that when I retrieve the items. When I`d add them, I wouldn`t store them immediately, just on logout. UID`s won`t be a problem since I`ll calculate next item UID everytime I add an item (I actually store the last item UID in a txt file lol). Any better ideas?
Regarding the DB, we talking flatfile or sql?
12/07/2011 11:30 KraHen#9
MySQL, it even says so in my starter post. Using NHibernate.
12/07/2011 11:34 Korvacs#10
If hes got sense its Sql, your database idea for items is good, you should extend it to include all forms of item storage.

I disagree entirely with your "I wouldn`t store them immediately, just on logout" as if your server crashes in such a way that you cannot perform the storing then you immediately rollback items by an entire users session, far from an optimal solution - a complete rollback is better than a partial one, and no rollback due to real-time updating is better than both. Sql is designed to be used under heavy load so it should be used accordingly.

And to be honest i dont really agree with this type of scripted npc dialogue anymore, be that internal or external.
12/07/2011 11:41 KraHen#11
Quote:
Originally Posted by Korvacs View Post
If hes got sense its Sql, your database idea for items is good, you should extend it to include all forms of item storage.

I disagree entirely with your "I wouldn`t store them immediately, just on logout" as if your server crashes in such a way that you cannot perform the storing then you immediately rollback items by an entire users session, far from an optimal solution - a complete rollback is better than a partial one, and no rollback due to real-time updating is better than both. Sql is designed to be used under heavy load so it should be used accordingly.

And to be honest i dont really agree with this type of scripted npc dialogue anymore, be that internal or external.
What has changed your mind regarding the NPC scripting? And thanks for the upper info. :)
12/07/2011 12:20 Korvacs#12
I just dont feel its as flexible as it could be, which i guess is abit strange but there are definitely better ways to do scripting.
12/07/2011 12:28 KraHen#13
There sure would be better options if it was only intended for NPC dialogs, etc, but these are pretty much universal scripts, so I can do w/e I want in them externally, like tournaments, etc. And it`s intended for internal developers only, so yeah. :) That`s why I like it at least.
12/07/2011 12:50 Korvacs#14
Im talking about universal though, not just text. :p
12/07/2011 13:22 KraHen#15
Inventory loading/saving(which is actually item saving but meh) added. It`s just a dictionary lol. And wrote some new methods and constructors for the Item class, such as converting a GameItemDomain(just a data holder for nhibernate) to ConquerItem etc. Now working on Equipment.

EDIT:

Removed all bugs related to this, basically stuff I didn`t think about before testing. Now it works as intended.