Register for your free account! | Forgot your password?

Go Back   elitepvpers > Other Online Games > Browsergames > DarkOrbit
You last visited: Today at 06:28

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Tutorial] Netty Based Server

Discussion on [Tutorial] Netty Based Server within the DarkOrbit forum part of the Browsergames category.

Reply
 
Old   #1
 
ItsTequila's Avatar
 
elite*gold: 0
Join Date: Jun 2015
Posts: 647
Received Thanks: 954
[Tutorial] Netty Based Server



Basics and a little introduction to Netty
Quote:
You ever felt like coding something harder than 4.1? Or maybe well less complicated (For me ;p). Well I'm here to help you out about learning to read netty classes and coding an emulator to handle all the requests and responses =).


Starting from the bottom - How to read
Quote:
Well the real base is to get a swf and a decompiler. In this tutorial I will use the 7.5.3 SWF & FFDec.

*This tutorial isn't limited just to 7.5.3, it's valid for all the swfs except the newest ones with netty folder changed*

You probably have just opened the swf and asked yourself, what am I doing with my life? Well it's not that hard as it may seem, it's even easier than you thought. As of this part you gotta choose if to read the classes from the decompiler or from n++. I personally prefer to decompile all the files to flash and just read everything using notepad++.
So now we're going into the real part, reading the classes.
Head to the folder called net -> bigpoint -> darkorbit -> net -> netty -> commands.
As for today's tutorial I won't jump into handlers or encryptions so just use meanwhile a premade swf (from private server).

Well here is the beginning of reading the commands and parsing them. I already made a tool to do the job for me but I didn't have enough time to fully complete it. (You may find the download under the Downloads section.)

First thing you would like to do is take your emulator and get the first command you've received from the connection. As for me and everyone else on this world it is 666.

So what you do is simply press CTRL+F and jump into Find in files menu.
It should look something like this.


(Instead of 666 put the command ID.)

And the result you get should be the following:


The next thing you should look is the command's ID.
Code:
public static const ID:int = 666;
That is always sent first in case you want to send the command.
Code:
writeShort(ID);
-- everything else --
But as of today we're only reading it.
Take a look at the last few lines,
Code:
      protected function writeInternal(param1:IDataOutput) : void
      {
         param1.writeInt(this.major);
         param1.writeUTF(this.minor);
         param1.writeInt(this.build);
      }
It should look something like this.

Now when you read the command you should get int,string,int.
So for example you are using a basic parser.
Code:
Debug.WriteLine(p.Id + " " + p.ReadInt() + " " p.ReadUTF() " " + p.ReadInt());
Use that to output all the params received.

And that is the base of how to read the netty commands.

Converting classes to C#
Quote:
For this example I will use the NettyBase source as example, link is down below.

So you've got to the point of converting / creating your own commands?
Well now we gotta identify if the commands we're converting is a subcommand or not.
How do we do that?

In this example we will use VisualModifierCommand.
First thing we do is on Notepad++ [CTRL + F] -> Find in Files
*Make sure you've located the search into the netty/commands folder*

and click 'Find All'.

If you see to it's called in class with name other than "VisualModifierCommand" you can know to this command is a sub.

So how do I convert a normal command?
So how do I convert a sub?


Normal Command
Quote:
You can use the following template for creating a normal command:
Code:
namespace NettyBase.Net.netty.commands
{
    class TestCommand
    {
        public const short ID = 0; // Command ID, Replace it.

        public static byte[] write()
        {
            var cmd = new ByteArray(ID);
            // Command params goes here //
            return cmd.ToByteArray();
        }
    }
}
So how can I get the command params?
At the bottom of the class there is
Code:
      protected function writeInternal(param1:IDataOutput) : void
      {
         param1.writeInt(this.uid);
         param1.writeInt(this.newLevel);
      }
In this command for example we have 2 params, uid & newLevel and both of them are int.
That is how they should look in C#:
Code:
cmd.Integer(uid);
cmd.Integer(newLevel);
And the final command should look like that:
Code:
namespace NettyBase.Net.netty.commands
{
    class LevelUpCommand
    {
        public const short ID = 32247;

        public static byte[] write(int uid, int newLevel)
        {
            var cmd = new ByteArray(ID);
            cmd.Integer(uid);
            cmd.Integer(newLevel);
            return cmd.ToByteArray();
        }
    }
}
Sub Commands

Quote:
* To be continued *

Downloads & Others
Quote:
NettyBase Emulator
Quote:
So as you saw from above there is the NettyBase emulator. It is emulator that I created for helping everyone who wants to build his own 7.5.3 client emu.
I've also setup place to test your emulator instead of downloading xampp and htdocs and messing with all that stuff.

