[NodeJS, PostgreSQL] Habbo Emulator

Status
Not open for further replies.

MayoMayn

BestDev
Oct 18, 2016
1,423
683
It's between Mongo, Postgre, or MySQL at the moment... still deciding.
Mongo's DB structure is a bit off, but its way more clean and faster than MySQL, and especially for this purpose.
NoSQL is made for multiple writes and read of data compared to MySQL.

We haven't seen a NodeJS emulator nor with NoSQL, so this might be the first?

Sent from my SM-G928F using Tapatalk
 

Jaden

not so active
Aug 24, 2014
886
263
Mongo's DB structure is a bit off, but its way more clean and faster than MySQL, and especially for this purpose.
NoSQL is made for multiple writes and read of data compared to MySQL.

We haven't seen a NodeJS emulator nor with NoSQL, so this might be the first?

Sent from my SM-G928F using Tapatalk
I've really been weighing Postgre and Mongo which are both NoSQL but Postgre has more MySQL-like features for relational databases


But I also spotted something interesting
 

MayoMayn

BestDev
Oct 18, 2016
1,423
683
I've really been weighing Postgre and Mongo which are both NoSQL but Postgre has more MySQL-like features for relational databases


But I also spotted something interesting
Well it looks interesting, and it's PDO compatible since its a RDBMS.
I'm pretty in love with Mongo actually.
 

ZealousOtter

New Member
Feb 17, 2017
16
11
Great project, looking forward to seeing more updates. As for the DB, I've worked a lot with all 3 (psql, mongodb, and mysql), and I'd vote go with postgres for this. Mongo is great when working with large amounts of data and no real certainty when it comes to structure. It's at it's best when used as a place to just dump a bunch of data with no schema needed. Since a Habbo Emulator doesn't really fall under the category of "big data", I don't think you should use mongo. Postgres is definitely right in the wheelhouse for what you'll be needing, and it performs better than mongo.
 

MayoMayn

BestDev
Oct 18, 2016
1,423
683
Great project, looking forward to seeing more updates. As for the DB, I've worked a lot with all 3 (psql, mongodb, and mysql), and I'd vote go with postgres for this. Mongo is great when working with large amounts of data and no real certainty when it comes to structure. It's at it's best when used as a place to just dump a bunch of data with no schema needed. Since a Habbo Emulator doesn't really fall under the category of "big data", I don't think you should use mongo. Postgres is definitely right in the wheelhouse for what you'll be needing, and it performs better than mongo.
Yes and no. It can be quite big data in the length, aswell as it reads and writes data almost every millisecond.
At this point I'd most certainly call it a preference, but to be honest PostgreSQL is probably the best choice for this.

Sent from my SM-G928F using Tapatalk
 

Jaden

not so active
Aug 24, 2014
886
263
VqEYJMq.png

WjYeSFy.png





Didn't start unit testing but I've added the /test/ directory with a client.js file to test packet sending but I'll add some spec files to test modules and code performance later on. I already know what I want to change and what I want to improve on... I usually leave a basic idea of that in comments within the source.



e37bd345630545d99a818b77c7ca590d.png

I also allowed for chain statements with the sendPacket function though I'd like to implement message queuing disregarding the fact that Node.js runs on a single thread I wanna test the performance for myself.



Also, I've decided on PostgreSQL.
 
8a9145f0b2e444ad9870fce4872b947f.png

 
Rewriting some of the initialization process using Bluebird Promises and async. This is because since some instances are exported through the index with back-end functionality that is expected to be cached upon startup, requiring files that are dependent upon these instances before they're initialized (because code runs asynchronously) results in null errors.

Also, implemented a basic User model but not sure how I will be managing this data in a Player (or User-something) object... I know I'm going to use Redis for caching such data but not sure which messaging library I wanna use for IPC.
 


"Promise" delivered.
 
Update log (3/6/2017):
1. Documented the Game Client class which I've been meaning to do for quite some time now


2. session.tryLogin now using Promises and player is now properly loaded and data cached asynchronously (Redis not implemented yet)




3. Added the 'habb_db' SQL file for viewing purposes (or testing out the BETA yourself)




I'm thinking about skipping the navigator for now and just going ahead and doing rooms first so I can have a public client up and running sooner rather than later.
I'm gonna start unit testing tomorrow probably using Mocha, but as soon as I start working on rooms I'm going to implement Redis, RPC library (probably ZeroMQ), etc. and I'm thinking of writing some of the game modules in Python (hence the RPC).

KpBISnK.png

1MJ8OFC.png

 
Added sendQueue + flush functions as promised.
 
SlDiBmh.png

Started working on Messenger, rooms still disconnect though but maybe I need to do a few more packets before it'll work.
 
Forgot to mention, recoded the packet initialization process and now the startup time is significantly faster than before (it keeps getting faster as time goes on tbh).



I'll be working on more packets and writing in more functionality soon, next to do is navigator and then finish rooms. I'm going to go back and add actual database functionality to existing packets which were just set placeholder values but I've been trying to hold off because I don't have much ideas on db design.

Again for packets:
Added in .compose() abstract function to outgoing packets for better practice. Targeted for packets with "more" functionality with others but I think this might end up being standard.

More documentation on why I added this method:


I'm not going to make the outgoing packet classes static like other emulators and people who recommend them because it doesn't make sense to me. Especially since in most of those emulators an instanced object is composed in that static method anyways (typically "ServerMessage" or something like that).
 

Adil

DevBest CEO
May 28, 2011
1,278
716
Don't use Mongo. It's bullshit. There's really no point in using Mongo unless you need a document database (Habbo use MySQL, so...). Postgres is pretty much superior in every area of database systems. Use that!

Good progress, I like that you're leveraging node.js and es6
 

Brad

Well-Known Member
Jun 5, 2012
2,320
993
Thread closed due to no recent updates. If you wish to have this re-opened please contact me via PM. Thank you.
 

Jaden

not so active
Aug 24, 2014
886
263
97d8b32619944c52891b05d111d8e7de.png


rooms and some of the navigator loading... still gotta do database structure for em tho :'(
 

TheGeneral

Active Member
Dec 27, 2016
147
161
It's between Mongo, Postgre, or MySQL at the moment... still deciding.
You know, there is this thing called interfaces in OO? Assuming nodejs also supports something like this why not build a generic interface so you can use that and have people use whatever they want...
 

MayoMayn

BestDev
Oct 18, 2016
1,423
683
You know, there is this thing called interfaces in OO? Assuming nodejs also supports something like this why not build a generic interface so you can use that and have people use whatever they want...
Because people are some lazy bastards that wants to be spoonfed. Also why would you even do that? Some of them is NoSQL.
Anyway you mean something like or TypeScript that implements Flow in it?
 

Jaden

not so active
Aug 24, 2014
886
263
You know, there is this thing called interfaces in OO? Assuming nodejs also supports something like this why not build a generic interface so you can use that and have people use whatever they want...
I basically re-invented the wheel with interfaces, there are none in Node.js afaik (haven't coded in a while) but this is basically how I parsed an interface.

Also, when I was working on this earlier in development. I was having a hard time researching the best way to go about designing the database (I knew there had to be a better way than how typical emulators do it) but I wasn't too much of an expert in that so I don't see support for anything other than Postgre for now.

(Parsing the packet.js "interface")
 
Status
Not open for further replies.

Users who are viewing this thread

Top