E
E
Eugene Obrezkov2013-06-09 22:42:25
PHP
Eugene Obrezkov, 2013-06-09 22:42:25

What languages ​​and tools are best to use to write a browser game?

Hey Habr!

I apologize. On a sleepy head, I posted a question to the hubs :) I

plan to write my own browser strategy, which contains the concept of "real time". That is, put, for example, the building is being built and it is being built for 20 minutes, even if the player left.
At the moment I am writing in Js + PHP, but I no longer like the “crutches” that I had to make for this.
Can you recommend what would be best for this purpose?

PS I use JavaScript for sure, I'm not going to change it. More interested in the server side and some kind of PHP replacement.

Answer the question

In order to leave comments, you need to log in

11 answer(s)
O
OnYourLips, 2013-06-10
@ghaiklor

node.js is not recommended.
Asynchrony for such a task is also not needed (at the initial stage), there will be ordinary server logic without crutches.
Further performance optimization: make 2 types of server: an asynchronous socket server for frequent low-cost operations and a regular synchronous one for the rest. But don't bother with the first until the game is made at the beta level.
And be sure to look at the analogues of node.js, the node is usually advised when they have not been worked with;)
> That is, set, for example, the building is being built and it is being built for 20 minutes, even if the player left.
Calculate at the time of the request the player whose event data is relevant (the owner or attacker of this city).
Even if the player entered after 5 hours, then after 5 hours calculate that the building was built, and then calculate how many resources it earned in 4:40.

L
lightsgoout, 2013-06-09
@lightsgoout

Nodejs backend, javascript frontend, websockets transport. If you need a database, it might make sense to take mongodb / couchdb, because they store data in json, which is convenient, because both at the front and at the back of the javascript.

N
nadako, 2013-06-09
@nadako

Instead of php - node.js, because. will be able to use the same code for game logic both on the client and on the server. I would also recommend writing not in pure JS, but in Haxe or at least TypeScript.

Y
Yuri Shikanov, 2013-06-09
@dizballanze

For gaming, node.js is a good fit. Asynchronous i/o etc.
Well, or Erlang, if you have experience :)

S
simbajoe, 2013-06-09
@simbajoe

The most convenient, of course, is to use the same language as on the frontend, that is, node.js and websockets. But for these purposes (a small number of requests), PHP in conjunction with Realplexor will be more than enough .

P
pomeo, 2013-06-09
@pomeo

html5gameengine.com so that you don't reinvent your wheel

T
turboNOMAD, 2013-06-09
@turboNOMAD

You need to use your brain, the rest will follow.

A
Alexey Lebedev, 2013-06-10
@swanrnd

You can try ASP.NET, I personally use it in browser games.

V
Vladimir Chernyshev, 2013-06-11
@VolCh

And by and large, it doesn’t matter, but if you start writing a browser-based MMORTS from scratch now, then the architecture would be like this:
The basis is some kind of ready-made (or maybe self-written, if you can’t find a suitable one) system of queues of scheduled events with bindings to popular ones on the server -side languages
​​A lightweight websocket server (I'd try a node for interest, but with phpdaemon in mind) that monitors events from a queue for connected clients and notifies clients of these events.
A heavy-weight backend that, upon a synchronous client request, generates data on past events, pulling them out of the queue and adding new events if they are triggered by a request.

A
AxisPod, 2013-06-10
@AxisPod

As most people will advise node.js, the main thing is to get into it and understand the mechanism of work, in this case you will not catch the problems that you can catch with PHP. Here are some of the big bonuses:
- No locks
- One process processes many requests
- The ability to store one instance of data and interact with data will not require locks

B
bmmshayan, 2013-06-11
@bmmshayan

I've been writing a game (World Of Rest) for 8 years now.
I use only PHP + MySQL, and for decorations JS, JQuery. It seems to me that this set is enough.
Moreover, I have a cross-platform game: there is a version for the KP and there is for mobile devices.
If you have questions - ask.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question