Kepler - v13 Emulator [C11, SQLite3, libuv]

Status
Not open for further replies.

Quackster

a devbest user says what
Aug 22, 2010
1,763
1,234
Kepler

What is this?
Kepler is a Habbo Hotel emulator that is designed to fully emulate the v21 version from 2008-ish era. The server is written in Java (JDK 10) and it's using various libraries, which means it's multiplatform, as in supports a wide range of operating systems. Windows, Linux distros, etc. I'm using MariaDB which is a fork of MySQL, so it has the same compatibility but it's more modern.

Libraries Used

- Netty

- HikariCP

- SLF4J

- Log4j

- Apache Commons-Configuration

Features

  • User
    • Login by SSO ticket.
    • Load fuserights.
    • Load credits.
  • Navigator
    • Lists all public rooms .
    • Lists all private rooms.
    • Navigator category management with rank checking for private rooms.
    • Navigator category management with rank checking for public rooms.
    • Show recent private rooms created in the categories even if the room owner wasn't online.
    • Create private rooms using the navigator.
    • Show own rooms.
    • Hide room owner name.
    • Edit room settings.
    • Delete room.
  • Messenger
    • Search users on console.
    • Send user a friend request.
    • Accept friend request.
    • Reject friend request.
    • Send friend message .
    • Delete friend.
    • Change messenger motto.
    • Mark messages are read.
    • Show offline messages.
    • Follow friend.
    • Automatic update friends list.
  • Private room
    • Walking.
    • Walk to door.
    • Chat (and message gets worse quality if you're further away from someone in public rooms).
    • Shout.
    • Whisper.
    • Password protect room.
  • Public Room
    • All possible public rooms added (some may be missing
    • All public rooms are fully furnished to what official Habbo had.
    • Sitting on furniture in public rooms.
  • Lido and Diving Deck
    • Change clothes working (with curtain closing).
    • Pool lift door closes and opens depending if a user is inside or not.
    • Buying tickets work for self and other players.
    • Diving.
    • Swimming.
    • Queue works (line up on first tile and the user automatically walks when there is a free spot).
  • Item
    • Show own hand (inventory) with items in it.
    • Place room items.
    • Move and rotate room items.
    • Pickup room item.
    • Place wall items.
    • Pickup wall items.
    • Stack items.
  • Catalogue
    • Show catalogue pages
    • Show catalogue items and deals (aka packages)
    • Purchase items and packages
  • Ranked features
    • Add badge automatically if they are a certain rank.
    • Command registration checking.
  • Commands
    • :about.
    • :help.

Screenshots

2YJVIox.png


NJ7ngtJ.png


Source code

The source code is available through GithHub at:

.

My DCR pack:

Code Snippets

NAVIGATE.java (building the navigator public/private rooms and categories)

Code:
public class NAVIGATE implements MessageEvent {

    @Override
    public void handle(Player player, NettyRequest reader) {
        boolean hideFull = reader.readInt() == 1;
        int categoryId = reader.readInt();

        NavigatorCategory category = NavigatorManager.getInstance().getCategoryById(categoryId);

        if (category == null) {
            return;
        }

        if (category.getMinimumRoleAccess() > player.getDetails().getRank()) {
            return;
        }

        List<NavigatorCategory> subCategories = NavigatorManager.getInstance().getCategoriesByParentId(category.getId());
        List<Room> rooms = new ArrayList<>();

        int categoryCurrentVisitors = category.getCurrentVisitors();
        int categoryMaxVisitors = category.getMaxVisitors();

        if (category.isPublicSpaces()) {
            for (Room room : RoomManager.getInstance().getRooms()) {
                if (room.getData().getCategoryId() != category.getId()) {
                    continue;
                }

                if (hideFull && room.getData().getVisitorsNow() >= room.getData().getVisitorsMax()) {
                    continue;
                }

                rooms.add(room);
            }
        } else {
            for (Room room : RoomManager.getInstance().replaceQueryRooms(NavigatorDao.getRecentRooms(30, category.getId()))) {
                if (room.getData().getCategoryId() != category.getId()) {
                    continue;
                }

                if (hideFull && room.getData().getVisitorsNow() >= room.getData().getVisitorsMax()) {
                    continue;
                }

                rooms.add(room);
            }
        }

        player.send(new NAVIGATE_LIST(player, category, rooms, hideFull, subCategories, categoryCurrentVisitors, categoryMaxVisitors, player.getDetails().getRank()));

    }
}

RoomEntityManager.java snippets

Code:
    /**
     * Setup handler for the entity to leave room.
     *
     *     [MENTION=2000183830]para[/MENTION]m entity the entity to leave
     */
    public void leaveRoom(Entity entity, boolean hotelView) {
        if (!this.room.getEntities().contains(entity)) {
            return;
        }

        if (entity.getType() == EntityType.PLAYER) {
            PoolHandler.disconnect((Player) entity);
        }

        RoomTile tile = entity.getRoomUser().getTile();

        if (tile != null) {
            tile.removeEntity(entity);
        }

        this.room.getEntities().remove(entity);
        this.room.getData().setVisitorsNow(this.room.getEntityManager().getPlayers().size());

        this.room.send(new LOGOUT(entity.getRoomUser().getInstanceId()));
        this.room.tryDispose(false);

        entity.getRoomUser().reset();

        // From this point onwards we send packets for the user to leave
        if (entity.getType() !=  EntityType.PLAYER) {
            return;
        }

        Player player = (Player) entity;

        if (hotelView) {
            player.send(new HOTEL_VIEW());
        }
    }
 
Last edited:

LeChris

github.com/habbo-hotel
Sep 30, 2013
2,725
1,307
A quick question they may seem kind of dumb; why do all older hotels always store data using SQLlite? Is it because they're much smaller in database sizes versus the modern hotels; or is it that they aren't meant to be accessed by a website with an authenticated session (since login is via client)
 

Quackster

a devbest user says what
Aug 22, 2010
1,763
1,234
A quick question they may seem kind of dumb; why do all older hotels always store data using SQLlite? Is it because they're much smaller in database sizes versus the modern hotels; or is it that they aren't meant to be accessed by a website with an authenticated session (since login is via client)

What do you mean "older" hotels? The other servers that do this, for example other servers that use this same revision such as, USA111 based servers (Debbo v3 and below, Bloodline, etc) stored data in .txt documents, Woodpecker, Debbo V4 and Chop stored data using MySQL. So no, it's not always hotels like this that always store data in SQLite, quite the opposite, actually!

And it's possible for multiple processes to access the SQLite database (SELECT query), and ideally Habbo emulators should be using SQLite anyways, as it's all hosted on the same server and it's a security risk to have a remote connection when it's not required.
 

LeChris

github.com/habbo-hotel
Sep 30, 2013
2,725
1,307
What do you mean "older" hotels? The other servers that do this, for example other servers that use this same revision such as, USA111 based servers (Debbo v3 and below, Bloodline, etc) stored data in .txt documents, Woodpecker, Debbo V4 and Chop stored data using MySQL. So no, it's not always hotels like this that always store data in SQLite, quite the opposite, actually!

And it's possible for multiple processes to access the SQLite database (SELECT query), and ideally Habbo emulators should be using SQLite anyways, as it's all hosted on the same server and it's a security risk to have a remote connection when it's not required.
I never knew the difference :p I always thought SQLlite was basically a local file that was just rendered as data within the emulator itself vs a server. Would SQLlite work for hotels that use multiple servers?
 

Quackster

a devbest user says what
Aug 22, 2010
1,763
1,234
I never knew the difference :p I always thought SQLlite was basically a local file that was just rendered as data within the emulator itself vs a server. Would SQLlite work for hotels that use multiple servers?

No, not without a third party tool.
 
Last edited:

BIOS

ಠ‿ಠ
Apr 25, 2012
906
247
Looks interesting.

Any reason you chose to go for C rather than something like C++?
 

BIOS

ಠ‿ಠ
Apr 25, 2012
906
247
Because C++ isn't an improvement over C, it's just different.
Some may prefer C++ as it generally speaking makes the project more maintainable. All depends really.

Anyhow, was more of a question than comparison - building it for performance or just personal preference choice?
 

Quackster

a devbest user says what
Aug 22, 2010
1,763
1,234
Some may prefer C++ as it generally speaking makes the project more maintainable. All depends really.

Anyhow, was more of a question than comparison - building it for performance or just personal preference choice?

But C++ and C aren't comparable, it's like saying either Java or VB, they're different. I chose it because I like how simplistic this language is, and how lightweight it is.
 
Pathfinder has finally been added with a thread pool system, supports multiple users, collision still needs to be further improved to detect public room furniture and other players, but so far it will stop you from walking outside the bounds of the map and stops the player from going up and down steep heights.

Short video for the interested:

s1fyPYx.png

 
Changelog

- Added better collision around solid furniture for public rooms.
- Added sitting and laying support public rooms.
- Added proper "chat" and shout" where if you're a certain distance away, the chat gets distorted, or you won't be able to hear it at all if you're too far away, but chat works for up close. Shout works globally across the room.
- Added guest room categories and private rooms appearing in these rooms.

- Fixed a few bits of bugged furniture for Club Mammoth/Lido I and II/Sunset Cafe
- Fixed heightmap for Club Mammoth (some reason wouldn't let you walk at all, until I found out I was using the wrong heightmap).
- Fixed bugs where the walk timer got initialised twice when going from a public to a private room.

Distorted chat:

Axkq7sx.png


From the chatter's perspective:

A0ZZb9g.png


Guest rooms and categories with population in navigator:

hp8gnjl.png
 

Pinkman

Posting Freak
Jul 27, 2016
814
193
But C++ and C aren't comparable, it's like saying either Java or VB, they're different. I chose it because I like how simplistic this language is, and how lightweight it is.
 
Pathfinder has finally been added with a thread pool system, supports multiple users, collision still needs to be further improved to detect public room furniture and other players, but so far it will stop you from walking outside the bounds of the map and stops the player from going up and down steep heights.

Short video for the interested:

s1fyPYx.png

 
Changelog

- Added better collision around solid furniture for public rooms.
- Added sitting and laying support public rooms.
- Added proper "chat" and shout" where if you're a certain distance away, the chat gets distorted, or you won't be able to hear it at all if you're too far away, but chat works for up close. Shout works globally across the room.
- Added guest room categories and private rooms appearing in these rooms.

- Fixed a few bits of bugged furniture for Club Mammoth/Lido I and II/Sunset Cafe
- Fixed heightmap for Club Mammoth (some reason wouldn't let you walk at all, until I found out I was using the wrong heightmap).
- Fixed bugs where the walk timer got initialised twice when going from a public to a private room.

Distorted chat:

Axkq7sx.png


From the chatter's perspective:

A0ZZb9g.png


Guest rooms and categories with population in navigator:

hp8gnjl.png
This is awesome buddy. Keep up the work, also will you be creating a rp for that version of your Emulator?
 

treebeard

Member
Jan 16, 2018
317
173
Because C++ isn't an improvement over C, it's just different.
^^^^^^
I wish I could pin this is in my University's CS Department lmfao!

Cool project though dude, I appreciate C and also the fact that this emulator will run in Linux.

2018 the year of the Linux desktop lolllll
 
Any updates on this @Quackster ? You seem to be one of two people, that I'm aware of, working on an old school emulator so I keep checking back here :p
 

Quackster

a devbest user says what
Aug 22, 2010
1,763
1,234
Sorry for the lack of updates, was busy in real life. I'm going to graduate with a bachelors in information communications technology in April. :D:

Changelog

- Started work on messenger.

- Added the "messenger" mission in the database, before they shared the same mission, which was incorrect.

- Added ability to edit room details.

I've opened up the source code repository for public viewing, and it's now available to view on GitHub at .

Images

2DzxF9G.png
 

LoW

Learner.
Jun 16, 2011
600
105
Wow! It brings back the memories the first time I played Habbo. Goodluck bro!
 

Kristo

Website & Software Developer
Feb 5, 2015
269
69
Oh my god.. Commenting on this flagged it up for me. This seriously brings back memories :( D:
 

Quackster

a devbest user says what
Aug 22, 2010
1,763
1,234
Updates

- Added: Lido queue.
- Added: Lido diving.
- Added: Lido voting.
- Added: Changing booths to change into swimmers for pools across all maps (Lido I, II and the Wobble Squabble area), with the curtains closing/opening etc.
- Added: Lido swimming, can enter/exit from ladders in the various pools in the public rooms, with splashing animation.
- Added: Catalogue page loading from database.

- Modified: Creating the server listening on its own threads so the main thread can now take commands, such as "quit" or "q".
- Modified: Implemented method to filter strings for various vulnerable characters when asked the client for user input.

- Fixed: Various memory leaks across the server.
- Fixed: A few pathfinder issues.

- Fixed: Segfault when using incorrect login details.
- Fixed: Segfault when trying to walk on a room after re-entry.

pDpMd1D.png


mZETsLi.png
 

Quackster

a devbest user says what
Aug 22, 2010
1,763
1,234
Updates

- Added: Show catalogue products on each page.
- Added: Show catalogue deals each page.

- Added: Item definitions (credits to Woodpecker for this :love:)
- Added: Item purchasing and inventory management (can't buy deals, yet).
- Added: Show hand items.

- Added: Redid pool queue and ticket management (only allow users on pool queue tiles if they have tickets).
- Added: Charge users tickets each time they dive.

- Added: Feature where certain headers are the only headers the connection is allowed to use until they log in, for security reasons.

- Fixed: Leaving in a sitting animation will show the user sitting next room they join.

Reminder: All source code is available here to play around with!

PtilxAp.png


7qfhjew.png
 
Status
Not open for further replies.

Users who are viewing this thread

Top