You can test your emulator here:

So to the main part of what this emulator does,
* It dumps all the packets that are not defined into a file called
Quote:
UndefinedCommands.dump
* I've cleaned up some codes here and there and also added Parser & ByteArray so you won't have to deal with this when you code your server.

* I've made also login so you won't mess with the settings because they usually take tons of time to setup and much headache.

* I've coded also the LegacyModule (Old packets)
All you need to do in order to send an old packet ("0|asdasd") is
Code:
client.Send(LegacyModule.write("0|asdasd"));
Atm I also started doing another tool that will help you order all the commands that you didn't define (NettyHelper) but as of now it's just a form so don't expect it to function.
* I will add all the info needed to create a server, just give me some time.

* If anyone would like to add something feel free to PM me and I will provide you with credit and add it into the post =).
ItsTequila is offline  
Thanks
19 Users
Old 08/08/2016, 01:16   #2
 
MrCriticalRx's Avatar
 
elite*gold: 2
Join Date: Dec 2013
Posts: 285
Received Thanks: 62
jumm ...
MrCriticalRx is offline  
Old 08/08/2016, 11:59   #3
 
manulaiko3.0's Avatar
 
elite*gold: 0
Join Date: May 2014
Posts: 662
Received Thanks: 1,154
Searching for integers that way will only lead to a lot of unnecessary results
manulaiko3.0 is offline  
Old 08/08/2016, 13:28   #4
 
ItsTequila's Avatar
 
elite*gold: 0
Join Date: Jun 2015
Posts: 647
Received Thanks: 954
Quote:
Originally Posted by manulaiko3.0 View Post
Searching for integers that way will only lead to a lot of unnecessary results
I will get into that later. I didn't have enough time finishing it up. And also as I mentioned at the bottom of the post if you would like to contribute you are free to do so.
ItsTequila is offline  
Thanks
1 User
Old 08/08/2016, 16:29   #5
 
elite*gold: 0
Join Date: Jul 2015
Posts: 102
Received Thanks: 95
Well Done Shock! Nice to See you Getting Better
-Real- is offline  
Thanks
2 Users
Old 08/09/2016, 21:24   #6
 
ItsTequila's Avatar
 
elite*gold: 0
Join Date: Jun 2015
Posts: 647
Received Thanks: 954
Today's update:
Quote:
Originally Posted by Main post
NettyBase Emulator
Quote:
So as you saw from above there is the NettyBase emulator. It is emulator that I created for helping everyone who wants to build his own 7.5.3 client emu.
I've also setup place to test your emulator instead of downloading xampp and htdocs and messing with all that stuff.

You can test your emulator here:

So to the main part of what this emulator does,
* It dumps all the packets that are not defined into a file called
Quote:
UndefinedCommands.dump
* I've cleaned up some codes here and there and also added Parser & ByteArray so you won't have to deal with this when you code your server.

* I've made also login so you won't mess with the settings because they usually take tons of time to setup and much headache.

* I've coded also the LegacyModule (Old packets)
All you need to do in order to send an old packet ("0|asdasd") is
Code:
client.Send(LegacyModule.write("0|asdasd"));
Atm I also started doing another tool that will help you order all the commands that you didn't define (NettyHelper) but as of now it's just a form so don't expect it to function.
Soon I will add more updates to the emulator & also finish up the NettyHelper =).
ItsTequila is offline  
Thanks
2 Users
Old 08/09/2016, 23:13   #7
 
elite*gold: 0
Join Date: Oct 2013
Posts: 177
Received Thanks: 112
Hi,

Glad to see someone who want to do his best in opensource !

then i'm going to contribute with this



Best Regards
SYSTEMEWAR is offline  
Old 08/09/2016, 23:30   #8
 
ItsTequila's Avatar
 
elite*gold: 0
Join Date: Jun 2015
Posts: 647
Received Thanks: 954
Quote:
Originally Posted by SYSTEMEWAR View Post
Hi,

Glad to see someone who want to do his best in opensource !

then i'm going to contribute with this



Best Regards
Thank you for your contribution, parts of your code will be added in the next release.

Sneak peak of what I've been playing with :3


PS: I fixed the buggy translations now should look all in normal language
ItsTequila is offline  
Thanks
1 User
Old 08/09/2016, 23:58   #9
 
elite*gold: 0
Join Date: Dec 2013
Posts: 307
Received Thanks: 35

