Quantcast
Channel: RaGEZONE - MMO Development Forums
Viewing all articles
Browse latest Browse all 28172

[V9] [R35] Aurora Emulator [C#] [NHibernate] [DotNetty] [Log4net]

$
0
0
Hey,

This is actually my HSR project. I want to rewrite this thread as I kind off got off with it. I rewrote the whole source but it was on a virtual machine which I accidentally removed (since I had 2 Windows 7 VMs and removed the wrong one... silly me!)

Anyways, I decided to rewrite it. The R35 is just an assumption. The base "framework" (which I call Aurora's Habbo Framework) is used for all projects which will be made. Not much, just 2/3 versions, but we'll start with one. Or 2... not sure.

Some tech-stuff:

- The emulator is written in C#.
- The emulator uses DotNetty for networking.
- The emulator uses Fluent NHibernate.
- The emulator creates all database tables upon booting up for the first time.
- The emulator is written from scratch.
- The emulator uses Nuget.
- The emulator uses log4net.

Versions being made / planned:

- V9 (or V7 if somebody can help with packet structures I can't figure out).
- R35-R38 (not sure which one).

More isn't planned, but it's all to be answered. For the R35-R38, the main focus is on Flash first (no worries... Shockwave is a possibility).

The features planned:

V7/V9:
- Camera
- Everything else
- Wobble squabble
- Gamehall
- IF it's v9, battleball

R35-R38:
- Just the full game, with achievements etc etc.

Some custom features might be implemented later but not sure about that.

The source will be available during a later stage at the development. For now, it's not share-worthy as it's kind of messy in some parts still.

A few scripts to show you how things are done:

This code builds the SessionFactory, adds the mappings and updates the schema (database).

PHP Code:

SessionFactory Fluently.Configure()
                    .
Database(MySQLConfiguration.Standard.ConnectionString(CONNECTION_STRING))
                    .
Mappings(=> m.FluentMappings.AddFromAssemblyOf<PlayerMap>())
                    .
Mappings(=> m.FluentMappings.AddFromAssemblyOf<CatalogPageMap>())
                    .
ExposeConfiguration(config =>
                    {
                        new 
SchemaUpdate(config).Execute(falsetrue);
                    })
                    .
BuildSessionFactory(); 

This is an example of a map. In this case, it's the PlayerMap which extends ClassMap<Player>. It loads all data from the table "players".

PHP Code:

 public PlayerMap()
        {
            
Table("players");
            
LazyLoad();
            
Id(=> x.Id).Column("id").Length(11).GeneratedBy.Identity();
            
Map(=> x.Username).Column("username").Length(15).Not.Nullable();
            
Map(=> x.Password).Column("password").Length(80).Not.Nullable();
            
Map(=> x.Email).Column("email").Length(30).Not.Nullable().Unique();
            
Map(=> x.Gender).Column("gender").Length(1).Not.Nullable();
            
Map(=> x.Figure).Column("figure").Length(80).Not.Nullable();
            
Map(=> x.Motto).Column("motto").Length(40).Default("").Not.Nullable();
            
Map(=> x.Coins).Column("coins").Length(11).Default("500").Not.Nullable();
            
Map(=> x.Pixels).Column("pixels").Length(11).Default("0").Not.Nullable();
            
Map(=> x.Rank).Column("rank").Length(2).Default("1").Not.Nullable();
            
Map(=> x.HomeRoom).Column("home_room").Length(11).Default("0").Not.Nullable();
            
Map(=> x.SSO).Column("sso_ticket").Length(40).Not.Nullable().Default("");
        } 

This reads a packet and handles it. I'm sure it could be cleaned up more... but oh well.

PHP Code:

 public override void ChannelRead(IChannelHandlerContext ctx, object msg)
        {
            Client client = Engine.Game.Clients.GetClient(ctx.Channel);
            var message = msg as IByteBuffer;

            if (message.ReadByte() == 60)
            {
                string policy = "<?xml version=\"1.0\"?>\r\n<!DOCTYPE cross-domain-policy SYSTEM \"/xml/dtds/cross-domain-policy.dtd\">\r\n<cross-domain-policy>\r\n   <allow-access-from domain=\"*\" to-ports=\"1-65535\" />\r\n</cross-domain-policy>\0";
                
ctx.Channel.WriteAndFlushAsync(Unpooled.CopiedBuffer(Encoding.Default.GetBytes(policy))).Wait();
            }
            else
            {
                
int length Base64Encoding.DecodeInt32(message.ReadBytes(2).ToArray());
                
IByteBuffer packet message.ReadBytes(length);

                
Engine.GameNetwork.Packets.Handle(clientpacket);
            }

            
base.ChannelRead(ctxmsg);
        }

For more scripts, just ask me. I'm a nice fella and if you think I could change a few things let me know. But please only do constructive criticism.

A few screens:

Now much, just started (and mainly done "kernel" stuff):




The end of my school year is coming up as well so I'll have more time to work on this. And I'm gonna keep it more updated as I kind of forgot in my last thread (and the thread was a mess because I started over and yeah now I know I will only work on this and I got it backed up and stuff maybe put it on git).

Any questions, just ask.

Viewing all articles
Browse latest Browse all 28172

Trending Articles