• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
DanRucci

Socket.io / PHP / MySQL

4 posts in this topic

Hi all.. I am new here and have been looking around the forum for a few days now, lots of interesting and helpful resources.... a great community!

I am part of a team whos been running a MMORPG for a number of years... it quite basic because it hasnt been touched in about 4 years... so for example there's no AJAX.

We are now working on overhauling the game and are looking at using reverse AJAX for push requests to the client browser. I have used normal pull AJAX before using the Sarissa framework, which I found easy to use and reliable.

Being a mass multiplayer game we need to be able to cater for large numbers of active players. I dont particularly want to poll the server(s) for updates but want to use boradcasts from the server when the clients need updating. For example when a clients stats change, or someone chats to them etc...

I have been investigating the use of Socket.IO so we can use WebSockets. I am new to socket programming so having some difficulties and am in need of some help - and am willing to pay.

What I basically want is a working example/prototype of the use of Socket.IO. We use a LAMP configuration and basically need the "server" to pull data from our MySQL database then broadcast it back to one client, or many clients. I also want the clients to be able to send messages to the server and then have that server process that data, connect to the DB (store data), then broadcast messages back to the client.

Can someone help me with this? Like I said willing to pay.

Look forward to working with someone!
0

Share this post


Link to post
Share on other sites
[quote name='Ruccopia' timestamp='1319523924' post='4876640']
What I basically want is a working example/prototype of the use of Socket.IO. We use a LAMP configuration and basically need the "server" to pull data from our MySQL database then broadcast it back to one client, or many clients. I also want the clients to be able to send messages to the server and then have that server process that data, connect to the DB (store data), then broadcast messages back to the client.
[/quote]

I found some socket.io examples:
[url="http://www.lmgtfy.com/?q=socket.io+examples"]http://www.lmgtfy.com/?q=socket.io+examples[/url]

However, I think that your architecture is fundamentally wrong for what you want to do. If you want to push updates with low latency, taking the data out of MySQL just isn't the way to do it. It would be better to use something like a node.js or webmachine server with persistent connections from clients. You can, for example, request a HTML document that is chunked transfer encoding, and where you push a new <script></script> block each time there's some new event. Or you can use double-buffered AJAX requests for JSON data. These methods are going to be a lot simpler and more compatible than using WebSockets.

If all players can fit on a single node.js or webmachine server (which is likely for most indie games), then your system can be as easy as a persistent process that serves HTTP requests and returns messages that are pushed in by other users.
0

Share this post


Link to post
Share on other sites
Appreciate the reply!

My understanding was that socket,io does use node.js (I thought I read it somewhere)... maybe Im wrong.

Our data is in MySQL so if not MySQL then how? Player statistics and other data is in there we need to return back to the client. So basically when player data is updated I want the server push to the client the new stats. As well as other things... chat etc...

I'm happy to use node.js, just want an example that I can use that relates to what I'm doing. Im here to get advice and happy to try something you think will be better for the application. The first step we have is deciding which way to go then get someone to build a prototype of it working. From there I can do the rest.
0

Share this post


Link to post
Share on other sites
[quote name='Ruccopia' timestamp='1319623392' post='4877124']
Our data is in MySQL so if not MySQL then how? Player statistics and other data is in there we need to return back to the client. So basically when player data is updated I want the server push to the client the new stats. As well as other things... chat etc...
[/quote]

As I said, the real-time data needs to live in RAM. Databases are for things that must live for a long time. That does not include chat :-) The main problem here is making sure that everyone who needs to know the same data is connected to the same RAM, if you use more than one server machine. If you can stick to a single server, this becomes easy!
For player data, you can have whomever updates the player data both checkpoint it into the database, and push a notification to anyone who's interested.
Redis publish/subscribe may also be a useful mechanism for those kinds of updates. as would perhaps some of the dedicated message queues like RabbitMQ, ZeroMQ, etc.
0

Share this post


Link to post
Share on other sites
One more thing to consider is what level of investment you can/want to make into your custom messaging in the browser. One option is using the low-level WebSocket messages, but when it goes beyond the very basic samples, you will more often than not find yourself reinventing the wheel by developing some sort of a custom protocol.
What I see developers finding useful is having the messaging protocols extended all the way to the browser, allowing them to code against AMQP or JMS. While you're developing against AMQP/JMS, the messages are sent over WebSocket all the way to your AMQP/JMS back-end server.

Also, if interested, here are some pretty cool [url="http://kaazing.com/demo"]hosted demos[/url] you may find useful: interactive games remote controlled by a tilt-enabled mobile devices, as well as lower level core JMS demos.

Hope this helps,
Peter
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0