Hopefully you will release the CMS So i can get server running
Azza12 is offline  
Old 08/10/2016, 00:01   #10
 
ItsTequila's Avatar
 
elite*gold: 0
Join Date: Jun 2015
Posts: 647
Received Thanks: 954
Quote:
Originally Posted by Azza12 View Post

Hopefully you will release the CMS So i can get server running
I'm currently considering the option of doing public server so everyone can enjoy and meanwhile be free to take the source =)
And don't forget, you're always welcome to contribute!
ItsTequila is offline  
Old 08/10/2016, 00:05   #11
 
elite*gold: 0
Join Date: Dec 2013
Posts: 307
Received Thanks: 35
Quote:
Originally Posted by NUMANDERBUHMAN View Post
I'm currently considering the option of doing public server so everyone can enjoy and meanwhile be free to take the source =)
And don't forget, you're always welcome to contribute!
Mate i've test the ingame i downloaded the Emulator but which source you are on about
Azza12 is offline  
Old 08/10/2016, 00:42   #12
 
ItsTequila's Avatar
 
elite*gold: 0
Join Date: Jun 2015
Posts: 647
Received Thanks: 954
So as of now I'm confirming to there will be online version for everyone to enjoy very very soon !

Quote:
Originally Posted by Azza12 View Post
Mate i've test the ingame i downloaded the Emulator but which source you are on about
The new version
ItsTequila is offline  
Old 08/10/2016, 00:47   #13
 
elite*gold: 0
Join Date: Dec 2013
Posts: 307
Received Thanks: 35
Quote:
Originally Posted by NUMANDERBUHMAN View Post
So as of now I'm confirming to there will be online version for everyone to enjoy very very soon !



The new version
Nice nice mate, can't wait
Wanted to make my own server with your CMS But if your bringing one out i will play
Azza12 is offline  
Old 08/10/2016, 20:34   #14
 
4K@60fps's Avatar
 
elite*gold: 0
Join Date: Jun 2016
Posts: 2
Received Thanks: 2
Hey guys the link where you can test your emulator has been changed, new link is here:
4K@60fps is offline  
Thanks
2 Users
Old 08/10/2016, 20:40   #15
 
wall57's Avatar
 
elite*gold: 0
Join Date: Jul 2011
Posts: 357
Received Thanks: 88
now that's rare on 2016...

usually between the catfights and grammar wars something nice pops up.
wall57 is offline  
Thanks
2 Users
Reply


Similar Threads Similar Threads
Speed Sro (Online) [130Cap-Coin System- (Job based) - Pvp Server - (Play2Win Server -
07/25/2014 - SRO PServer Advertising - 3 Replies
http://i.epvpimg.com/HN59f.jpg http://i.epvpimg.com/TQNrf.jpg http://i.epvpimg.com/HaDKd.png •Website : Speed http://i.epvpimg.com/HaDKd.png •Reg Link : Speed http://i.epvpimg.com/HaDKd.png
Hello, I'm looking for a card based game botting tutorial.
04/02/2014 - AutoIt - 4 Replies
Hello epvpers, I just registered and would like first of all to thank you for the opportunity to learn some coding. Secondly, I'd like to apologize in advance if I'm breaking any forum rules that I might have not seen. And thirdly, here is my request: I would like to know if there is any tutorials on how to make a game bot. The particulars are that its a card based game and from what I read so far a pixel search approach its recommended. I'd like to know if there are other approaches...
server based on taiwan server files (give me your opinion) Fast ^_^
12/09/2013 - SRO PServer Advertising - 4 Replies
I got a TW Server files and i launched it , and fixed all bugs and problems its now 100% working So what do u think i have to open it (PvP Or PvE) & The Cap ! But remember that there's no any bot works with it except Kbot i think btw give us your opinion ! Thanks :)
[C#] DarkOrbit Encoding/Decoding from Netty
05/18/2013 - DarkOrbit - 5 Replies
Hello, today i bring you how to encode and decode the packets of the new darkorbit(which uses netty). Dictionary: Short - 2 bytes Int - 4 bytes Bool - 1 byte Str or UTF - Short Length of String + String The structure of the packets are: 1 - Short Length of all packet
Ecsro Based Server 90SKILL And 90 Cap first realy oldschool server + Beginner Event
08/14/2012 - SRO PServer Advertising - 375 Replies
hey guys, After a long downtime we are now back online would be finde to see You again Stall Is Disabled In Gameserver so Dupe Unable To Use Events for beginning : 20.08.2012 Have fun :) First account Gets 200free silk Normal Events :



All times are GMT +2. The time now is 06:28.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.