• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 04:19
CEST 10:19
KST 17:19
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun9[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10Team Liquid Map Contest #22 - The Finalists20[ASL21] Ro16 Preview Pt1: Fresh Flow9
Community News
2026 GSL Season 1 Qualifiers25Maestros of the Game 2 announced92026 GSL Tour plans announced15Weekly Cups (April 6-12): herO doubles, "Villains" prevail1MaNa leaves Team Liquid25
StarCraft 2
General
Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun Team Liquid Map Contest #22 - The Finalists Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool MaNa leaves Team Liquid Maestros of the Game 2 announced
Tourneys
RSL Revival: Season 5 - Qualifiers and Main Event SEL Masters #6 - Solar vs Classic (SC: Evo) $5,000 WardiTV TLMC tournament - Presented by Monster Energy GSL Code S Season 1 (2026) FSL Season 10 Individual Championship
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base Mutation # 521 Memorable Boss
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ ASL21 General Discussion BW General Discussion JaeDong's ASL S21 Ro16 Post-Review Leta's ASL S21 Ro.16 review
Tourneys
[ASL21] Ro8 Day 2 [ASL21] Ro8 Day 1 [BSL22] RO16 Group Stage - 02 - 10 May Korean KCM Race Survival 2026 Season 2
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Daigo vs Menard Best of 10 Stormgate/Frost Giant Megathread Nintendo Switch Thread Dawn of War IV Diablo IV
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread European Politico-economics QA Mega-thread Russo-Ukrainian War Thread 3D technology/software discussion Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion McBoner: A hockey love story
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Sexual Health Of Gamers
TrAiDoS
lurker extra damage testi…
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2198 users

[Q] how to code browser based game?

Blogs > evanthebouncy!
Post a Reply
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
Last Edited: 2010-03-19 08:46:02
March 18 2010 18:58 GMT
#1
Spring break is coming up so I'd have a lot of free time to goof around.
Can someone give me an overview how to write a browser based game?

Here's my overall idea, I want the game to be able to support:
1) User input/login
Each user can log in with some account_name/pass_word, and select their stats. Their stats will be stored on the server.
2) Make the players fight each other and display the results.

Let's start simple and say we only want to do part 1). What I would like is, at the most primitive level, have the user able to use some interface to set up their stats (possibly a gui if I cared enough), and write the datas, formatted, into a file (plain txt is file, i can just parse).
apparently this is a bad idea so forget it. I'll learn MySQL

Then I can do part 2) just by downloading the file and batch process it on my local machine, and paste the result online in plain text again every night or something.

