Making text based game

Got something to share about your favorite games? Strategies? Game codes? Discuss gaming topics here!

Making text based game

Post by tripbeam on Sat Dec 06, 2014 5:10 pm
([msg=85682]see Making text based game[/msg])

I'm going to be making a text based game, You will play as the hacker doing various things playing at the terminal. Now, i have been using javascript only on code academy really but i know my way around it fairly well compared to before as i'm 94% into the course.

I'm starting out by making the lay out of the game in a browser, it will have the terminal in the middle were you pipe commands and storyline options, then it will have the progressing storyline on the right side of the screen and something on the left.. maybe just how far you've progressed. I hate HTML and all in all styling of things... mainly because i havn't paid great attention to html and css.

But if any of you have any tips as this is really my first project with javascript aside from code academy then feel free to tell me them.. i'll keep this updated when i have progressed alot, but keep in mind this is my first project and i'm a noob at javascript.
tripbeam
Poster
Poster
 
Posts: 166
Joined: Tue Jul 01, 2014 8:52 pm
Blog: View Blog (0)


Re: Making text based game

Post by cyberdrain on Sat Dec 06, 2014 7:43 pm
([msg=85691]see Re: Making text based game[/msg])

A few tips I learned from a similar project in Python: use objects if you can, items work best in arrays (might be obvious), either use something that determines the levels for you or redirect from function to function, draw a map beforehand, do not use globals if it is not a necessity (does JS have those?), catch errors by checking for situations that should never happen or in an else-clause, order your code (comments, TODO) and either write functions you'll fill in later or work on one thing at a time finishing it completely. If I remember more, I'll edit this.
Free your mind / Think clearly
User avatar
cyberdrain
Expert
Expert
 
Posts: 2160
Joined: Sun Nov 27, 2011 1:58 pm
Blog: View Blog (0)


Re: Making text based game

Post by Misanthropydotexe on Sat Dec 06, 2014 10:20 pm
([msg=85696]see Re: Making text based game[/msg])

I can't give you any advice in making it, 'cause I'm a dumb-dumb and you're a world of knowledge more advanced than me.

But I will happily play test the hell out of that game for you. Text adventures. Mmmmm...
My armor is Contempt. My shield is Disgust. My sword is Hatred.
Respect not pity or weakness, for they are a disease which makes sick the strong
/sbin/poweroff
User avatar
Misanthropydotexe
Poster
Poster
 
Posts: 201
Joined: Tue Jun 03, 2014 10:54 pm
Blog: View Blog (0)


Re: Making text based game

Post by tripbeam on Sun Dec 07, 2014 12:25 am
([msg=85699]see Re: Making text based game[/msg])

Thank you for those tips, i will make sure to use them when i code the game.. Objects will be extremly usefull and i'll have to look into the arrays for lists. Do you mean use arrays to store things?

And anthropy i don't know much lol, lots of people out there with alot more knowledge than me. But whenever i get it up and running which will probably be a while i'll post the code here or somthing like that. Right now i have just barely went into the layout of the game.. like the terminal and stuff. lots to do lol

Edit: yes javascript has variables as in methods, objects and variables. ment to add that before
Last edited by tripbeam on Sun Dec 07, 2014 6:19 pm, edited 1 time in total.
tripbeam
Poster
Poster
 
Posts: 166
Joined: Tue Jul 01, 2014 8:52 pm
Blog: View Blog (0)


Re: Making text based game

Post by tremor77 on Sun Dec 07, 2014 9:51 am
([msg=85708]see Re: Making text based game[/msg])

So this game is played in the browser and your are using mostly javascript? You do realize then all your code runs client side in the browser and therefor is viewable, editable even using the javascript console in the developer tools that come with all major browsers... meaning for example, even if you do ajax calls to the server to handle portions of the program where there will be "an answer" or something, someone could simply run in the javascript console on the browser "response = true;" or something like that, and just bypass every piece of your game code... what i'm saying is.. in javascript, your hacker game will be easily hacked.

If you do go the javascript route I suggest node.js and putting most of your game logic server side, and uses javascript client side for the user interface only.. you could do this with PHP or Python WSGI as well... look into JQuery UI http://jqueryui.com/ for making some of your UI easier to build.. if you want to be real slick though check out ZebraUI.. http://zebkit.com it bascially renders an entire UI into 1 html5 canvas object.. it's the way I see how the web should be.

