Good Luck..
This is a discussion on NexusServer v2 (C++/Qt) within the Habbo Development forums, part of the Habbo Hotel category; NexusServer v2 Current version: v2.0.0 r169 (SVN only) A Habbo Hotel server core written in C++ using the Qt Framework. ...
NexusServer v2
Current version: v2.0.0 r169 (SVN only)
A Habbo Hotel server core written in C++ using the Qt Framework.
Supported protocols: (Untested versions followed by a question mark, but are assumed to work)
Shockwave: v8? v9 v10? v11? v12? v13 v14 v15 v16 v17? v18? v19?
Hello everyone, some of you may remember NexusServer, a project Ktae and I worked on in June-ish. Our servers are back up, and I've decided that though this isn't a project I can profit from (or even put into something like my portfolio,) I'd really like to finish it. A Few days ago Ktae wrote a nice socket/thread pooling/queue system, so using it I've decided to restart NexusServer. Most of the old code was hackish/stubs so I'll be starting pretty much from scratch.
Server specific features:
Code:- C++ (Qt, multiplatform) - Thread pooling system (currently in need of a few fixes) - Thread safe packet broadcasting using Qt's Signal/Slot system - QSql (Compatible with a wide array of drivers, from SQLite to MySQL to ODBC - Optional native unix-like terminal implementation for windows and curses support where applicable (incomplete) - INI-style configuration - language binding support
Currently implemented (but most likely incomplete) features:
Code:- encoding (VL64/B64) - non-sso login - non-sso registration - updating figure/motto/etc - public room list (stub) - private room categories - room creation (the client does this improperly) - room listing (complete) - own room listing (complete) - entering rooms - room user listing (incomplete) - chat - temporary warping until pathfinding - catalog - hand (perfect) - furniture (under dev) - posters - spaces (wallpaper/floor) - console missions - searching for users in the console - friend requests (partial) - messages (partial) - public rooms (partial, currently only in the navigator)
Changelog:
Code:Revision 169 -Cleaned up room.cpp Revision 168 -Fixed public room entering Revision 167 -repaired the heightmap db Revision 166 -Continued implementing public rooms Revision 165 -Fixed db, public room heightmaps Revision 164 -Fixed a few things in the db, continued work on public rooms heightmap parser Revision 163 -Continued implementing public rooms Revision 162 -Added db table publicheights, imported public room heightmap and door location data Revision 161 -Continued implementing public rooms, added new debugging string to lang file, started adding public room implementations into room. Revision 160 -Cleaned up the debugging a bit Revision 159 -Imported some of the public room data Revision 158 -Implemented the public rooms navigator packet Revision 157 -Updated public rooms db table, continued implementing public rooms in the navigator Revision 156 -Started properly implementing public rooms, added DB table publicrooms Revision 155 -Implemented Opcode::RequestUpdateRoomInfo, Opcode::RequestUpdateRoomName. Currently only descriptions and names are modifiable. Revision 154 -Started implementing Opcode::RequestUpdateRoomInfo, Opcode::RequestUpdateRoomName Revision 153 -Implemented Opcode::requestRollDie stub Revision 152 -Started implementing Opcode::requestSendMessage Revision 151 -Created table messages for the messenger/console Revision 150 -Continued work on the friends list Revision 149 -Fixed friend request DB error Revision 148 -Continued implementing friends Revision 147 -Continued implementing friend requests Revision 146 -Implemented ConfigurationCore::getBool(key) and implemented some db options Revision 145 -The config, db, and lang file are now loaded from the run directory not the static path they were using before. Revision 144 -Fixed a few things, implemented Opcode::requestStop stub Revision 143 -Fixed Opcode::RequestInitializeMessenger to work with console missions. Revision 142 -Implemented Opcode::RequestSetConsoleMission, added consolemission to the accounts table. Revision 141 -Cleaned up the startup debugging Revision 140 -Switched the hardcoded strings in Protocol to with with the new language system Revision 139 -Started implementing LanguageCore Revision 138 -Started coding ConfigurationCore. Revision 137 -Implemented temporary fusestring system, and implemented waving+drinks (though all functions are currently infinite) Revision 136 -Implemented proper rotation on warp in prep for pathfinding Revision 135 -Started implementing room modification Revision 134 -Implemented room searching Revision 133 -Committed updates since server downtime Revision 132 -Started implementing friend requests Revision 131 -Fixed female figures in the console search, users are now properly removed from the list of online clients. Revision 130 -Cleaned up the opcodes a bit Revision 129 -The hand is now properly updated when placing paint/flooring and when picking up items. Revision 128 -Made furniture handling more efficient Revision 127 -removed bool wallitem parameter from Furniture::Furniture Revision 126 -Implemented picking up items Revision 125 -Fixed the "Furniture is loading..." box if there is a poster in the room glitch Revision 124 -Fixed some issues with the license Revision 123 -Fixed hotel view disconnect crash Revision 122 -Fixed room shifting Revision 121 -Fixed room creation crashes (but it's still not proper) Revision 120 -Fixed the "under" furniture/walls issue caused by doors Revision 119 -Proper player locations are now sent when you enter a room, and users will now be placed at the door when they enter the room. Revision 118 -Made warping pay attention to the heightmap Revision 117 -Room furniture is now saved to/read from the DB when a room is unloaded/loaded. Revision 116 -Furniture in a user's hand is now saved when they disconnect, and reloaded when they log in. Revision 115 -Continued fixing re-ender poster data Revision 114 -Credits are now updated when purchasing items (but not changed) Revision 113 -Fixed "r" posters Revision 112 -Started implementing sending poster info to the client when they re-enter the room Revision 111 -Fixed the catalog Revision 110 -Fixed buying posters, implemented posters :'D Revision 109 -Started implementing purchasing posters Revision 108 -Clients are now told when a user leaves the room Revision 107 -Fixed the hand Revision 106 -Fixed a bug Revision 105 -Implemented spaces Revision 104 -Started implementing spaces, changed default floor/wallpaper to match the old retail style Revision 103 -Started implementing furniture DB saving, and fixed posters in the catalog Revision 102 -User data is now saved to the DB when a user disconnects. Revision 101 -Fixed multiplatform compiling Revision 100 -Implemented furniture stacking http://filebeam.com/8fdef8013c1f0d8639c3c46552599b5e.jpg Revision 99 -Fixed a few things Revision 98 -Implemented item signatures Revision 97 -Did some testing Revision 96 -Implemented furniture movement/rotation Revision 94-95 -Fixed furniture placement Revision 93 -Started implementing furniture Revision 92 -Fixed hand page... leaking... Revision 91 -Perfected the hand Revision 90 -Got the hand... kinda... working. Revision 89 -Made purchasing better Revision 88 -Implemented Packet::appendTabString, Packet::appendCarriageString, Packet::appendTaggedString, and integrated them into Protocol Revision 87 -Implemented Room::ownerid Revision 86 -Started implementing the hand Revision 85 -Fixed db, implemented Furniture Revision 84 -Fixed switching rooms, changed furniture table structure Revision 83 -Cleaned up the output, fixed a few things Revision 82 -Started implementing Opcode::RequestPurchaseItem Revision 81 -Fixed navigator bug Revision 80 -Fixed the navigator packet :'D Revision 79 -Fixed a couple things Revision 78 -Implemented FurnitureProfile, FurnitureCore, fixed the "DG" stub Revision 77 -Fixed the catalog :'D (added a few new stubs) Revision 76 -Implemented console searching Revision 75 -More catalog work Revision 74 -Fixed DB, continued implementing catalog pages Revision 73 -Implemented Opcode::RequestCatalogPages Revision 72 -Added catalog data to the DB Revision 71 -Fixed a couple issues Revision 70 -Clients are now removed from their current room when they enter a new one Revision 69 -Updated the license (currently in main and protocol) Revision 68 -Started implementing FurnitureCore Revision 67 -Started implementing Opcode::RequestSearchUsers Revision 66 -Cleaned things up a bit, added 5 more threads to the default task system size Revision 65 -Created table ProfileOverrides Revision 64 -Fixed a couple things Revision 63 -Hackey (but perfect?) club clothing implementation Revision 62 -Fixed a few things Revision 61 -Implemented Opcode::InitMessenger Revision 60 -Renamed sendPacket(!Packet&) -> writeData(!Packet&), sendPacket is now reserved for sendPacket(Packet&) Revision 59 -Implemented telling other clients when someone enters the room Revision 58 -Implemented warping Revision 57 -Added some debugging to try to fix an uncommon issue, added experimental license Revision 56 -Clients now leave the room when they enter a new one. Revision 55 -Implemented shout, whisper Revision 54 -Cleaned up the output Revision 53 -Implemented Opcode::RequestSay Revision 52 -Implemented broadcasting packets to all clients in a room (Thanks Ktae) Revision 51 -Made the hotel view button remove the client from the room Revision 50 -Implemented room user listing Revision 49 -Implemented linking clients to rooms Revision 48 -Implemented more room info (stubs,) this is the result: http://filebeam.com/9301b4cc1fc957dd4b0bb1e8c3fd05a3.jpg Revision 45-47 -Implemented Opcode::RequestHeightmap Revision 41-44 -Continued implementing room entering
Example of an implemented packet with the packet builder (private room category listing, incomplete but commented):
Also, some of the packets require slightly different handling, the packet system also supports methods for those, here is an example of that:PHP Code:--- at the beginning ---
int showfull = pak.readVL64();
int cat = pak.readVL64();
--- case 4 (private rooms root)? in the switch(cat) statement ---
query.prepare("SELECT id, title FROM roomcategories");
if(query.exec()){
Packet npak("C\\");
npak += showfull;
npak += cat;
npak += false; //?
npak += "Guest Rooms";
npak += 0;// current users
npak += 0;// max users
npak += 1;// parent id (should this be cat?)
//npak += 4;// rooms count
while (query.next()) {
npak += query.value(0).toInt();
npak += 2; //?
npak += query.value(1).toString();
npak += 0;//current visitors
npak += 0;//max visitors
npak += cat;
npak += false; //?
}
client->sendPacket(npak);
}
break;
--- another packet, full this time ---
case Opcode::RequestEnterRoom:
{
if(client->isInRoom)client->inRoom->removeClient(client); // remove the client from the current room
client->inRoom = Room::getRoom(pak.buffer.mid(pak.position,pak.buffer.length() - 5).toInt()); // D: plain text int
client->inRoom->addClient(client);
if(client->isInRoom){
Packet npak("@v");
npak += false; //?
npak += false; //?
npak += client->inRoom->id;
npak += client->inRoom->ownerstr;
npak += client->inRoom->model;
npak += client->inRoom->title;
npak += client->inRoom->description;
npak += true; //show owner
npak += true; //?
npak += false; //?
npak += 0; //current users
npak += 25; //max users
client->sendPacket(npak);
npak = Packet("Eb");
npak += 0;// category, nyi
client->sendPacket(npak);
}else{
//client->writeData("BKRoom not found!\001");
Packet err("BK");
err.appendRawLangString("error.room_not_found");
client->sendPacket(err);
}
break;
}
The latest code for the implementations of packets should always be available here aswell.PHP Code:case Opcode::RequestUserList:
{
Packet pae("@\\");
foreach(Client* pointer, client->inRoom->clients) {
pae.appendTaggedString('i', QString::number(pointer->userid));
pae.appendTaggedString('a', QString::number(pointer->userid));
pae.appendTaggedString('n', pointer->name);
pae.appendTaggedString('f', pointer->figure);
//pae.appendTaggedString('l', "5 5 1.0");
pae.appendRawString("l:");
pae.appendString(QString::number(pointer->xloc), ' ');
pae.appendString(QString::number(pointer->yloc), ' ');
pae.appendCarriageString(QString::number(pointer->zloc, 'f', 3));
pae.appendTaggedString('c', pointer->motto);
pae.appendTaggedString('s', pointer->gender);
pae.appendRawString("\rb:\x0d"); // yellow
}
client->sendPacket(pae);
break;
}
Possible future features/ideas:
Code:- Remote control panel (desktop/possibly mobile) - Server is set up to easily implement multiprotocol support in the future - Javascript module system for easy server expansion
Known issues:
Code:- Clients are not deleted quite properly yet, they can sometimes lead to a small (but not continuous) memory leak This should be fixed once someone gets the time - Poor error handling, sometimes a broken task can crash the server. - A few packets are const char* stubs, and need to be updated, they include (server->client header): - DU // encryption? thanks lab-hotel - DA //date string/session variables? - DZ //unknown registration - DO //unknown registration - CY //unknown registration - Dt //? - Dp //? - Dy //? - Dz //? - DB //room load advertisement - CP //unknown? - @^ //unknown room related? - @G // subscription information (stub) - "Yay! It's being delivered now." message appears when the client sends AXCarryItem or whatever, That packet is still unhandled so the client seems to be doing this all on it's own, maybe I need to tell it NOT to do that? - Some rugs are broken, the produce a PH box, this shouldn't be too hard to fix - Sometimes the hand doesn't update when you place an item down so it stays in your hand, it'l go away if you re-open the hand or put it down though, this shouldn't be too hard to fix either. (items arent being duplicated, the client just isnt being updated correctly, this has been improved) - If the server is spammed with an impossible amount of packets, the task system can break, a fix is currently in the works. - The thread pool system is in need of some fixes (not hard ones though), some also pertaining to the above issue.
Here is a recent youtube video demonstrating the functionality of the server: (severely outdated) ( new video coming soon )Furniture, a taste of multiplatform
And here are the old videos, more will be placed here as they become outdated:
Spoiler:
Also here is a video I made showing some early stress testing of the server, this is outdated though.
Screenshots:
Spoiler:
How to compile:
Spoiler:
Links
Project's SVN: http://svn.nexustools.net/nexusserver2/trunk/ (active development)
SVN Browser/source viewer: http://www.nexustools.net/#/svn/nexusserver2/trunk
Old server SVN (buggy and depreciated): http://svn.nexustools.net/nexusserver/trunk/
Old server root page (compiled downloads, somewhat dysfunctional): http://www.nexustools.net/#/nexusserver
Testing sandbox: http://habbo.nexustools.net/
This project is far from complete, I expect it to be updated often.
We're looking for any help we can get on this project, that includes suggestions, so if you think you have something to contribute feel free to PM me or post here.
Last edited by Aerospark; 04-05-12 at 06:36 PM. Reason: added new revisions
Good Luck..
Looking good, But good luck
Awesome man! I loved your first version from the start and it was such a bummer that you stopped developing! I'm glad you're back. Simply awesome!
Your first server was awesome, good to see your back ^^
I ported the vl64 and b64 stuff that Jeax wrote, if you need itPHP Code:static string Encode_VL64(int i){
string s = "";
char res[6]; //assign the var res to a a char array - len6
int p = 0;
int sP = 0;
int bytes = 1;
int negativeMask = i >= 0 ? 0 : 4; //? : = if else clause
i = abs(i);
res[p++] = (char)(64 +(i & 3));
for (i >>= 2; i != 0; i >>= 6){
bytes++;
res[p++] = (char)(64 + (i & 0x3f));
}
int null = 0;
res[sP] = (char)(res[sP] | bytes << 3 | negativeMask);
string tmp = string(res);
tmp.erase(2,22);
return tmp;
}
static string Encode_B64(int i){
string s = "";
for (int x = 1; x <= 2; x++){
s += (char)((char)(64 + (i >> 6 * (2 - x) & 0x3f)));
}
return s;
}
static int Decode_B64(string strVal){
int intTot = 0;
int y = 0;
for (int x = (strVal.length() - 1); x >= 0; x--) {
int intTmp = (int) (char) ((strVal.at(x) - 64));
if (y > 0) {
intTmp = intTmp * pow(64.0, y);
}
intTot += intTmp;
y++;
}
return intTot;
}
static int Decode_VL64(string raw){
int pos = 0;
int v = 0;
bool negative = (raw[pos] & 4) == 4;
int totalBytes = raw[pos] >> 3 & 7;
v = raw[pos] & 3;
pos++;
int shiftAmount = 2;
for (int b = 1; b < totalBytes; b++)
{
v |= (raw[pos] & 0x3f) << shiftAmount;
shiftAmount = 2 + 6 * b;
pos++;
}
if (negative)
v *= -1;
return v;
}
Good luck with this :D
Posted via Mobile Device
Our linux cPanel server is called Nexus. xD
Good luck!![]()
Nice, glad to see it's old school :D
Good luck :)
Thanks, Facebook
Rest In Peace, To my dog Sparky. Never forgotten <3
Skype: Danny.runsnyc
msn: dannyrunsnyc@hotmail.com
@H Useable outfit pieces aye! @H[100,105,etc]Code:DU //? @H //usable outfit pieces? DA //date string? DZ //unknown registration DO //unknown registration CY //unknown registration Dt //? Dp //? Dy //? Dz //?
DZ - (register) On the screen when password is filled in, approve the password is disapprove DZbool
DO - (register) aprove email, "DO"
.
Thanks :) yeah, the things that are static aren't that important to the function yet. (Except that outfit pieces one, I need to find a proper list of the club vs free outfit configurations.) Apparently sending fuse_use_club_outfits doesn't do anything.
@Caustik, Thanks :o but I was able to move the old encoding methods over from the other server and improve them a little, so that's already covered.
Happy new years everyone :)
Edit: The changelog has been updated. I implemented listing your own rooms, and started implementing entering rooms.
Last edited by Aerospark; 05-01-12 at 09:04 PM.
@Aero, it merges posts when you post twice
Looks good, will set up an environment for testing and developing upon this soon ^^
Good job, but there enough servers in develop -.-'
meepmeep