But how do I do part 1)?
I did some research and I probably will need to use SQL but nowhere did I find how can I integrate SQL with a server(I'm thinking buying a server off some host).
Just give me some idea how to get the frameworks together, the rest should be pretty straight forward.

Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
Southlight
Profile Blog Joined August 2007
United States11768 Posts
Last Edited: 2010-03-18 19:11:05
March 18 2010 19:09 GMT
#2
SQL is just a database interface, isn't it? Back in high school I remember needing to use some browser coding to interface with the mysql database. I'd imagine technology has advanced considerably since then, and whatever coding language I used in the day wouldn't be applicable anymore, but mostly in regard to SQL it'd be learning how to install the thing.

1 would probably involve some sort of javascript or whatnot, basically creating an encrypted bridge between the user and the SQL database, and the bridge would obviously include the game itself.

Edit:
Sorry, I have no idea why I posted, because I'm clueless. Wish I could delete this Just running on like 5+ year old vague knowledge, bleh.
oraoraoraoraoraoraoraora
R1CH
Profile Blog Joined May 2007
Netherlands10342 Posts
March 18 2010 19:14 GMT
#3
You'll most likely want to learn PHP and SQL. You can download XAMPP which is a local Windows setup of Apache / PHP / MySQL for learning / development. Jumping into this won't be easy though without any programming or database background. When you want to put it on the web, you'll need web hosting which can be had for like $5/month or less.
AdministratorTwitter: @R1CH_TL
TL+ Member
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
Last Edited: 2010-03-18 19:23:29
March 18 2010 19:14 GMT
#4
Hmm if SQL is just an interface I probably don't really need it because the thing I do doesn't really require any fancy operation on it at all.

All I want is to have user to log-in and select some stats, and write those to a file. Don't really need anything more than that.

Hmm...

You guys reckon going through this tutorial is sufficient for a start?
http://www.w3schools.com/php/php_file.asp
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
March 18 2010 19:35 GMT
#5
If you don't want to save user data on the server you probably won't need a database.
If you have a good reason to disagree with the above, please tell me. Thank you.
love1another
Profile Blog Joined December 2009
United States1844 Posts
Last Edited: 2010-03-18 19:43:22
March 18 2010 19:37 GMT
#6
On March 19 2010 04:14 evanthebouncy! wrote:
Hmm if SQL is just an interface I probably don't really need it because the thing I do doesn't really require any fancy operation on it at all.

All I want is to have user to log-in and select some stats, and write those to a file. Don't really need anything more than that.

Hmm...

You guys reckon going through this tutorial is sufficient for a start?
http://www.w3schools.com/php/php_file.asp

Unless you think you're some god-like oracle who knows what he's doing from day 1 and is never going to change his data structures ever.... you're going to need an SQL-based database, as opposed to a handwritten file.

SQL is an interface, but it's a crucial interface to basically EVERY database ever. Which database you use, for your development, doesn't matter.... just use MySQL or PostGres or whatever you can get your hands on for free.

Trust me (but more importantly R1CH) on this one, that using a database is TOTALLY worthwhile over the long haul.

On the other hand, you may not need to learn SQL per se... if you choose to use an alternative web framework like Django (python-based) or Rails (ruby-based) the SQL stuff is taken care of...

So instead of writing something manual like

Select Username from Users Where Username = "USERNAME" AND Password = "PASSWORD"

You can use something like:
Users.getUsername("USERNAME")

And generally be learning a single language, instead of.... like 10.
R1CH's solution requires you to learn PHP and SQL, but also HTML, Javascript, and quite possibly some bizarre CSS that a framework's default settings can help you avoid. If you want to optimize your server instead of just using shared hosting, you might even end up having to learn Java or *gasp* C.

Then again, there's nothing wrong with that approach, but the learning curve is significantly steeper and if you ever end up wanting to get more devs working on your project, the learning curve will probably be steeper for them as well.... (It generally takes longer to figure out what's going on when your code is in 10 languages than when it's all in 1 language.)

Regarding RoR vs. Django:
Though RoR has wider support, thus cheaper entry-level hosting options, than Django... and both have absolute crap support/scalability when compared to R1CH's recommended PHP + MySQL. If you're planning on running a dedicated server to reach a wide audience, however, none of that means shit, since you're almost never CPU bottlenecked... you should just pick whatever is easier for you to understand.

Anyway.... TL;DR: Don't use a text file. Use a database. If you have half a year to learn shit, learn everything. If you have 1 month, pick up Django or Ruby on Rails.

Edit: Mongrel is a server, not a dbms.
"I'm learning more and more that TL isn't the place to go for advice outside of anything you need in college. It's like you guys just make up your own fantasy world shit and post it as if you've done it." - Chill
Kentor *
Profile Blog Joined December 2007
United States5784 Posts
Last Edited: 2010-03-18 19:46:38
March 18 2010 19:46 GMT
#7
On March 19 2010 04:14 R1CH wrote:
You'll most likely want to learn PHP and SQL. You can download XAMPP which is a local Windows setup of Apache / PHP / MySQL for learning / development. Jumping into this won't be easy though without any programming or database background. When you want to put it on the web, you'll need web hosting which can be had for like $5/month or less.

thanks for xampp. been installing apache mysql php manually everytime i have to reformat!
love1another
Profile Blog Joined December 2009
United States1844 Posts
March 18 2010 19:49 GMT
#8
On March 19 2010 04:35 spinesheath wrote:
If you don't want to save user data on the server you probably won't need a database.

If you don't want to save user data on the server, what other options do you have? You can store it all in a cookie. What happens when the user goes onto another computer or clears cookies? All data lost...

You need to store data on the server. And if you do, you are soooooooooo much better using a database (dbms):

1.) You get concurrency control for free. If you have a large number of users this is critical.
2.) You can enable memcaching (which can DRAMATICALLY) improve your game's response time, potentially for free.
3.) You get housekeeping of your persistent data.... for free. (Add a new column, delete a column, retrieve data, etc...)
4.) You get a broad base of internet support for your database configuration (in most cases) for free.
5.) People won't laugh at you like they will when you say you're using a text file to manage the user data for a game site.
"I'm learning more and more that TL isn't the place to go for advice outside of anything you need in college. It's like you guys just make up your own fantasy world shit and post it as if you've done it." - Chill
Adeny
Profile Blog Joined January 2009
Norway1233 Posts
March 18 2010 19:55 GMT
#9
Flash, Java and PHP(with MySQL). These are the current kings of browserbased games. The former 2 being easier to implement graphics/any kind of real-time stuff in it. PHP is more for text-based stuff, but learning PHP/MySQL is very, very valuable, as almost any website relies on these main components.
Vic.nQQ
Profile Blog Joined January 2009
Bulgaria88 Posts
March 18 2010 20:14 GMT
#10
This tread made me rofl ^_^