Actually your doing something I've been pondering doing for a while now.. my method would be this.. Node.js, ZebraUI, Websockets... and with websockets i'd set it up so that it could be multiplayer.. and multiplayer could be both co-op and/or competitive.. think of the possibilities..
User avatar
tremor77
Addict
Addict
 
Posts: 1098
Joined: Wed Mar 31, 2010 12:00 pm
Location: New York
Blog: View Blog (0)


Re: Making text based game

Post by tripbeam on Sun Dec 07, 2014 6:24 pm
([msg=85715]see Re: Making text based game[/msg])

Yes i know people will be able to look at the script, i was thinking of obfuscating as people who don't know about that wont know. but then that's pretty useless, but yea i understand someone can see it and stuff.

Thanks for the jqueryUI i am using it now, i need to figure out how it works as i have never used jquery before but it looks simple enough.
tripbeam
Poster
Poster
 
Posts: 166
Joined: Tue Jul 01, 2014 8:52 pm
Blog: View Blog (0)


Re: Making text based game

Post by cyberdrain on Sun Dec 07, 2014 7:34 pm
([msg=85722]see Re: Making text based game[/msg])

I'd definitely make most of the code (including game logic) server side if I ever wrote something like this in JavaScript, if only to prevent easily cheating or hacking the game. Obfuscation will not save you, don't even try. Then again, it's your choice :)

Except for the idea that you might want to learn how to safely write JavaScript applications early on, if this game is for learning purposes, it doesn't really matter what you decide. If you want this game live, I'd definitely play it safe. :roll:
Free your mind / Think clearly
User avatar
cyberdrain
Expert
Expert
 
Posts: 2160
Joined: Sun Nov 27, 2011 1:58 pm
Blog: View Blog (0)


Re: Making text based game

Post by centip3de on Wed Dec 10, 2014 3:38 pm
([msg=85765]see Re: Making text based game[/msg])

cyberdrain wrote:catch errors by checking for situations that should never happen


Exactly. That's why I always do,

Code: Select all
neverTrue = False
if(neverTrue == True):
...


But more on point, I'm curious as to what this game will be like. If you're going to emulate a terminal, are you going to completely emulate a terminal? How many commands will be implemented? How many flags on those commands? Further, how will the terminal act? Can I expect a decent text editor in it (VIM, etc.)? Will it save my most recent commands, similar to a real terminal? Or will this game be something that doesn't use real commands, and only uses made up ones? If that's the case, will I only need to execute commands, or will there be coding sections?

I have a couple more questions, but they mainly rely on the above ones being answered.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rick Cook
User avatar
centip3de
Addict
Addict
 
Posts: 1479
Joined: Fri Aug 20, 2010 5:46 pm
Blog: View Blog (0)


Re: Making text based game

Post by ghost107 on Wed Dec 10, 2014 5:20 pm
([msg=85768]see Re: Making text based game[/msg])

Maybe this will help you(Uses REST to communicate with the server):
http://terminal.jcubic.pl/
User avatar
ghost107
Poster
Poster
 
Posts: 321
Joined: Wed Jul 02, 2008 7:57 am
Blog: View Blog (0)


Re: Making text based game

Post by tripbeam on Wed Dec 10, 2014 5:48 pm
([msg=85769]see Re: Making text based game[/msg])

Well, I want to give it a terminal look and also i will try to emulate the terminal the best i can. I have not went into great thought if it will take into so much detail it has an editor but i'm sure i can implement one. But i will most likley throw in real commands, maybe a few made up ones as well along with the most recent commands/command you did.

I decided to brush up on my html, i may learn some jquery as well to make it easier. I have still to figure out making all the functions and stuff work out for the story. But i will figure that out soon as i'll just go through the tutorial some on codecademy were they build a simple story and i'll build upon that.


Don't expect it to be a real fun game... i'll make it fun and good as i can but this is my first ever project. I'm good on the help now, thanks for all the help just i don't want to get TONS of tips and stuff for what probably wont be amazing.

I'm glad you all are interested though, makes me want to actually make it. Thank you
tripbeam
Poster
Poster
 
Posts: 166
Joined: Tue Jul 01, 2014 8:52 pm
Blog: View Blog (0)


Next

Return to Gaming

Who is online

Users browsing this forum: No registered users and 0 guests