Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

How to create a text based web browser game


  • Please log in to reply
28 replies to this topic

#1 Vswe

Vswe

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1989 posts
  • Programming Language:Java, C#, PHP, Python, JavaScript, PL/SQL, Visual Basic .NET, Lua, ActionScript

Posted 10 November 2009 - 05:53 AM

Before I knew any web developing at all me and some friends wanted to create a text based web browser game, and it was my task to do the actual coding. So since none of knew how to do it I started to Google and did that for many many hours, without any luck. Most results were only people who wanted to get their own and got a reply like: "Then you have to learn how you do it". I got really frustrated and then gave up. There's actually much information about the topic on the net if you're a little bit more specific, which you of course can't if you don't know anything about what you'll gonna need for creating a game. In this tutorial I will show what you need to learn and what you will use to create a text based web browser game, observe that this could be made in some different ways but I'll show one of them.







HTML


First you will need to learn HTML. HTML is a markup language which means it's not a programming language. HTML is the very base since this is what will make web pages. A HTML document can also simply be called web page. Everything you will learn later will in one way or another alter the web page by doing something with the HTML. So you can say that HTML is your actual pages. To learn HTML a good walk through tutorial can be found here: HTML Tutorial









CSS


When you have learned HTML good enough there's time to learn CSS. But don't hurry it's better that you learn one thing good enough before you continue with the next one. CSS makes your pages look nice by adding styles to your HTML elements such as color, size, margins etc. Neither CSS is a programming language and is "only" used to set the styles of your HTML pages. If you want a good walk through tutorial about CSS you can found it here: CSS Tutorial








JavaScript


Now you should be able to create static web pages, so now it's time to learn Javascript. JavaScript is a lightweight programming language which simply means it's not so complex. JavaScript is usually embedded in the HTML page directly to modify the HTML elements. JavaScript is used to make your web page more dynamic by adding the possiblity of changing the current page while it's open or when it loads depending on different things such as the time of the day or the user's browser just as an example. An other example on what you can do that you'll probably need when doing a game is ticking counters and other changing values. To learn JavaSCript you can use this walk through tutorial JavaScript Tutorial or visiting the JavaScript tutorial section here on CodeCall Javascript - CodeCall Programming Forum










PHP


PHP is another programming language we'll use. PHP is a server-side programming language which means everyhing will be executed on the server, then it will return HTML to the browser where it will be showed. Since all code is executed on the server the user can't see the code so therefor we could have secret things in the code, such as database connection. PHP is a good at connection to a lot of different types of data bases and one of the things we'll use it for is to connect to our database where we store all the users and other information. PHP is free to download and must be installed on your server if it isn't already. All the languages above (HTML, CSS and JavaScript) don't need to be installed to use. To learn PHP you can use this walk through tutorial PHP Tutorial or visiting the PHP tutorial section at CodeCall PHP Tutorials - CodeCall Programming Forum











MySQL


MySQL is a database, the data stored in a MySQL database is stored in tables. The database we will use to store all information in the game. Then we'll use PHP to get or set info from/to the database and by using this we can create users and keep all information about them and also show it on our pages by returning it to the browser with the PHP as plain HTML. To "order" your database to do something you'll need to use queries which looks something like this "SELECT LastName FROM Persons", queries could be used through our PHP code which means we use the PHP could to send "orders" to the database to retrieve/change information. You can learn about MySQL together with PHP here PHP MySQL Introduction






Now when you know what to use and have learned all this you'll much easier found the information you'll need. A tip for a tutorial showing you how to do a log in system and other thing needed for a big project is http://forum.codecal...t-part-1-a.html created by WingedPhanter. One thing to remember, from no experience to a complete web browser game is not a one week project, not even one month, it will take a lot of time to do, but now you know what to do to be able to create one. Hope you found this informative and have good luck learning, if you need any more help just leave a comment below :)
  • 5

#2 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 10 November 2009 - 09:15 AM

Do I have to use PHP or can I use Perl/Python/Ruby/etc? :P

Nicely written, +rep
  • 0

#3 Vswe

Vswe

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1989 posts
  • Programming Language:Java, C#, PHP, Python, JavaScript, PL/SQL, Visual Basic .NET, Lua, ActionScript

Posted 10 November 2009 - 09:17 AM

Do I have to use PHP or can I use Perl/Python/Ruby/etc? :P

Nicely written, +rep


I will show what you need to learn and what you will use to create a text based web browser game, observe that this could be made in some different ways but I'll show one of them.


Does this answer your question?
  • 0

#4 BlaineSch

BlaineSch

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1559 posts

Posted 10 November 2009 - 01:43 PM

pwnd? :P
  • 0

#5 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 10 November 2009 - 01:51 PM

lol, fair enough but I think it deserves a better title. IE: How to make a text-based web browser game using PHP, JavaScript and MySQL.
  • 0

#6 Vswe

Vswe

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1989 posts
  • Programming Language:Java, C#, PHP, Python, JavaScript, PL/SQL, Visual Basic .NET, Lua, ActionScript

Posted 10 November 2009 - 03:04 PM

It's made for people that don't know what they need to use, not for people that know JavaScript, PHP and MySQL and wonder how to create the actual game since this tutorial doesn't show any code or something else like that.
  • 0

#7 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 13 November 2009 - 08:46 AM

Nice overview. +rep
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/


#8 technica

technica

    CC Regular

  • Just Joined
  • PipPipPip
  • 43 posts

Posted 28 December 2009 - 09:18 PM

Good one mate.
  • 0

#9 James.H

James.H

    CC Devotee

  • Just Joined
  • PipPipPipPipPipPip
  • 569 posts

Posted 23 March 2010 - 03:44 PM

Nice one vswe +rep
  • 0

#10 cubedude

cubedude

    CC Lurker

  • Just Joined
  • Pip
  • 6 posts

Posted 03 June 2010 - 08:02 AM

nice one :P i was in the same situation but you acutally don't need javascript cause that just the flashy stuff :) you can only do it with html, css, php and mysql :) thats how i did my game.
  • 0

#11 Vswe

Vswe

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1989 posts
  • Programming Language:Java, C#, PHP, Python, JavaScript, PL/SQL, Visual Basic .NET, Lua, ActionScript

Posted 03 June 2010 - 08:54 AM

nice one :P i was in the same situation but you acutally don't need javascript cause that just the flashy stuff :) you can only do it with html, css, php and mysql :) thats how i did my game.


You don't need css either :P
  • 0

#12 the game master

the game master

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 03 June 2010 - 10:51 AM

hey i have php codes to a text based rpg and php codes to a video sharing website i woud like to get them both up but I dont know php can somebody help me
  • 0