Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

html5 mmorpg?

HTML5 html5

  • Please log in to reply
13 replies to this topic

#1 even821

even821

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 132 posts

Posted 02 October 2012 - 06:51 AM

if i want to create an mmorpg using html5 and javascript, would i need to connect it to a database? (i already know how to use php and mysql, but cant seem to find a way to store the data in the database, since the game codes are in a .js file, and therefore i cannot use any php in them)
or is there a better way of storing the data?
  • 0

#2 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 02 October 2012 - 07:01 AM

If you want to create an MMORPG, you will have to have some form of server-side technology. Whether it will use a database or not depends on what you're doing, but seems likely. You can use JS to make AJAX calls to the server.
  • 0

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

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


#3 even821

even821

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 132 posts

Posted 02 October 2012 - 07:03 AM

ah, i was considering the possibilities of using ajax to load the php functions, guess ima have to become better with it then...thanks :)
this is harder than i expected it to be, wich is good. wouldnt be any fun if it was easy :P
  • 1

#4 BenW

BenW

    CC Devotee

  • Community Manager
  • 976 posts
  • Programming Language:ActionScript
  • Learning:ActionScript

Posted 03 October 2012 - 09:36 AM

As it happens, Mozilla is quite interested in getting developers working on this sort of project, and have released an open source MMORPG game of their own.

You can play it here, first off, and then get the source code here. There's also a description of the tech used in a short article here :)
  • 0

fss_overall.png

 


#5 even821

even821

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 132 posts

Posted 05 October 2012 - 01:49 PM

ye i have already played and taken a look at it, and loved the way it worked (even tho i would like to add alot more to it like lvles and stuff)
but that game used web sockets right? can someone explain to me what those are, and what are the limits of them? sorry for being noobish on this, kinda cant seem to find any good tutorials or explinations on web socets etc. :/
  • 0

#6 Yannbane

Yannbane

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 238 posts
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, PL/SQL, Lisp, Assembly, Bash, Others
  • Learning:Lisp, Scheme

Posted 05 October 2012 - 02:26 PM

It is certainly possible. I had a little experiment a while ago, you can read up on it over on my blog: http://www.yannbane....efore-beta.html.

This is how it looked:

Posted Image

The graphics were really awful, but it used a Node.js backend and Socket.io (which are the websockets you are looking for) to communicate with the browser, which rendered the whole thing.
  • 0

My blog: yannbane.com. I post about programming, game development, and artificial intelligence.


#7 even821

even821

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 132 posts

Posted 05 October 2012 - 02:30 PM

the only thing im confused about with sockets atm is:

is the information about everything saved locally, or in a database? or is that sorta optional when writing the code?

btw really nice job on that game, looks fantastic :D
  • 0

#8 Yannbane

Yannbane

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 238 posts
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, PL/SQL, Lisp, Assembly, Bash, Others
  • Learning:Lisp, Scheme

Posted 05 October 2012 - 02:34 PM

the only thing im confused about with sockets atm is:

is the information about everything saved locally, or in a database? or is that sorta optional when writing the code?

btw really nice job on that game, looks fantastic :D


What information are we talking about, exactly? Sockets are simply used to send a message from the server to the client, and vice versa. You should only be sending input from the client, and gamestate from the server, never trust the client. You can have local databases as well, look up client side storage. You might be able to save spritesheets and other information (that would otherwise need to be downloaded form the server) on the client side, but if it anything you don't want removed/tampered with/stolen/read, then don't do it.
  • 0

My blog: yannbane.com. I post about programming, game development, and artificial intelligence.


#9 even821

even821

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 132 posts

Posted 05 October 2012 - 02:37 PM

generally i dont want anything locally stored, since that would limit you to playing on one pc. i want it so that if you log onto a user with the correct password and username, you will be able to play on ur user. i hope that makes sense.
  • 0

#10 Yannbane

Yannbane

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 238 posts
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, PL/SQL, Lisp, Assembly, Bash, Others
  • Learning:Lisp, Scheme

Posted 05 October 2012 - 02:41 PM

generally i dont want anything locally stored, since that would limit you to playing on one pc. i want it so that if you log onto a user with the correct password and username, you will be able to play on ur user. i hope that makes sense.


Yes, of course. Also, this has nothing to do with websockets. They simply provide a way for your browser to communicate with a server, and Socket.io is just a Javascript wrapper which is automatically sent to the browser by your Node.js server.

If done correctly, the browsers will probably cache all the media for your game, so loading times get lower once you've loaded all the images.
  • 0

My blog: yannbane.com. I post about programming, game development, and artificial intelligence.


#11 even821

even821

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 132 posts

Posted 05 October 2012 - 02:43 PM

so i could still use php to store all the data i wanted in a database then? even if using sockets and node.js?
  • 0

#12 Yannbane

Yannbane

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 238 posts
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, PL/SQL, Lisp, Assembly, Bash, Others
  • Learning:Lisp, Scheme

Posted 05 October 2012 - 02:46 PM

so i could still use php to store all the data i wanted in a database then? even if using sockets and node.js?


Hmm, not that easily.

Node.js is a replacement for PHP. You can write your web server in it (~20 lines of code), your game logic in it, and your database code in it.

Have a look here: http://www.nodebeginner.org/.
  • 0

My blog: yannbane.com. I post about programming, game development, and artificial intelligence.






Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download