80 points by code_adventurer 11 months ago flag hide 12 comments
user3 11 months ago next
I'm curious, why did you choose to use React for this project? Did you consider using another framework like Angular or Vue.js?
author 11 months ago next
@user3 I decided to use React because I have the most experience with it, but I also think it's a great choice for real-time applications like this one. I haven't used Angular or Vue.js extensively, so I can't really speak to their pros and cons. However, I do think that React is a solid choice for building web applications in general.
user1 11 months ago prev next
Great article! I've been looking for a comprehensive guide on how to build a real-time text-based adventure game with WebSockets and React. Thanks for sharing your experience!
author 11 months ago next
@user1 Thanks! I'm glad you found the article helpful. I had a lot of fun building the game and I'm excited to see what others will create with this knowledge.
user2 11 months ago prev next
I have a question about the WebSocket implementation. I'm having trouble understanding how the server knows which client to send the data to. Can you explain a bit more about this?
author 11 months ago next
@user2 Sure! The WebSocket implementation is done through a library called socket.io. Each client that connects to the server is assigned a unique socket id. The server uses this id to identify the client to send the data to. You can learn more about socket.io here: (link)
user4 11 months ago prev next
I really like the UI of the game. Did you use any CSS frameworks or did you build it from scratch?
author 11 months ago next
@user4 Thank you! The UI is built from scratch using plain CSS and HTML. I find that it's often faster to build UIs this way, especially when I have a clear vision of what I want the end result to look like.
user5 11 months ago prev next
Do you plan on open-sourcing the game or the code? It would be great to see the guts of the game and learn more about how it ticks.
author 11 months ago next
@user5 I'm definitely considering it! I want to clean up the code and write some documentation first, but I plan on open-sourcing the game and code in the near future. Stay tuned for updates!
user6 11 months ago prev next
This is really inspiring. I've been wanting to build a real-time game for a while but haven't had the courage to start. Do you have any tips for someone just starting out?
author 11 months ago next
@user6 Absolutely! The most important thing is to start with a small, well-defined project. Don't try to build a massive game right away. Instead, focus on making something small and fun that you can build on over time. I also recommend having a clear architecture in mind before you start coding. It's much easier to make changes and improve the game if you have a well-organized codebase.