- Joined
- Aug 10, 2011
- Messages
- 7,399
- Reaction score
- 3,302
Introduction:
Project Sirius: Arcturus 2.0 Emulator is an emulator trying to closely emulate Habbo. Duh
Well, I've decided to ditch Java because the original Arcturus source code base is just a pile of poop. I mean, its just really difficult to maintain and easy to break something with every change. And as the author of it, its okay to say it (And should be a massive red flag!!). Fixing it up in order to bring it up to standards would've cost a lot of time, perhaps even more than starting from scratch. Sooooo I've started from scratch. Because I'm a bit done with Java, in my opinion its bloated, I decided to rebuild the emulator from scratch in C#. C# allows for beautiful elegant code. You'll love it
The difference
If you're running Arcturus, or any of its derived versions, you know stuff gets broken over and over again with each change and release, sometimes the same bug gets fixed a couple times. So whats new here? Well for a start I'm building it using backed unit tests. If you're unfamilar with unit tests, they basically try to take a small piece of code and verify its behavior against some inputs and known result. If you change the logic of a piece of code, it will come up that the behavior has been modified and no longer according to spec. Using this method, its the first defence preventing bugs being introduced.
With the rise of all different client types, I decided to make it modular to use different clients. For now Flash is supported and soon Nitro will be integrated. With a simple to use interface, you can build any type of project against it, wether this is an Rest API, discord bots or custom protocols.
Arcturus 2.0 is build using a modular architecture in mind with multiple components. For example, rooms can be hosted on multiple servers in order to distribute CPU work load. An unique feature of this makes it possible to do live testing on a hotel without rebooting the emulator or having to deal with portforwarding.
The whole game logic & architecture is standalone implemented. This also allows smaller components to be tested and not having to deal with packets.
Features:
Build using
Multiple database support,
JSON Configuration & live reload.
Distributed architecture.
Custom Game Protocol to communicate with different clients.
Game Features:
Quite a bit of features have already been implemented.
- Furniture (Placing, Moving, Clicking, Picking up)
- Bots
- Mod Tools
- Wired (Triggers, Effects & Conditions (Excluding Game Wired))
- Catalog
- Messenger
- Flash landing view, hall of fame, news list.
- User preferences
- Navigator
Examples:
Here is how in in the latest Java Arcturus 1.21.2 version give badge command is implemented:
Here is the same thing in Arcturus 2.0:
From this example we can see that the original badge command had a lot of responsibilities, verifying that someone does not have the badge, inserting the badge in to the database etc. Starting with 2.0, all responsibilities are split up in small classes. In this case the IBadgesService is responsible to give a badge. No need to worry about it in the command if someone is online. Simple, clean & elegant code.
Project Sirius: Arcturus 2.0 Emulator is an emulator trying to closely emulate Habbo. Duh
Well, I've decided to ditch Java because the original Arcturus source code base is just a pile of poop. I mean, its just really difficult to maintain and easy to break something with every change. And as the author of it, its okay to say it (And should be a massive red flag!!). Fixing it up in order to bring it up to standards would've cost a lot of time, perhaps even more than starting from scratch. Sooooo I've started from scratch. Because I'm a bit done with Java, in my opinion its bloated, I decided to rebuild the emulator from scratch in C#. C# allows for beautiful elegant code. You'll love it
The difference
If you're running Arcturus, or any of its derived versions, you know stuff gets broken over and over again with each change and release, sometimes the same bug gets fixed a couple times. So whats new here? Well for a start I'm building it using backed unit tests. If you're unfamilar with unit tests, they basically try to take a small piece of code and verify its behavior against some inputs and known result. If you change the logic of a piece of code, it will come up that the behavior has been modified and no longer according to spec. Using this method, its the first defence preventing bugs being introduced.
With the rise of all different client types, I decided to make it modular to use different clients. For now Flash is supported and soon Nitro will be integrated. With a simple to use interface, you can build any type of project against it, wether this is an Rest API, discord bots or custom protocols.
Arcturus 2.0 is build using a modular architecture in mind with multiple components. For example, rooms can be hosted on multiple servers in order to distribute CPU work load. An unique feature of this makes it possible to do live testing on a hotel without rebooting the emulator or having to deal with portforwarding.
The whole game logic & architecture is standalone implemented. This also allows smaller components to be tested and not having to deal with packets.
Features:
Build using
You must be registered to see links
.
You must be registered to see links
You must be registered to see links
.
You must be registered to see links
&
You must be registered to see links
for unit testing.Multiple database support,
You must be registered to see links
,
You must be registered to see links
,
You must be registered to see links
etc.
You must be registered to see links
object mapper.JSON Configuration & live reload.
Distributed architecture.
Custom Game Protocol to communicate with different clients.
Game Features:
Quite a bit of features have already been implemented.
- Furniture (Placing, Moving, Clicking, Picking up)
- Bots
- Mod Tools
- Wired (Triggers, Effects & Conditions (Excluding Game Wired))
- Catalog
- Messenger
- Flash landing view, hall of fame, news list.
- User preferences
- Navigator
Examples:
Here is how in in the latest Java Arcturus 1.21.2 version give badge command is implemented:
Code:
public class BadgeCommand extends Command
{
public BadgeCommand()
{
super("cmd_badge", Emulator.getTexts().getValue("commands.keys.cmd_badge").split(";"));
}
[USER=2000310838]Over[/USER]ride
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
if(params.length == 1)
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_badge.forgot_username"), RoomChatMessageBubbles.ALERT);
return true;
}
if(params.length == 2)
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_badge.forgot_badge").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
return true;
}
if(params.length == 3)
{
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
if(habbo != null)
{
if (habbo.addBadge(params[2]))
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_badge.given").replace("%user%", params[1]).replace("%badge%", params[2]), RoomChatMessageBubbles.ALERT);
}
else
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_badge.already_owned").replace("%user%", params[1]).replace("%badge%", params[2]), RoomChatMessageBubbles.ALERT);
}
return true;
}
else
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection())
{
boolean found;
try (PreparedStatement statement = connection.prepareStatement("SELECT badge_code FROM users_badges INNER JOIN users ON users.id = user_id WHERE users.username = ? AND badge_code = ? LIMIT 1"))
{
statement.setString(1, params[1]);
statement.setString(2, params[2]);
try (ResultSet set = statement.executeQuery())
{
found = set.next();
}
}
if(found)
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_badge.already_owns").replace("%user%", params[1]).replace("%badge%", params[2]), RoomChatMessageBubbles.ALERT);
return true;
}
else
{
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO users_badges VALUES (null, (SELECT id FROM users WHERE username = ? LIMIT 1), 0, ?)"))
{
statement.setString(1, params[1]);
statement.setString(2, params[2]);
statement.execute();
}
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_badge.given").replace("%user%", params[1]).replace("%badge%", params[2]), RoomChatMessageBubbles.ALERT);
return true;
}
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
}
}
return true;
}
}
Here is the same thing in Arcturus 2.0:
Code:
public class BadgeCommand : ICommand
{
private readonly IBadgesService _badgesService;
public string Key => "badge";
public BadgeCommand(IBadgesService badgesService)
{
_badgesService = badgesService;
}
public async Task<string> Handle(IHabbo habbo, string[] parameters)
{
if (parameters.Length == 0 || string.IsNullOrWhiteSpace(parameters[0])) return "forgot_username";
if (parameters.Length == 1 || string.IsNullOrWhiteSpace(parameters[1])) return "forgot_badge";
var username = parameters[0];
var badgeCode = parameters[1];
return await _badgesService.GiveBadge(username, badgeCode) ? "given" : "already_owned";
}
}
From this example we can see that the original badge command had a lot of responsibilities, verifying that someone does not have the badge, inserting the badge in to the database etc. Starting with 2.0, all responsibilities are split up in small classes. In this case the IBadgesService is responsible to give a badge. No need to worry about it in the command if someone is online. Simple, clean & elegant code.
Last edited: