Jump to content

MORPG: Will phaser work? Bounding boxes, shared UI elements, large interface, 400+ players


Datdiscordboi
 Share

Recommended Posts

I'm looking to create a game that supports 500 players on a large map (let's say 5000 by 2500 tiles) . I want most of the map loaded at once. The game's goal is an intensive 2d open world combat game with a lot happening on the screen. Not so much with particle effects or bezier curves, but just a lot of moving objects.

One thing I am worried about is how phaser controls UI elements. Is there a way to share the same set of elements with the same behavior, between multiple clients?

Is there a preferred networking system/API that people use with phaser that can make use of things such as sticky bans with ease, and does a lot of the work for you?

I want my interface to be large, and possibly scale-able. My goal would be a perfect fit to a 1366x768 screen, minus the title-bar, full-screen minus the taskbar. Is phaser going to have trouble rendering  objects for a large interface with a lot of players?

I'm trying to figure out how collisions work within phaser and, it's not compiling in my brain. I am used to setting the bounding region for an item and then having it interact with a few types of objects - Turfs, which, if their density = 1 , they are unable to overlap, otherwise they can, in which, collisions will be called if set - and Objects, which, same deal, only turfs are specifically set to the ground that the player walks on, and objects can be projectiles or both over/under fellow players.

 

Link to comment
Share on other sites

11 hours ago, Datdiscordboi said:

I'm looking to create a game that supports 500 players on a large map (let's say 5000 by 2500 tiles) . I want most of the map loaded at once

Why do you need all of it loaded on each client?

Render just what that client needs. The server handles the logic for updates to each entity, which you can propagate to the client to decide what to do with, if its visible then it'll need to be re-rendered, if it is not visible then just need to update the data for that entity.

11 hours ago, Datdiscordboi said:

One thing I am worried about is how phaser controls UI elements. Is there a way to share the same set of elements with the same behavior, between multiple clients?

This is an odd question. Each client is, essentially, detached from each other. This means that whatever client code you have to render the UI will do so the exact same way for each client (unless you have something more complex where different clients get different versions of your game, but you probably dont want to get in to that).

Phaser renders to canvas so it handles UI elements the same as any other sprites/graphics. Canvas isn't particularly good at rendering a UI, not compared to DOM. Consider whether using the DOM for your UI is going to be the best way to go for you. Stuff like layout and styling is easier and sometimes better with the DOM, not to mention event handling.

Canvas is good at rendering stuff really fast, leave that for your game view, which might well be fast moving. Your UI likely won't be so DOM could very well be the best fit for you.

11 hours ago, Datdiscordboi said:

Is there a preferred networking system/API that people use with phaser that can make use of things such as sticky bans with ease, and does a lot of the work for you?

Sorry, no idea, I've always written that stuff myself. Bans are essentially just a flag on a user object stored somewhere, when they attempt a login, check the flag, if set then send back the appropriate message and get the client to render whatever it needs (hopefully outlining some steps to lift their ban rather than a 'go do one' style message).

11 hours ago, Datdiscordboi said:

I want my interface to be large, and possibly scale-able. My goal would be a perfect fit to a 1366x768 screen, minus the title-bar, full-screen minus the taskbar. Is phaser going to have trouble rendering  objects for a large interface with a lot of players?

Again, each client renders their own UI, so no issues here.

11 hours ago, Datdiscordboi said:

I'm trying to figure out how collisions work within phaser and, it's not compiling in my brain. I am used to setting the bounding region for an item and then having it interact with a few types of objects - Turfs, which, if their density = 1 , they are unable to overlap, otherwise they can, in which, collisions will be called if set - and Objects, which, same deal, only turfs are specifically set to the ground that the player walks on, and objects can be projectiles or both over/under fellow players.

Not really sure what you're getting at here. Collision code essentially emits an event when two objects overlap (or collide), you then proceed to do something based on the properties of the two colliding objects. Whenever an object moves it must check for collisions with all other objects, this can be fairly inefficient. If you have objects that never produce collisions (such as possibly ground on a 2d overhead map) then there's no need for them to be in the list, you might also want to do stuff like keep proximity maps so that objects only check for collisions with nearby objects, your decision here should be based on whichever is fastest out of running collision detection algorithms against all objects vs the cost of maintaining a proximity map.

This is a mature field so there are lots and lots of different ways to do collision handling but they usually boil down to detecting a collision between 2 (or possibly more) objects and then reacting to that collision.

For example, when an entity, lets call it a Goblin, moves, you write some code that says move the Goblin from x=4 to x=5 (for example), before you execute that move you check if any other entities occupy x=5 (or you work out the new bounding box of the goblin and check for overlaps with other entity bounding boxes, or maybe you do per-pixel collisions). If there are any collisions then you work out what to do. For each collision -> If the Goblin collides with a 'Bridge' entity on the map, then you likely say, that's fine, go ahead and move, if it collides with a 'Fireball' object then you handle a collision between Goblin-Fireball, possibly reducing the HP of the Goblin and destroying the fireball, possibly going further and have the goblin 'absorb' most of the fire ball (and take damage, or not if they are wearing Chainmail of the Fire Demon +10000) but then split the fireball in to multiple smaller balls of fire (splash?) etc etc whatever you want.

Link to comment
Share on other sites

If you really want to have a 500 concurrent multiplayer game, Phaser won't be your first issue. Networking will. 

Because you're working in the browser, you'll have no choice but to use websockets. And if you plan on sending all 500 players' positions (+ other stuff like hp, mana and so on), then good luck with that. There is absolutely no way this will ever work. You'll have your server sending HUGE packets (containing 500 players' data) to 500 players. Probably 20 times per second or something like that. Sounds impossible to me.

Either your game is not real-time (so the frequency will be much lower and players won't all play at the same time), either you'll have to do some very complex quad tree division : for the rendering, maybe, but mostly for the network. To avoid sending all 500 positions but only the positions of the closest objects. But this seems like a lot of work.

Your game seems very ambitious, but I'd be thrilled to test it!

Link to comment
Share on other sites

23 hours ago, mattstyles said:

I remember reading a post about Eve Online (or possibly Elite:Dangerous) where they chunked up users by system but always had issue for special events when loads of users ended up spamming a specific system. Unfortunately I can not remember the article or the solution to the problem!!

I think they slow down time when a sector or system becomes too crowded, or rather, time slows itself down due to the crippling amount of data the server has to process.

 

Sources -

http://news.softpedia.com/news/EVE-Online-Readies-the-Largest-Supercomputer-in-the-Gaming-Industry-35225.shtml

https://www.engadget.com/2008/09/28/eve-evolved-eve-onlines-server-model/

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...