PDA

View Full Version : Question about programming



oops_ur_dead
September 25th, 2016, 11:26 AM
What language is the server/client written in? Is the game open-source?

Voss
September 25th, 2016, 01:01 PM
Server's in nodejs and javascript. the web client is javascript/html, and android is... android.

i'll pm you the repo its in

oops_ur_dead
September 25th, 2016, 02:52 PM
Nice.

Have you ever considered adding the option for users to program their own roles? I was working on a Java-based mafia game that had roles and a lot of the game logic programmed in Javascript, which would be executed on the server on the fly. The idea would be that users could easily add/tweak settings and roles. It never really went anywhere, but it would be a cool idea.

Voss
September 25th, 2016, 05:05 PM
I've been designing the game so that it'd be easy for me to implement new roles easily. It took me all of 1 hour to have Poisoner added and tested.

However, any way I think of trying to do custom roles via programming sounds like a security nightmare. How were you implementing it in your version?

oops_ur_dead
September 25th, 2016, 05:26 PM
I've been designing the game so that it'd be easy for me to implement new roles easily. It took me all of 1 hour to have Poisoner added and tested.

However, any way I think of trying to do custom roles via programming sounds like a security nightmare. How were you implementing it in your version?

I used an embedded Javascript engine called Rhino and sandboxed all user-provided code so that it couldn't access Java classes/methods, apart from some specific whitelisted ones for utility purposes.

Cryptonic
September 26th, 2016, 09:50 AM
I'd like this a lot, but it seems like there would be a lot of shit roles & troll roles.
Would this be just for the 1 game they are created for, or would they enter a permanent database?

Voss
September 26th, 2016, 12:52 PM
The way I currently have it set up, is that only people with strictly one-phase night actions would be able to be inserted into the game. Any special day mechanics, or special two-time passes would be tough to implement.

I guess it could be in a permanent database connected to the user who created it.

Apocist
September 26th, 2016, 09:36 PM
Apo was doing something similar with the custom provided roles using a sandboxed javascript environment. It wasn't the best of implementations, but it worked somewhat in eMafia. There were no hard coded roles.

oops_ur_dead
September 28th, 2016, 12:49 PM
Apo was doing something similar with the custom provided roles using a sandboxed javascript environment. It wasn't the best of implementations, but it worked somewhat in eMafia. There were no hard coded roles.

Yep, the actual Java implementation for my finished product was intended to be pretty bare-bones, essentially just a chat client with some Mafia-necessary stuff, like ability to input actions. The implementation of much of the game logic, such as routing chat messages, night actions, win conditions, voting, etc., were all implemented in Javascript. The intention was to allow people to change even the most low-level parts of the game, to allow for unusual setups like Kingmaker.

It never got farther than writing part of the engine, though.