Right now I literally have my apache server running, finishing the admin panel and starting the interface for the PBBG that I'm making as a graduation project (deadline 23rd of March xO)

Anyway, the best site you could possibly find about that subject is http://buildingbrowsergames.com/tutorials/

it helped me a ton and I'm pretty sure it will help you too

About your points:

1) Probably manageable without database, but I wouldn't even try. Creating a table in which to store usernames and their password // emails and whatever else you need is extremely easy, and having done that, another 2 tables (one defining Stat entries, another storing the stats of every user) is just as easy of a step to do, compared to keeping everything in different files.

2)
Then I can do part 2) just by downloading the file and batch process it on my local machine, and paste the result online in plain text again every night or something.

This is rather unneeded, as PHP (Java, some other languages too) offers very easy server based solutions to this.

There is simply no need to go over storing your battle log in a file and computing it separately, when the languages mentioned offer easy real-time solutions.


Hope this helps,
~Vic


P.S. pm me if you want my source, game is still not finished, but i'll be working my ass off to complete it in the next 5 days
I believe!
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
March 18 2010 20:26 GMT
#11
On March 19 2010 04:49 love1another wrote:
Show nested quote +
On March 19 2010 04:35 spinesheath wrote:
If you don't want to save user data on the server you probably won't need a database.

If you don't want to save user data on the server, what other options do you have? You can store it all in a cookie. What happens when the user goes onto another computer or clears cookies? All data lost...

You need to store data on the server. And if you do, you are soooooooooo much better using a database (dbms):

1.) You get concurrency control for free. If you have a large number of users this is critical.
2.) You can enable memcaching (which can DRAMATICALLY) improve your game's response time, potentially for free.
3.) You get housekeeping of your persistent data.... for free. (Add a new column, delete a column, retrieve data, etc...)
4.) You get a broad base of internet support for your database configuration (in most cases) for free.
5.) People won't laugh at you like they will when you say you're using a text file to manage the user data for a game site.


Hey I would suggest using a database, too. I still think my statement is true.
If you have a good reason to disagree with the above, please tell me. Thank you.
Cambium
Profile Blog Joined June 2004
United States16368 Posts
March 18 2010 20:52 GMT
#12
I've done a lot of web-based programming in the past, both for school and for work; I've worked with ASP, JSP, and PHP, and I think, for what you want, ASP with Flash will be the easiest approach.

For Part 1) of your goal:

While there are a lot of frameworks available for JSP and PHP, set up can be a nightmare for someone with little to no experience. Whereas for ASP, once you have Visual Studio and MS SQL Server installed (both free if you use beta, or if you are a student), it's literally a matter of drag and drop (login wizard, profile wizard, etc.). You can probably get part1 done within one hour even if you have absolute no experience.
When you want something, all the universe conspires in helping you to achieve it.
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
Last Edited: 2010-03-19 07:47:26
March 19 2010 07:39 GMT
#13
So the xampp is for setting up a PHP/mySQL on the server yes?
I got it but it doesn't seem to work on my own computer :/

If I'm looking at a server already with MySQL I probably don't have to set it up yeah?
I'm taking that javascript and php are supported by browser by default (right assumption?)

I'm looking at this btw:
http://www.inmotionhosting.com/hostingplans.html

Also,
Once the MySQL is set up, I can just use its interface while coding in javascript/php yes?

Much thanks!

I'm fairly familiar with python, but I have no idea how it works with a website so... hmm
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
haduken
Profile Blog Joined April 2003
Australia8267 Posts
Last Edited: 2010-03-19 07:57:21
March 19 2010 07:48 GMT
#14
xampp is just a bundled software that installs php, mysql and apache on your computer. it also does a lot of grunt work for you so you don't have to tweak everything from scratch.
php is server side scripting. use this for stuff that you don't want to execute on user's machine. mysql is just a database, use this to store and retrieve and query all your data. apache is the web server that put your game on the web so people can access it.

