Register for your free account! | Forgot your password?

You last visited: Today at 21:08

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

Advertisement



[REQUEST] Scratch Emu

Discussion on [REQUEST] Scratch Emu within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1
 
andreimusc's Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 49
Received Thanks: 7
Question [REQUEST] Scratch Emu

HI, I would like to introduce myself: my name is Andrew i am 16 years old from Romania, and i think that is all you have to know about me!

Now, I would like to ask someone, who knows a bit of a programming language like C# or C++(because in this topic i think it is not VB case) to make a guide on how to make a sro EMULATOR from scratch!
PLEASE DONT DISAGREE ME IN THE VERY BEGINNING!
I just want something that covers the basics of the programming language in the EMU that is made...
I want something not exactly very simple(because i am not an idiot i guess , duuh -.-), but eventually easy to understand!

And please, I want someone that is in grade to answer me, and please don't troll, this is the last thing i want to T.T . I just want some simple answers like:
YES, it is bla bla blah
NO, it isn't
or.. No, but i will look up to find a guide, or to make one!

PEACE! XOXO
andreimusc is offline  
Old 06/22/2011, 20:34   #2
 
bootdisk's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 134
Received Thanks: 41
Echo server in any language is how you start one from scratch.
Just send the first packet as 0x5000 when you got a connection with the flag 1 and that's it.

Also:
.

About SRO server development there is a hugggeeeee thread about it . I think pushedx, lyzerk and Shadowz75 are the most valuable post in there... there was a time in which it was all active by replies from everyone.
bootdisk is offline  
Old 06/22/2011, 20:43   #3
 
andreimusc's Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 49
Received Thanks: 7
Thank you Bootdisk, this is a very good suggestion, and I consider it as a short(not small) walkthrough ^.^! I please the admins not to close it, because I want to hear some more suggestions
andreimusc is offline  
Old 06/23/2011, 00:21   #4
 
kevin_owner's Avatar
 
elite*gold: 0
Join Date: Jan 2010
Posts: 1,484
Received Thanks: 809
I agree with bootdisk and a little example of this echo server which i created a few days ago would look like this in for example C#:

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.IO;

namespace Silkroad_Login_Server_Example
{
	class Program
	{
		static void Main(string[] args)
		{
			TcpListener ServerSocket = new TcpListener(15779);
			ServerSocket.Start();
			Console.WriteLine("Server Started");

			Socket Client = ServerSocket.AcceptSocket();
			Console.WriteLine("Client Connected");

			// Assambling the first packet. (Much easier if you use the packet writer
			// from csremu or srevolution. I also ripped this from srevolution.
			MemoryStream MS = new MemoryStream();
			BinaryWriter BW = new BinaryWriter(MS);
			BW.Write((short)1);
			BW.Write((short)0x5000);
			BW.Write((short)0);
			BW.Write((byte)1);
			BW.Close();

			// Send the packet to the client
			Client.Send(MS.GetBuffer(), 7, SocketFlags.None);

			// This loop is the main packet loop this one can process all the pakcets from the client
			while (true)
			{
				try
				{
					// Buffer to store the received packet
					byte[] RecvBuf = new byte[4096];

					// This function is blocking so it only continues once you receive a packet.
					int RecvBytes = Client.Receive(RecvBuf);

					// This displays the packet on the console.
					for (int i = 0; i < RecvBytes; i++)
					{
						Console.Write("{0:X2} ",RecvBuf[i]);
					}
					Console.Write("\n");
				}
				// Little exception catcher since it throws and exception if the connection got closed
				catch (SocketException SE)
				{
					Console.WriteLine(SE.Message);
					break;
				}
			}
			Console.ReadKey();
		}
	}
}
This code isn't very well designed but I wanted to keep it as short as possible. As you can see I'm using the binairywriter to assemble the packet.
You can see it as an array which you send over the network.
Building this packet in C++ could look like this:
Code:
char Buffer[4096];
*(short*)&Buffer[0] = 1;
*(short*)&Buffer[2] = 0x5000;
*(short*)&Buffer[4] = 0;
*(char*)&Buffer[5] = 1;
Probably the best way to start is learning a programming language till you're comfortable with it and then you can start using sockets and threaded things.

