[help]Creating a server

06/12/2010 04:07 taylor2846#1
i was needing some info on creating my own source what all is needed just to login the a 1.0 Clint? and u all thank i need to code a source for base or get a source and just redo most of it? and how do i set up a login server gameserver and npc server ? may not do that just want someinfo on it!
06/12/2010 04:34 pro4never#2
Quote:
Originally Posted by taylor2846 View Post
i was needing some info on creating my own source what all is needed just to login the a 1.0 Clint? and u all thank i need to code a source for base or get a source and just redo most of it? and how do i set up a login server gameserver and npc server ? may not do that just want someinfo on it!
Didn't you post a very similar thread like 2 days ago?

For co 1 you don't need blowfish encryption so that helps you somewhat...


For ANY server on any patch you will need the same basic things though.

A socket listening for connections (on login port), a packet handler (so you can decrpt incoming and encrypt/build outgoing packets), a game server socket, auth socket, etc...

Basically once you can accept the connections, handle encryptions, receive/decrpt and send packets then you need to do the rest of the server (such as the socket system you will use for clients, coding the indidual packets (like login/auth/etc) and eventually base systems.


There is more but i can't think of it all atm... sadly that you need to ask all this means you are not ready to make your own source really... i'd suggest using hybrids as a base source. Hell it's 5017 by default so changing to co1 is a piece of cake.
06/12/2010 04:47 .Summer#3
blowfish is 5018+
06/12/2010 04:59 s.bat#4
Quote:
Originally Posted by taylor2846 View Post
i was needing some info on creating my own source what all is needed just to login the a 1.0 Clint? and u all thank i need to code a source for base or get a source and just redo most of it? and how do i set up a login server gameserver and npc server ? may not do that just want someinfo on it!
A common focus in the development of the game server is to eliminate lag by attempting to process data in as little time as possible. If a server is hung up on processing many different requests (user authentication, NPC's, or DMaps, etc.), then that's going to add latency to your server's throughput. One of the suggested ways to eliminate this is to split up major jobs to different processes.

One of the issues with splitting up these tasks is finding a solution to IPC (inter-process communication). If you split up your project into different process, they will need some way of communicating with one-another. There are many different solutions to this issue, including sockets, pipes, or .NET Remoting. IPC isn't well-documented on these forums, but here is a discussion on solutions to it [Only registered and activated users can see links. Click Here To Register...], but you'll need to search the web for more information.

Splitting your project up into different servers certainly seems like the most scalable plan, and one benefit is the ability to isolate problems with each server, and being able to change code in one application without effecting any of the others, but it will be more time-consuming. If you are just beginning, my recommendation would be to do everything in one application, but with the intention of splitting it up in the future. This means that you must design and document a well-thought-out server.

Even if you're new to programming, I still believe that anyone can start out by making their own server instead of using one that's already been released. It's obviously going to be more difficult, but if you're interested, you should start by learning how sockets work in whatever language you plan on using to develop your server. If it's C#, then here are a few resources I would use:
[Only registered and activated users can see links. Click Here To Register...] - API documentation of the .NET framework.
[Only registered and activated users can see links. Click Here To Register...] - Blocking Servers/Sockets
[Only registered and activated users can see links. Click Here To Register...] - Asynchronous Sockets.

Basic instructions for the road ahead:

Learn the language and how it's applied well before attempting to make a server in it. Make sure that you know the data types, keywords, and the most commonly used namespaces and utility classes, and don't forget to use the MSDN API when you're stuck on an error or some code. It has some of the most useful information out there.

Basic instructions for starting your account server:

Start out with a server listening for connections on port 9958, and change your client's Server.dat to use your IP, and then try to connect to the server using the client.

After you've successfully been able to connect, have the server read in the data sent to it from the client. The data is encrypted, so you'll need to implement a Cryptographer. The cryptographer will encrypt the data sent from the server, and it will decrypt the data sent from the client. You can use the cryptographer from any server that is developed for patch 5017 and lower.

Use the publicly released sources like Hybrid's [Only registered and activated users can see links. Click Here To Register...] to design an effective data handling system.

Quote:
Originally Posted by pro4never View Post
Didn't you post a very similar thread like 2 days ago?
Actually, it was today:
[Only registered and activated users can see links. Click Here To Register...]

OP: In the future, you should bump your thread if you feel that your question isn't getting the amount of attention it deserves, or if we've missed something.

Quote:
Originally Posted by .Summer View Post
blowfish is 5018+
What a useless post. Why do you even bother?
06/12/2010 12:29 ImmuneOne#5
Quote:
Originally Posted by taylor2846 View Post
wops i was thanking i edit my last post my bad lol
and pro4never im doing this to larn more then any thang you can not larn it if it is alredy coded the way i see it LOL; i mean ya i need stuff for exaples of how do do it but ya lol
Login sequence;

Quote:
Client -> Server : LoginRequest (1051)
Server -> Client : LoginResponse (1055)
Client -> Server : AuthMessage (1052)
Server -> Client : ANSWER_OK (1004(MessagePacket: "SYSTEM", "ALLUSERS", "ANSWER_OK", 2101))
Server-> Client : HeroInformation (1006)
Server: SetKeys(2, Packet.Reader.UInt(4));
Client->Server : DataPacket (1010)
Server->Client : HeroSpawn (1014)
Should get you logged in.
06/13/2010 02:36 taylor2846#6
im trying to convert xtremely basic (but working/bugless) C# Source to a 1.0and im geting this error:

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

This is my CharacterInfo
Code:
        public static byte[] CharacterInfo(GameClient Client)
        {
            byte[] Packet = new byte[((66 + Client.Spouse.Length) + Client.Entity.Name.Length)];
            WriteUInt16((ushort)Packet.Length, Packet, 0);
            WriteUInt16(1006, Packet, 2);
            WriteUInt32(Client.Entity.UID, Packet, 4);
            WriteUInt32(Client.Entity.Model, Packet, 8);
            WriteUInt16(Client.Entity.HairStyle, Packet, 12);
            WriteUInt32((uint)Client.Money, Packet, 14);
            WriteUInt32((uint)Client.Experience, Packet, 16);
            WriteUInt16(Client.Strength, Packet, 20);
            WriteUInt16(Client.Agility, Packet, 28);
            WriteUInt16(Client.Vitality, Packet, 32);
            WriteUInt16(Client.Spirit, Packet, 36);
            WriteUInt16(Client.StatPoints, Packet, 40);
            WriteUInt16((ushort)Client.Entity.Hitpoints, Packet, 42);
            WriteUInt16(Client.Mana, Packet, 44);
            WriteUInt16(Client.PKPoints, Packet, 46);
            Packet[48] = Client.Entity.Level;
            Packet[50] = Client.Job;
            Packet[52] = (byte)Client.Entity.Reborn;
            Packet[54] = 1;
            Packet[56] = 2;
            WriteStringWithLength(Client.Entity.Name, Packet, 57);
            WriteStringWithLength(Client.Spouse, Packet, (ushort)(58 + Packet[59]));
            return Packet;
        }
help with this?
06/13/2010 16:40 s.bat#7
[Only registered and activated users can see links. Click Here To Register...]

The problem was primarily with this line:
Code:
WriteStringWithLength(Client.Spouse, Packet, (ushort)(58 + Packet[59]));
You had just previously written a string to the packet before this line, and so "Packet[59]" is not getting the previous string's length, but it's actually grabbing one of the ascii values associated with a character in that string, and unfortunately that value is too high when added to 58 to be indexed in the array. To fix this, you should do "Packet[57]" instead, as this is where the length of the previous string is written.

But:

Most of the packet's offsets were incorrect. Take a look at [Only registered and activated users can see links. Click Here To Register...], it contains packet structures that you will find useful. Some of the packet structures in Hybrid's source will need to be rewritten in order to work for the 4267 client.

I used [Only registered and activated users can see links. Click Here To Register...] as a reference (from Korvacs's Wiki) when editing the code (I didn't test it, but hopefully it's closer to what you're looking for):
Code:
        public static byte[] CharacterInfo(GameClient Client)
        {
            byte[] Packet = new byte[66 + Client.Spouse.Length + Client.Entity.Name.Length];
            WriteUInt16((ushort)Packet.Length, Packet, 0);
            WriteUInt16(1006, Packet, 2);
            WriteUInt32(Client.Entity.UID, Packet, 4);
            WriteUInt32(Client.Entity.Model, Packet, 8);
            WriteUInt16(Client.Entity.HairStyle, Packet, 12);
            WriteUInt32((uint)Client.Money, Packet, 16);
            WriteUInt32((uint)Client.Experience, Packet, 20);
            WriteUInt16(Client.Strength, Packet, 40);
            WriteUInt16(Client.Agility, Packet, 42);
            WriteUInt16(Client.Vitality, Packet, 44);
            WriteUInt16(Client.Spirit, Packet, 46);
            WriteUInt16(Client.StatPoints, Packet, 48);
            WriteUInt16((ushort)Client.Entity.Hitpoints, Packet, 50);
            WriteUInt16(Client.Mana, Packet, 52);
            WriteUInt16(Client.PKPoints, Packet, 54);
            Packet[56] = Client.Entity.Level;
            Packet[57] = Client.Job;
            Packet[59] = (byte)Client.Entity.Reborn;
            Packet[60] = 1;
            Packet[61] = 2;
            WriteStringWithLength(Client.Entity.Name, Packet, 62);
            WriteStringWithLength(Client.Spouse, Packet, (ushort)(63 + Packet[62]));
            return Packet;
        }
06/14/2010 02:58 taylor2846#8
Ty's but i still get the same error im trying to find out why but i dont any help with this please?