if you are having trouble accessing the server page. try typing just localhost on your browser. the default page should display something like "it works!". Put the server machine as a dmz host if you want to remote access it.

if you are using windows, you have to start up apache server then the default address that it points to is localhost. on Linux and others, the behavior is similiar. there is a folder in your harddrive where you put all your website files in. use this for testing then maybe buy a dedicated host.

"Once the MySQL is set up, I can just use its interface while coding in javascript/php yes?"
Your database will have its own login/pass which you need to set in your php script. you need to connect to the database, then close it when you are done. All done in a php script.

javascript is a client side script meaning you should never interface that with your database.

php and javascript is pretty much universal. different versions of course will have different tweaks and compatibility issues. mysql you will have to create a few tables, this will come down to your data structure design etc.
Rillanon.au
haduken
Profile Blog Joined April 2003
Australia8267 Posts
Last Edited: 2010-03-19 08:04:59
March 19 2010 08:03 GMT
#15
For part 1:

What you want to do is:

Step 1. user/pass login (when they click, action points to a php script)=> retrieve stats from database => display the result in browser.
Step 2a user log out.
Step 2b user make changes => user clicks a button (again action points to a php script)=> new stats sent to database => display confirmation to user.

remember, web programming is mostly transaction based.

For Part 2, just do some sort of scheduled query job on your database tables. For example, every night at 9pm, select * from table A and display the result to a link on your website.

Rillanon.au
igotmyown
Profile Blog Joined April 2009
United States4291 Posts
March 19 2010 08:31 GMT
#16
Most web hosts will have mysql servers. I don't see why you would avoid using it. You could create a table of username/password/user info and save it as what, a text file? Or you could have the exact same information in a database and not have to reverse engineer sorting, search by, or whatever.

Php has built in sql commands, and it also allows you to make generic queries, and they're fairly straightforward/copyable. Like Select Names Sort By ID.

Writing the php will probably be the biggest headache, you'd like to do it with minimal knowledge, but that all goes to hell when you have to error check. If you want to save time, copy as much as possible, because you'll know that it works.
Please log in or register to reply.
Live Events Refresh
Next event in 1h 11m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
OGKoka 73
StarCraft: Brood War
GuemChi 3186
Sea 789
Aegong 270
Zeus 170
Stork 167
ToSsGirL 107
910 47
soO 36
Sharp 35
Shine 34
[ Show more ]
Backho 23
ajuk12(nOOB) 23
Shinee 17
Bale 16
Noble 14
Sacsri 13
sSak 5
ZergMaN 4
Dota 2
NeuroSwarm441
canceldota30
League of Legends
JimRising 541
Counter-Strike
shoxiejesuss874
Other Games
olofmeister646
C9.Mang0407
Happy194
crisheroes189
Organizations
Other Games
gamesdonequick766
Dota 2
PGL Dota 2 - Main Stream86
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 16 non-featured ]
StarCraft 2
• LUISG 23
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota225
League of Legends
• Lourlo1205
• TFBlade729
• Jankos636
• Stunt486
Upcoming Events
GSL
1h 11m
Cure vs TriGGeR
ByuN vs Bunny
KCM Race Survival
1h 41m
Big Gabe
3h 41m
WardiTV Qualifier
3h 41m
Replay Cast
15h 41m
Replay Cast
1d
Escore
1d 1h
OSC
1d 4h
Replay Cast
1d 15h
Replay Cast
2 days
[ Show More ]
RSL Revival
2 days
Classic vs GgMaChine
Rogue vs Maru
WardiTV Invitational
2 days
IPSL
2 days
Ret vs Art_Of_Turtle
Radley vs TBD
BSL
2 days
Replay Cast
2 days
RSL Revival
3 days
herO vs TriGGeR
NightMare vs Solar
uThermal 2v2 Circuit
3 days
BSL
3 days
IPSL
3 days
eOnzErG vs TBD
G5 vs Nesh
Replay Cast
4 days
Wardi Open
4 days
Afreeca Starleague
4 days
Jaedong vs Light
Monday Night Weeklies
4 days
Replay Cast
4 days
Sparkling Tuna Cup
5 days
Afreeca Starleague
5 days
Snow vs Flash
WardiTV Invitational
5 days
GSL
6 days
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2026-04-28
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
StarCraft2 Community Team League 2026 Spring
2026 GSL S1
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026

Upcoming

Escore Tournament S2: W5
KK 2v2 League Season 1
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
RSL Revival: Season 5
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.