RPG Game NodeJS

RPG Game NodeJS


So recently I’ve created this thread: https://www.freecodecamp.org/forum/t/is-this-worth-it-php-game/230942

Long story short I started making this game using Laravel but lost motivation. After somewhere half year few people gave me motivation to finish this game and I’ve made it with NodeJS and socket.io

You can check this out here: https://mystery-of-dungeons.herokuapp.com/

It’s probably unlimited possibilities how can I improve this game. But be real it’s really tedious to create this kind of game all alone atleast for me. So I hope you will like it! :slight_smile: It’s the first time I’ve created a game. :slight_smile:


Love it. Just cant play Offline for maintenance. Pls fix it and i want to do my first battle!


Sorry someone just managed to do some kind of injection and find a way to get how much gold he wants. So I’m searching for solution… at the moment… Don’t know how it’s possible to change the js code itself in the game

Haha now I know he was running function in console in chrome tools. But I don’t get it how to prevent that?


Sounds bad. I think there is no way to prevent commands from console. :frowning: Need to figure out somehow like do it in NODE JS side so the user cant inject how to add gold.


So I just tweaked a little bit of code and made gold, exp etc on serverside more than it was before. Go try it out now: https://mystery-of-dungeons.herokuapp.com


Well is awesome start! But offline again :slight_smile: But dont worry somehow you will figure out as you made it!


Bring your game back online mate!


I’m at my job currently. Need to fix a little bit of code and I’ll release it. :slight_smile:


Do you need a hand with fixing it?



If you are keen to make it open source and put a repo on github, I would likely make some contributions


Now it’s less cheatable but can’t figure out how to prevent socket emits per second. Let’s say if user in fight sends more than 20 emits of attacking another user per second than like freeze account for 5 min or show some captcha.


I want to give it a try. Please make it online


It will be soon probably :slight_smile: Don’t have much time because I have a full time job :slight_smile:


it would be nice if you could leave the game live.

Then you can clear the leaderboards to give everyone a fair start once you have fixed the bugs :slight_smile:


https://mystery-of-dungeons.herokuapp.com/game ok it’s live again for testing :slight_smile: Also probably will change website theme to more stylish in the future :slight_smile:


It looks awesome friend :smiley: Are you planning to keep updating the game?


Yeah probably. Will shut it down later. And change all the styles to make it non classic but more todays version. Also will add guilds, forum etc


Hey there! I haven’t posted here in ages, but here it comes!
@MadIce In essence the server / app should be the only source of truth for the game core functionality and any resources that the players are to own.
As for the solution to limiting the number or requests I think you can rate limit by the number of triggers per any given timeframe on the server as well. You can run your sockets almost like a middleware on node where you return if the current player shouldn’t be able to take any actions.

In essence all the game logic should run on the server.

A relatively easy way of preventing unfair socket flooding without kicking the player is implementing a Finite state machine, eg. each character has several states say [‘ready’, ‘resting’] to simplify. For each attach you check the condition on the server - which is the only source of truth and voila - even if someone sends a 100 requests you can just kindly reply not to cheat, or even punish them!

So, if there is some reward generation - do it on the server.
If there is some damage calculation - do it on the server.
And so on and so forth! : )

Put it back live, I would love to check it out!: )


Hey @jadczakd TY for reply! I made a little different approach with attacking. At first when user finds another user to fight there is new temporary fight created in database. And in that collection can’t be more than one the same user at the time. So you always have to pick user at first to start a fight. :slight_smile: Also added that after attack there’s one second delay and then you can attack again. And yeah everything is now in on serverside :wink: Just fixing few more bugs and I’ll run it again :slight_smile:


https://mysteriousdungeons.herokuapp.com/game game is alive again :slight_smile: