Best Approach for Multiplayer "A Dark Room" Equivalent?

0 favourites
  • 7 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Hey guys,

    Background:

    I have been on and off working on the design for a game similar to A Dark Room; a game that is mostly text but you get to a point in the game where you have this world map that you traverse by moving around. Fighting or events are handled through stats in a turn based fashion. The multiplayer part should functions similar to Kingdom of Loathing; you login and play in your browser, no client to distribute, nothing... just login to a webpage hosting the game.

    I have also been using Construct 2 on and off for quite a while now. I have managed to read and understand the multiplayer general tutorial as well as the chat one. I tried to follow the other ones, but they felt less like tutorials and more like describing what is being done. Unfortunately, I don't get along well with these kind of tutorials so I couldn't finish them or understand much from them. I am one of those people that like hand holding at first (a detailed step by step; do that and do this with explanation) and then I am left to my own devices at the end.

    The problem

    I would like to use Construct 2 for this project instead of let's say Unity (I have used it for almost a year) as I really like using it and I can get things done MUCH faster than in Unity (I am not a coder at the end of the day). My problems are:

    • My guess is the multiplayer aspect of the game isn't done by connecting hosts to peers; you login, find a page and start playing. You can see others around you (think the old, old RuneScape but far less flashy and more primitive of course). So could I do it using Firebase only? Would it be too complicated?
    • Which framework works best with this kind of multiplayer; Photon, C2 Muliplayer or Firebase? Why?
    • Anyone knows of a tutorial that is written for idiots? I searched high and low for Photon and only found 1 that shows a setup no more. Firebase has no tutorial outside of the setup as well and C2's Multiplayer tutorial aren't step by step at all.

    What I am looking for -- not a recruiting request, trust me!

    I am looking for help really from the veterans and experts or anyone that knows well what I am talking about. I really, would like someone to put me on the correct road and have a discussion on how this can be done in the least complicated of ways. Aside from the obvious reason that I want to build this for myself, I also would like to use this as a showcase for a course I would like to teach for students in an international school. To cut the story short, I already taught a similar curriculum and I am trying a different method for motivational purposes this time.

    Thank you very much in advance and looking forward to your help and discussions.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I have built my online space arena game around firebase, and I can help you create your game around it. Firebase works so well for me mainly because it's so simple. The free pricing plan is great for beginners and includes enough bandwidth for almost everything you would use it for. For your game, you could set up a custom email and password login page, then after they are signed in you can load their data from the database (using the generated userid). I haven't dealt with the custom email/password login in firebase but all of the different login methods work the same way and all can be used to get a userid. Other options for the login include: Google, Facebook, Twitter, and GitHub. After this you could sync their progress to the database periodically or however you would like the save function to work. If you would like to go this route you can find info on the firebase plugins as well as sample capx's here (just look for firebase in the list). You would need the firebase_apiv3, firebase, and firebase_authentication for a start. The other plugins are optional depending on what you want to do.

  • I have built my online space arena game around firebase, and I can help you create your game around it. Firebase works so well for me mainly because it's so simple. The free pricing plan is great for beginners and includes enough bandwidth for almost everything you would use it for. For your game, you could set up a custom email and password login page, then after they are signed in you can load their data from the database (using the generated userid). I haven't dealt with the custom email/password login in firebase but all of the different login methods work the same way and all can be used to get a userid. Other options for the login include: Google, Facebook, Twitter, and GitHub. After this you could sync their progress to the database periodically or however you would like the save function to work. If you would like to go this route you can find info on the firebase plugins as well as sample capx's here (just look for firebase in the list). You would need the firebase_apiv3, firebase, and firebase_authentication for a start. The other plugins are optional depending on what you want to do.

    Thanks for your reply. I have used Firebase before and was able to get the Authentication part working fine, I had a huge problem with actually getting anything written in the database based on the authentication. If I go that route, I definitely would need help in that, if you don't mind.

    The login system I created back then was based on getting an email and password from the user just like any website/forum would. It worked fine, but when I implemented a chat, it didn't work. I even got Rex's chat example and changed the API key and all that and replaced them with my own test app and it didn't work.

    Aside from that, It is daunting that I'll have to do all the syncing manually. A Dark Room has elements where you play real time controlling an "@" symbol type character through a map. Would Firebase be a good fit for that?

    I tried your game out and that is a unique idea you have there. Interesting. I saw that you have multiplayer with the "coming soon" poster. Are you working on a Firebase multiplayer?

  • Are you thinking about my game Tank Trouble 2? I was talking about space arena. For my game I am mostly using Construct 2's multiplayer because the matches have several objects that are constantly being created and destroyed. If I used firebase for a game like this it would probably cause my database to run out of bandwidth fairly quickly. I am using firebase for storing groups for group matches, and I might also store some basic info about the match in the database as well (players left, time, type of match). From what you're describing though it sounds like your game is fairly simple. However I will need a lot more info on how specifically you want the game to work in order to decide how or if firebase will work for you. How will the players interact with each other? What is the goal? What will the map contain?

    Also if you still have that chat example that you tried to modify I could see how you can get it working again.

  • Are you thinking about my game Tank Trouble 2? I was talking about space arena...

    I didn't know you had another game. I only saw the space one.

    The best way to describe the game is to link it to A Dark Room really. It is a similar in concept. You have essentially a web page with multiple buttons, you click on a button that does a certain action. For example, you might have a button similar to Dark Room where you click on it to get iron for example. The button has a loading sequence that displays the time it takes to gather the iron. When it is done the iron is added to your inventory.

    However there is an exploration part where you have this world map that looks similar to this. Each square in that grid is a room (not a multiplayer room, but a location in the game) where if you click on it (or perhaps using WASD) you can move there. This means movement is grid based.

    Combat in the game happens automatically with some interaction from the user. A somewhat similar example is the combat that occurs in

    Subscribe to Construct videos now

    but you press buttons for your skills rather than type the commands.

    As for the interaction between players, it would probably be restricted to trade and chat.

    After a few hours, I was able to fix the problem where the database was inaccessible even when I was authenticated. It turned out I changed the rules on the database to Authenticated Users not public or default. Which seems to require that when I update the database or write to it to use the path "users/" "userID" to write into the database. I was only using the userID directly without the first part. So now I can write to the database using the userID specifically.

  • You might be able to accomplish this by storing a list of object positions (for things that can be destroyed or moved), a section for specific user data (for battles and trading) , and a small part to store an array of the land data (water, land, bridges, stuff that doesn't move) When the user logs in you could download everything from the database and set up "Child changed", "Child removed", and "Child added" listeners for the locations directory. That way if something is moved or changed you can update the change the graphics on the map. I also recommend putting the item name as the item type followed by a uid. An example for the locations directory:

    "locations"

    ..."user097610" <Id for user is their userid

    ......"x":0

    ......"y":0

    ..."tree190801"

    ......"x":0

    ......"y":1

    ......"other data":?

    As for displaying all this data, you could use different tilemaps, one for objects and one for terrain.

  • You might be able to accomplish this by storing a list of object positions (for things that can be destroyed or moved), a section for specific user data (for battles and trading) , and a small part to store an array of the land data (water, land, bridges, stuff that doesn't move) When the user logs in you could download everything from the database and set up "Child changed", "Child removed", and "Child added" listeners for the locations directory. That way if something is moved or changed you can update the change the graphics on the map. I also recommend putting the item name as the item type followed by a uid. An example for the locations directory:

    "locations"

    ..."user097610" <Id for user is their userid

    ......"x":0

    ......"y":0

    ..."tree190801"

    ......"x":0

    ......"y":1

    ......"other data":?

    As for displaying all this data, you could use different tilemaps, one for objects and one for terrain.

    I was thinking of something the other day but I am unsure of how practical what I am saying it is. I was thinking that perhaps on the active parts of the game (i.e. map exploration) the mutliplayer plugin would handle everything. That way I don't have to store every single piece of data related to the players in Firebase's database.

    Of course the world has to persist, in that case, when a player exits (be it through closing a tab or he just gets disconnected somehow), the game would store the relevant data in Firebase's database to be used when he logs back in.

    Wouldn't that circumvent the need to continuously store data in the database? After all the game doesn't run on a client and is hosted online just like the old RuneScape for example where you open a tab in the browser and play the game or A Dark Room. You open a tab and start playing and there is your data from the last session when you closed the tab abruptly. Although I know A Dark Room stores the data locally rather than online.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)