Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

As my first "real" project, I'm working on a game that I intend to be single-player, web-based, and primarily in text. I need the ability to save choices the players make, and to have certain variables increase based on those choices. (Like bravery increasing after a heroic choice is made, for example.) There's a very small inventory; not RPG-style elaborate. The big thing about it is the choice aspect; every choice impacts where the player can go/future success or failure in other situations/etc. So I really have to be able to save those. (Choice input was being done by simple buttons, but I'm not married to that.) I'd like the player to be able to close the browser, then come back to it later where they left off- so, a login system, too.

My biggest problem is that I feel like I'm getting jerked left and right on which language(s) to use for this. I started off with Python a few months ago and started getting comfortable in that, but then didn't like how hard it was to integrate it in to a website afterward. (Hard for me, anyway. I might just be stupid, or failing to find the right tutorials on it.) I got a book on Javascript ("The Good Parts"), but found it unhelpful for what I was trying to do and my skill level. Then I got a book on PHP and MySQL ("PHP and MySQL Web Development") and started getting used to that, thinking it would be useful for saving player choices, but now all I see when I google specific questions about mySQL with games is people saying, "You don't want to use MySQL for games." So have I been wasting my time on that?

What language would you use for a single-player web game that was text-based and had to save many player choices? Or was I already going the right direction to start with?

share|improve this question

closed as not constructive by Tetrad Apr 2 '13 at 8:00

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
What are you waiting for? Start with some javascript code, maybe use jquery right from the start, so it's easier when you want to extend it later. Create 3 buttons that control the background color of the page. Some time later you might want to save the setting to a database, which you can access via a php script. –  ott-- Apr 1 '13 at 2:44
    
"Which tech should I use" questions are really unanswerable. See the faq. –  Tetrad Apr 2 '13 at 8:00
    
If this is purely a web browser thing with no real 3D graphics, I would just suggest using something like C# and ASP.Net. You should be able to design a rather simple reusable page that gives the user a text box description of the situation and a bunch of buttons for choices. Also login pages are incredibly simple, there should be thousands of tutorials for how to do it using a SQL server. As far as the actual design, that's your choice. –  Benjamin Danger Johnson Apr 2 '13 at 16:15
add comment

2 Answers 2

Short answer: JavaScript is a perfectly suitable choice for this. Ultimately you want it to be browser based, browsers run JavaScript. You want it to be able to be single player and store player choices, JavaScript has local storage up to ~5MB that you can use. If you want player choices to be stored on your server and not their machine, there is a light-weight JavaScript server side software system called Node.js that you can get started with fairly quickly. If you are going to have to learn a language to do this, you might as well only have to learn one.

Could you do this with Python, PHP and/or MySQL? Absolutely. If you knew these languages to begin with it might be easier than starting from scratch. If you are starting from scratch, JavaScript starts you the closer to the goal line for a web-based game.

Side note: You see people say not to use MySQL for games because to do that is to leverage the might of a powerful relational database that was designed to store, cross-reference and retrieve large sets of data efficiently for the purpose of storing "player is at x=10 and y=20". It's usually overkill, and it's usually not as fast or scalable as you would like because it was not designed for small rapid communications.

share|improve this answer
    
I concur with this answer. I've developed and ran a small browser based text game using mysql/php (linux) and I think the local storage approach is best for a single player game. Down the road you can still implement another storage system for highscores if you want, just know that there is little if any cheat prevention without storing the data on the server the entire time. –  JClaspill Apr 1 '13 at 16:30
1  
JClaspill makes a good point, the player can do whatever they want in your game's code with a JavaScript debugger unless you keep the game logic on a server. There is also the fact that localStorage gets wiped out if the player clears their cache, you might want to warn players of this. –  nwellcome Apr 1 '13 at 18:32
add comment

You might want to look at the Flask framework. I've been working on a freelance project where I've been working on an existing flask system and I've been fairly impressed with how simple it is for working on the web in Python. I haven't had the free time, yet, but I've definitely been interested in using it for developing a game.

In my experience it does a good job of bridging some of the difficulties posed by getting started with a Python project on the web, and that's one of your important tasks.

Addressing the concept of making optimal choices starting out, it sounds like you haven't gotten too deep into any one language yet--or at least not any language you perceive as appropriate to the task. You can always refactor your code later to change how you're saving data if you find the method you used is too slow for your game. This is going to be a triangulation between how often you find it necessary to perform queries, inserts, and how many players you have active at a time. While I agree with the warnings you've been given about MySQL, these warnings ignore the value of getting a working, playable game.

You'll have a much better chance of success in the broader project of "creating a game" once you get something vaguely game-like which you can then refine and shape, rather than spinning your wheels attempting to build only with most-optimal technologies up front. It might mean more work in the long run, but it's better than losing steam trying to find your sea legs with unfamiliar technologies someone has told you are "best" for what you're doing.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.