But to get an idea of what you need to do with an emulator is just to simulate a packet but there is a lot of logic behind it so it is very difficult to create a nice and stable one.

And I can give you one good advice. Don't start too soon with adding features. Sure it's nice too see things working but if you take things slow so your emulator will also be more stable. and creating a solid base would also be a good advice. like the client handling cause you probably want a few players online at the same emulator so you need up to date info trough your whole emulator.

How is started with this stuff was a lot of browsing trough other people's sources. sourceforge or assembla or full of emulator projects for mmo's.

I hope this helps you a bit
kevin_owner is offline  
Old 06/23/2011, 01:09   #5
 
andreimusc's Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 49
Received Thanks: 7
I thank you all for this responses, and i also appreciate the fastness that you respond^^!
Ow and Kevin_owner, may the *** be with you, that code helped me very much!
I also wait for another responds, Peace!
andreimusc is offline  
Old 06/23/2011, 21:03   #6
 
evolution007's Avatar
 
elite*gold: 0
Join Date: Feb 2008
Posts: 284
Received Thanks: 90
i want to ask too. is there any sro emulator written in c++ open-source?
evolution007 is offline  
Old 06/23/2011, 21:10   #7
 
elite*gold: 0
Join Date: Nov 2007
Posts: 959
Received Thanks: 602
Quote:
Originally Posted by evolution007 View Post
i want to ask too. is there any sro emulator written in c++ open-source?
sremu & sremu2(I don't know how it's going,last time there were only just config loading and such..^^) as far as I know..

Ontopic:
I think you should really check out pushedx's c# silkroadsecurity for ideas for packet handling and security,etc,and you could also use it as a "starting point" with some modifications ..^^
vorosmihaly is offline  
Reply


Similar Threads Similar Threads
starting from scratch
02/21/2011 - Silkroad Online - 4 Replies
well i stopped playing sro @ 100cap (some might remember me "lool" rogue with the best non sun xbow on uhm dont remember the server lolz) so got a few Q's for ya doods 1. whats the newest server atm? (maybe someone here got a guild for me) 2. does phbot still exist (and still got the clientless feature?) 3. thought going rogue or bow and run 2-3 goldbots 4. what happened since 100 cap? 110cap and whats this forgotten world thing?
[PROGRAM]Scratch
11/15/2009 - Off Topic - 6 Replies
Kennt wer das Programm Scratch?? Das ist diese Katze damit kannst du Spiele etc. entwickeln!! Kann mir wer helfen muss bis morgen ein Spiel entwickeln und in der Schule vorstellen
Making a bot from scratch.
08/08/2009 - GW Bots - 3 Replies
Ok, so I want to make a bot, never done this sort of thing before, I know very little about AutoIt... And I also don't know German, so don't go pointing me to any of the various german guides. Are there any English guides already written for this? If so, can someone provide a link(s) please? It wouldn't just be helping me, I mean, there's so many other people on this forum that could use it. Thanks in advance :)
Dj Scratch and the Overdrive
04/18/2008 - Music - 0 Replies
Hi Boyz and Girlz, Ich brauche eure Hilfe...ich suche dieses Lied schon seit Jahren Es ist aus dem Film Honey und heisst (Zitat aus dem Film) Dj Scratch and the Overdrive... Könnte sein dass der Loop nur für die Filmproduktion gemacht wurde was sehr schade wäre... Hier kleine Kostprobe: YouTube - Honey dance Plz Help
Scratch hack?
06/25/2007 - Conquer Online 2 - 4 Replies
Hi guys. I need some help with finding out some information bout a hack that seems to be on our server. Nature: Thunder My friend got hacked by this new hack ive never heard of or seen. I guess what happens is that when someone is trading with you, it also gives them access to your char, and what they have on at that very moment and the hacker can take all of your gear right off you as long as the trade window is open.



All times are GMT +2. The time now is 21:08.


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.