best way to allow game saves
-
ShawnSwander
- Posts: 53
- Joined: Thu May 17, 2012 12:31 am
best way to allow game saves
Are there any good videos or just explanations on how to save characters for a browser based mmorpg I dono how well javascript can work with mySQL once the page has loaded... I've read about using a few methods im not familiar with. If anyone can point me in the right direction Id appreciate it.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: best way to allow game saves
What kind of browser-based MMORPG are you referring to? An MMORPG, basically by definition, is going to rely heavily on server-side code and a database. That database is going to be saving what is going on in the game world constantly.
How is your game going to be connecting to the server? PHP pages? Javascript front-end with Node.js back-end? Javascript front-end with AJAX calls and PHP back-end?
How is your game going to be connecting to the server? PHP pages? Javascript front-end with Node.js back-end? Javascript front-end with AJAX calls and PHP back-end?
The indelible lord of tl;dr
-
ShawnSwander
- Posts: 53
- Joined: Thu May 17, 2012 12:31 am
Re: best way to allow game saves
@Jackolantern
Sorry for not giving more info.
I am connecting to the server via websocket I'm using node and socket.io I would like to save it on a MySQL database but my question was actually if this is even a viable direction to go as PHP is server side and java-script is client side. I've seen some local storage methods and ajax as well. With all the routes its hard to know what direction I should go.
Sorry for not giving more info.
I am connecting to the server via websocket I'm using node and socket.io I would like to save it on a MySQL database but my question was actually if this is even a viable direction to go as PHP is server side and java-script is client side. I've seen some local storage methods and ajax as well. With all the routes its hard to know what direction I should go.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: best way to allow game saves
For pretty much any multiplayer game, you are going to want everything saved server-side, except for maybe saving the username when the user logs in (that would probably be fine with cookies). The database is going to be the main and accepted game state, since the data saved in it is going to be what the game relies on to run.
If you are making your game with Canvas (and ImpactJS if you are using it), WebSockets and Node.js, then you will likely not involve PHP at all. A split PHP and Node back-end would likely just confuse the development process. The actual web pages to be served for your game would probably best be handled with Express.
If you are making your game with Canvas (and ImpactJS if you are using it), WebSockets and Node.js, then you will likely not involve PHP at all. A split PHP and Node back-end would likely just confuse the development process. The actual web pages to be served for your game would probably best be handled with Express.
The indelible lord of tl;dr
Re: best way to allow game saves
well you could use mongodb which is a noSql db which idk what that means xP that works with node.js
I tried to learn it but didn't tried hard enough, it could be what you're looking for.
I tried to learn it but didn't tried hard enough, it could be what you're looking for.
Orgullo Catracho
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: best way to allow game saves
MongoDB is a "document-based" database, as opposed to a relational database (such as MySQL). The storage looks more like JSON data than SQL data. There are perks to both sides, and both are well-suited to certain projects. Document-based dbs tend to work well with "one-off" data, as in, data that has tons of nodes and typically only has a single piece of data or a small set of data under it. Games can tend to be this way, depending on how they are set up. Relational databases tend to work well with highly relational data (go figure lol). Business and marketing data tends to be highly relational, since almost all of the data "funnels up" to one account or another type of record. Many people will tell you online games are this way, since almost all data stored (at least player data) relates back to a single character or account. On the other hand, you could look at it in the context of world data, and little of that has a hierarchy of relation.
In the end, just use whichever one you feel more comfortable with. The productivity advantages to using the one you know will far outweigh any hyped benefits of using the other
In the end, just use whichever one you feel more comfortable with. The productivity advantages to using the one you know will far outweigh any hyped benefits of using the other
The indelible lord of tl;dr
-
ShawnSwander
- Posts: 53
- Joined: Thu May 17, 2012 12:31 am
Re: best way to allow game saves
Thanks
I feel a little overwhelmed by that part...
I'm very familiar with php and MySQL but I don't really know of a way the JavaScript can pass variables to it without some kind of a refresh event.
Perhaps an invisible iframe if I can pass variables but I've never done it and have no idea how to implement it.
I'm very familiar with php and MySQL but I don't really know of a way the JavaScript can pass variables to it without some kind of a refresh event.
Perhaps an invisible iframe if I can pass variables but I've never done it and have no idea how to implement it.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: best way to allow game saves
The MongoDB vs. MySQL section was mostly for Ark since he said he didn't know exactly what MongoDB was 
You could look into AJAX Javascript techniques for sending JS variables to PHP without a refresh. The only 2 drawbacks to AJAX are 1, it can be slow due to the HTTP overhead, and 2, AJAX has no defined method of pushing data from the server to the browser. There are basically some hacks known as Comet to send data from the server to the browser, but the method that is spreading quickly are WebSockets.
You could look into AJAX Javascript techniques for sending JS variables to PHP without a refresh. The only 2 drawbacks to AJAX are 1, it can be slow due to the HTTP overhead, and 2, AJAX has no defined method of pushing data from the server to the browser. There are basically some hacks known as Comet to send data from the server to the browser, but the method that is spreading quickly are WebSockets.
The indelible lord of tl;dr
-
ShawnSwander
- Posts: 53
- Joined: Thu May 17, 2012 12:31 am
Re: best way to allow game saves
I'm using websockets now in my game I'd like to use that somehow if possible. The whole reason for using websockets is to lower the overhead. Using comet kind of defeats the purpose doesn't it?
with the websocket connection and its rise in popularity im supprised there doesn't seem to be a simple lightweight method yet.
with the websocket connection and its rise in popularity im supprised there doesn't seem to be a simple lightweight method yet.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: best way to allow game saves
Ahh, I was mentioning that since you said you were using PHP and MySQL, and there really is not a good PHP WebSockets implementation due to difficulties scaling. A lightweight implementation of WebSockets that can work with all modern browsers is Socket.io, a Node.js module. Node.js would take the place of PHP.
The indelible lord of tl;dr