Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

SteerStone C++ | Emulating v14

Newbie Spellweaver
Joined
Feb 5, 2019
Messages
8
Reaction score
9
iHi!

I've been creating a Habbo v14 Emulator during my free time. The emulator is coded in C++ using the following libraries: Boost, OpenSSL and MySQL Connector.

Discovering this community a little while ago, I thought I'd share my work here.

The emulator is not designed to be used as a hotel server. Although I recommend to use it as
educational; learning my mistakes, bad code vs good code, code refactoring etc..

This section is extremely helpful for me in terms of references! especially Kepler Emulator (by Quackster) gathering the required data and understanding how Habbo client works.

In terms of features, there's not much to say, currently building the core foundation of the emulator.

There's no installation tutorial just yet.

Any suggestions or improvements - please say!



 
Last edited by a moderator:
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,688
Re: Emulating Habbo v1 - C++

Thread approved! I actually found your repo on github after searching and I was curious about your project, so glad that you decided to create a development thread.

Although you posted a link to the repository and with that link I can confirm your link shows proof of development, I would love to see screenshots of your project working because you know, eye-candy. :blush:
 
Newbie Spellweaver
Joined
Feb 5, 2019
Messages
8
Reaction score
9
Re: Emulating Habbo v1 - C++

Thread approved! I actually found your repo on github after searching and I was curious about your project, so glad that you decided to create a development thread.

Although you posted a link to the repository and with that link I can confirm your link shows proof of development, I would love to see screenshots of your project working because you know, eye-candy. :blush:

Hi,

Thank you for showing interest!

Once I've coded the room part, I will be sure to start uploading pictures!

Update: I decided to update the core to Habbo v14. There are a lot more features along with the revision which equals more fun for me.
 
Newbie Spellweaver
Joined
Feb 5, 2019
Messages
8
Reaction score
9
Re: Emulating Habbo v14 - C++

Hey for those are curious.

Been nearly a month since I created this thread.

So far it's been fun and challenging!

When I first started this project, I was trying out a new coding standard and fleshing out my code - although It did not last long and resorted back to my coding standard; everything is now documented from low level to high level.

Packet Protocol
I had a good look at how I should tackle the packet protocol.

I've decided to split the client packets into handlers. Each client packet has it's own handler function in its respective file having an reference of the socket class. This way the code is split and easier to manage.

For server packets, I went with using OOP. Each server packet has its own class. Again makes it easier to change the packet structure of the packet without having to go every single code which defines the packet.

An example of my current implementation:
Code:
HabboPacket::Room::Chat l_Packet;
l_Packet.Message = "Hey this is Quadral!";
m_Habbo->ToSocket()->SendPacket(l_Packet.Write());


Design Layout

Forgotten how many times I've refactored my code... When I first started began coding the basic layout of the emulator, I kept steering into the wrong direction due to the reason that my design layout was not suited for Habbo. Right now I think I am steering into the right direction, as my steering is becoming heavier as stone to steer again.

The current design layout is letting the user thread to handle calculating less or intensive functions e.g Way-Points and then allow the world update to deal with the function outcome and re-calculate if need to be.

Users can have their own thread or share the same thread with other users depending on the users thread update latency (latency must be < 500ms). You can configure the thread optimisation settings to only launch 2 static threads to handle users connections, or let the server to dynamically handle user thread connections depending on population (this can be resource heavy).

Although I'm not sure what population I am aiming for to handle a stable player base as yet I have not simulated any real players performing actions. This is something I am planning to do next before I move onto any stuff.

Right now, the world update is on its own thread to handle; Processing way points, room update, habbo statuses, ping, bots etc... Since the world gets updated every 500ms I can use this tick to calculate how many seconds has been passed to process a certain action e.g habbo wave timer.

For the database, I decided to split the database into two; one for handling user info and one for room info - this way everything is more clean and simple to use. Along with this the core on start-up will proactively check if any room entries exist in the user database info to ensure there's no rooms which are just junk... this goes the same with other stuff which is separated from users database.

What has been done?
So far:

Messenger - 98% completed. 2 Packets (Error Packets) needs to be coded

PathFinding - 90% completed. Checks for dynamic objects (players only at the moment) and static objects.

Navigator - 90% completed. Need to code search users and create rooms.

Habbo Club - 90% completed. Need to code the Gift part.

Badges - 100% completed.

WalkWays (Walking into another room) - 100% completed.

Furniture - 50% completed. Still need to code the catalogue.

FuseRights - 40% completed. Need to code the moderation packets

Rank - 100% completed. Users can now set their ranks and gets updated accordingly.

And probably more other stuff I cannot think off atm!

Thanks for reading.
 
Newbie Spellweaver
Joined
Feb 5, 2019
Messages
8
Reaction score
9
Re: Emulating Habbo v14 - C++

Another update again for those are popping by.

From my previous post, I wanted to stress test the emulator to see where my design flaws are.
So I created a headless client to simulate up to 2300 real players.


Skip to 6:15 if you want to see the simulated players in action.

Things to note:
Each simulated player were randomising between: walking, chatting, leaving room, joining random room and disconnecting on a random interval.

The world update was averaging around 10ms to update the world this consists of: Updating rooms, player statuses, processing path points (and also calculating/recalculating paths), and other misc packets which requires to be sent to all users inside room.

Design Flaws
So during the stress testing, I encountered a few crashes which majority of were related to no sanity checks. An example would be, if player disconnected - The socket will close, however the player will still remain in memory till the next ping, during this time period if we need to send a packet to disconnected client, the server will access a nullptr socket causing a crash.
Uninitialised variables! I've gotten into a bad routine where I have not initialised my variables an example would be in my Badge class where my std::tuple was not initialised, so when someone wants to see what inside tuple, there's nothing there.

In terms of memory usage, we peaked up to 78mb which stayed consistently even though players are disconnecting from server - This is a great example of a memory leak. When a player logs in, we of course allocate memory for the player class, but when player disconnects and server processes the removal of the player we don't de-allocate the player class. Again this is one of the things which I need to be careful for. I would need to dig further into memory usage to check for any floating objects etc...

Of course having simulated players around does not mean anything when compared to real players. Players do the most randomise things which can break the server, however simulating players can give the developer a general idea where his flaws are.

Thanks for reading.
 
Last edited:
Newbie Spellweaver
Joined
Feb 5, 2019
Messages
8
Reaction score
9
Yoo bro. Any updates????

Not currently. Unfortunately 2-3 months ago my SSD went bust and lost a months worth of uncommitted changes along with the database.
This clearly set me back, but during the offside I've been writing my own net framework which I will be implementing into the source soon, and set up a proper structure for other people to contribute.
 
Newbie Spellweaver
Joined
Mar 5, 2019
Messages
14
Reaction score
3
Not currently. Unfortunately 2-3 months ago my SSD went bust and lost a months worth of uncommitted changes along with the database.
Make a githubso you don't lose your work, also easier to see changes.
You can make it private if you don't want people to see it/the source yet.
 
Back
Top