Sign in to follow this  
Jon W?i???

Questions About Scalability And Performance - Html/php/sql/javascript Project

Recommended Posts

Hello everyone,

 

I've been working on a personal project for about a month and I wanted to ask a few questions that I was having issues with finding an answer on my own.

 

I'm developing a browser-based game very similar to a 'Kingdom of Loathing' in playstyle and structure, somewhat similar to a 'Travian' in art style.

 

I don't plan on using much in terms of animation, mostly just Javascript for some 'tooltip' solutions when hovering over items, Javascript (possibly Ajax) for the chat system and event window.

 

I have a couple questions though, any opinions or advice would be greatly appreciated.

 

1. I started programming in college in 2001, and I haven't used my programming skills since about 2009, so I am currently using a SQL database with various tables to store all of my information (Login info, character info, inventory, monster info, item info etc). Is there a 'better' or more scalable modern solution? Obviously it works fine with two sessions connected, but if I had lets say 1000 sessions connected simultaneously, would I run into any issues storing everything 'persistent' about my game in SQL while retrieving and storing using PHP?

 

2. I've read a little bit about Comet as a replacement for using AJAX, is there any real reason I should stay away from AJAX and use something like Comet or Ape? (perhaps my next two questions would give you a better idea of what Im trying to do with it)

 

3. I'm currently using a very very simple Javascript chatbox that I found on the webz (https://www.metachris.com/projects/most-simple-ajax-chat-ever/demo.html). However, I want to use a chatbox that is tabbed for the different channels like Local, Global, and then private messages that would pop up another tab with that player's name on it. Actually storing the conversations and being able to change what it looks like is not really necessary at this stage. Does anyone know of a very simple, barebones, nothing pretty chatbox system that I could possibly implement?

 

4. My event window is reminiscent of something you'd see in WoW, or Everquest (example: http://cdn-wow.mmoui.com/preview/pvw14941.jpg). I'm pulling values from a SQL table to get the damage values, then using those values to calculate using some RNG. Would you think AJAX is the quickest, easiest most efficient way to display this information in real-time without having to refresh the page? Or is there some other new technology that I could use to prevent scalability/performance issues in a larger scale?

 

Thats about all for this post.

 

I really appreciate any opinions or suggestions on which perspective I should be looking at implementing these features.

 

Thanks again,

Jon

Edited by jonwright214

Share this post


Link to post
Share on other sites

I'll mostly reply theoretically as I am in same wagon, didn't have dedicated time for coding for a long while as well.

 

1 - Using a relational database is still a wise option if data is structured and serialized. But you may consider using something like MongoDB for non-crucial data ( X got Y sword ages ago ) in addition to relational one.

 

2 - I think best option is using Websockets with fallback to AJAX ( Socket.IO ? )

 

3 - Never had to use chatbox but if you ignore tech debt, stumbled upon this http://socket.io/get-started/chat/ while trying to remember socket.io . Also it will be wise to check if webRTC fits in somehow.

 

4 - A websockets/ajax solution seems to best bet once again.

 

Btw, you may consider an in-memory solution such as Redis to reduce load on main DB

Edited by Unduli

Share this post


Link to post
Share on other sites

Looks like I cannot install node.js on the free host I'm using (x10hosting)... so for now, I need to find something else.

Thanks for the suggestion either way though.

 

-Jon

Share this post


Link to post
Share on other sites

I was actually 'Inspect'ing Kingdom of Loathing's chat code in Chrome and it looks like it has some serialized divs that it creates, however, I'm not good enough at coding to figure out what is going on behind the scenes even to just display their chats, let along how exactly they are utilizing all the nice 'slash/' commands for their chat.

 

Anyone happen to have any insight into what they are doing on the server side for their chat, or perhaps can point me to some code I could look at that is doing something similar?

 

And please keep in mind it looks like I can't install things like node.js since I'm using a free host. Speaking of that, would anyone like to suggest a host, even if costs something, just nothing crazy like $20 or more a month for my project while it is still small-scale (obviously if it takes off, I'll be spending a lot on hosting, I'm sure.).

 

Thanks again everyone,

- Jon

Edited by jonwright214

Share this post


Link to post
Share on other sites

Well, performance is a matter of debate but DigitalOcean starts from $5 / month and Linode from $10 / month if you don't mind administrating whole system.

 

Or can look for a PHP based alternative to socket.io ( Ratchet http://socketo.me/ maybe , just googled )

Edited by Unduli

Share this post


Link to post
Share on other sites

If you want to develop this in Node, you can take a look at heroku. They have a free plan that you can use to test until you want to launch the game and then the hobby plan costs like $7. It also lets you deploy applications in PHP, Java, Python and others apart from Node.

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