Jump to content
  • Advertisement
Sign in to follow this  
Ispiro

What do I need to create a Multiplayer Browser Game?

This topic is 2640 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone,

I'm trying to create multilayer browser game that has 3D graphics. I'm not entirely sure it's called "3D" so I'm gonna try to explain a bit more on how I want it to look.

http://mmohuts.com/w...ia-1024x768.jpg

Something similar to this, except that movements is a little more different. In the game in the picture, the character model can look right, left, up, or down. Unlike the game in the picture, I want to give the user the freedom to rotate their character as they wish. Also another different I think I should mention is that the game in the picture is "tile-based", if you press an arrow key, the character will move an entire tile in the direction. I would like to have a more "fluid" motion and still maintain the rule that 2 objects cannot qualify the same space at the same time.

I have _some_ experience with game and website development, but never browser games. And I has pretty much no experience when it comes to graphics, all my contribution to my projects were strictly programming quests, changing gameplay rules, etc. I know some C++, PHP, Python, Lua, HTML, CSS, and Javascript. Some better than others.

The language I'll be using is probably ActionScript, and from what I read about it and the games I played created using Flash, this should be enough.

My goal is to create a decent, professional-quality browser game, but I'm not sure where to start. What do I need to know to do this kind of thing? I realize I'll need to learn how to create games in Flash, and server-client connections. But what about the character models, building "sprites", etc.? What tool do I use to create those, and are there libraries in Flash for this kind of thing? The camera the user is looking from will not be "moveable", so they'll always be looking from 1 side which means that still objects only need to be drawn in 2D, while moveable objects(like the Character that the player will be able to rotate freely) should be drawn in 3D. But again, what tools do I use? and is there any Actionscript3 help online on how to do this stuff?

I apologize for any grammar/spelling errors. English is not my first language.

Best Regards,
Ispiro.

Share this post


Link to post
Share on other sites
Advertisement

Hello everyone,

I'm trying to create multilayer browser game that has 3D graphics. I'm not entirely sure it's called "3D" so I'm gonna try to explain a bit more on how I want it to look.

http://mmohuts.com/w...ia-1024x768.jpg

Something similar to this, except that movements is a little more different. In the game in the picture, the character model can look right, left, up, or down. Unlike the game in the picture, I want to give the user the freedom to rotate their character as they wish. Also another different I think I should mention is that the game in the picture is "tile-based", if you press an arrow key, the character will move an entire tile in the direction. I would like to have a more "fluid" motion and still maintain the rule that 2 objects cannot qualify the same space at the same time.

I have _some_ experience with game and website development, but never browser games. And I has pretty much no experience when it comes to graphics, all my contribution to my projects were strictly programming quests, changing gameplay rules, etc. I know some C++, PHP, Python, Lua, HTML, CSS, and Javascript. Some better than others.

My goal is to create a decent, professional-quality browser game, but I'm not sure where to start. What do I need to know to do this kind of thing?

I apologize for any grammar/spelling errors. English is not my first language.

Best Regards,
Ispiro.


The game in the picture looks very much like a 2D game to me. Its just that each one of the sprites has been draw from an angle, giving the illusion of 3D.

- If your programming for more fluidity, then each object, player, tree needs to have a Vector attached which stores its location relative to the map. This is the alternative to a cell based game where each object belongs only to a cell.
- You then need to create a collision detection algorithm for each time a player moves. If its multi-player then you need your client to send a request to the server for a collision check and based on the response allow the player to move. As the player location is stored as a Vector (and so is everything else on the map) you need to include objects height and width in order to check collision.

Once you have those two problems solved you can start working on adding objects and content.


Edit:

Another option would be to "fake it". Keep the entire map cell based but allow the player to "walk" between cells and store a position of the player offset from the current cell. The collision check would still be cell based and very easy to implement.

Share this post


Link to post
Share on other sites
@Viscus: Yeah I know the game in the picture is 2D, and the character models can only look north, east, south or west, meaning they only have 4 "sprites". The game I wish to create would be different in that the models can rotate any way they want and you can see the character at any angle. I realize the game is still technically 2D, but I want to be able to have 3d models represented in that 2D game. Not sure how to explain it any better :P

That said, I think I'll go with the first choice that players move and the server confirms or denies. But is that even a good idea to do if 2 players can't occupy the same space at the same time? Or should I make it possible for 2 characters to occupy the same space so players would get the feeling of instant action. It wouldn't really be that cool if a character keeps getting knocked back to their old position because of lag.

What do you think?

Best Regards,
Ispiro.

Share this post


Link to post
Share on other sites
I did some research and decided it's best to use Flash if I plan on creating a game like this. I also expect I'm going to need to do alot of learning before being able to create this game, so I'll be forced to making smaller things first. That's alright.

This means I'll be using Flash, Javascript, & PHP. I already have some experience with using Javascript to request data from server, so I guess that's a step in the right way. I have an idea about how I'll program the game "laws", and "making the buttons work". But drawing the buttons, the character models, moving them around, etc. That's gonna take a while, and that's the biggest part I need help with. What programs do I use to create the model themselves? And are there any specific Flash libraries that I'll need?

Best Regards,
Ispiro.

Share this post


Link to post
Share on other sites
Bump. I updated the first post with more "detailed question". Would really appreciate any help, even if you don't explain, and just list names of stuff I'll probably need.

Best Regards,
Ispiro.

Share this post


Link to post
Share on other sites
Well if your absolutely fixed on having 3D character models, then maybe flash isn't the right choice. As far as I am aware flash can only fake 3D. Maybe you should look at other options, maybe Unity.

If your looking for a place to start, make a design document. For starters this should include details about the game, a full description, its scope (how big is the project), the look and feel, example pictures as well as all the details you've mentioned previously. You should probably also include a client / server model in this document, as its going to have a big impact on the way the game is coded.

Next you need to get something working. Start client side and make a program with a character moving around. At this stage is doesn't matter about the quality of the model (or even if its a character). Just get a model running around using controls on a flat plane. Once you've achieved this I would suggest then linking the character to a grid model and thinking about how you want to process movement with the server. As mentioned before there are different ways of approaching this.

For a beginner this is a massive undertaking. So take it step by step.

Share this post


Link to post
Share on other sites
Hey Viscis,

I've already started on making a design document and it's looking pretty good. I have a pretty good background in programming and I've already worked on a game server emulator for an online game so I have _some_ idea how client-server stuff is gonna be. It's scope is not big at all, I don't expect more than 3-5 players at a time, most of which will probably be my friends testing things out. I'm just trying to learn here, and setting "milestones". This is my first milestone, and there will be smaller ones on the way.

I have already started on a client side program that has 2 boxes. Each one moved by different client and changes are reflected in server side and spectator client that has no control of any boxes, but sees them moving and gets a message saying "COLLISION" when they bump into each other. There is a problem though.. If I try to enforce a rule that 2 boxes can't overlap, things start acting funny because of network delays. I need to create the check for collision server side, and send back message to allow the box to move in that direction or not. But if I do that, every movement is kind of slow, and client has to wait for server response which, if delayed, would result in very bad gameplay..

Not sure how to handle this here... I'll figure it out.

That said, I really thing it's best to use Flash. I have already seen a couple games where characters are 3D.

Share this post


Link to post
Share on other sites

Hey Viscis,

I've already started on making a design document and it's looking pretty good. I have a pretty good background in programming and I've already worked on a game server emulator for an online game so I have _some_ idea how client-server stuff is gonna be. It's scope is not big at all, I don't expect more than 3-5 players at a time, most of which will probably be my friends testing things out. I'm just trying to learn here, and setting "milestones". This is my first milestone, and there will be smaller ones on the way.

I have already started on a client side program that has 2 boxes. Each one moved by different client and changes are reflected in server side and spectator client that has no control of any boxes, but sees them moving and gets a message saying "COLLISION" when they bump into each other. There is a problem though.. If I try to enforce a rule that 2 boxes can't overlap, things start acting funny because of network delays. I need to create the check for collision server side, and send back message to allow the box to move in that direction or not. But if I do that, every movement is kind of slow, and client has to wait for server response which, if delayed, would result in very bad gameplay..

Not sure how to handle this here... I'll figure it out.

That said, I really thing it's best to use Flash. I have already seen a couple games where characters are 3D.


Sounds like you've got it all planned out!

Maybe try something like:

- Static objects can be handled locally. I.e. if an object in the game world never moves (Unless you have walking trees) test for collision locally - or have the server send a list of areas that we cannot access.
- Dynamic objects (like other players) can be checked locally to some degree. For starters only check players that are within a certain range of each other:

You could keep three local lists of nearby players, close players and very close players. Each of these lists is updated at 10, 5 and 0.5 seconds respectively by the server. The client on movement checks and updates the lists until they expire / until a new list is received. This way more of the collision checking is done locally and if the server is late with a new list - you've still got something to go by.

---

Applying this to your simple box demo:

If the two boxes are at 100, 100 and 200, 200 respectively and can only move by 5 every 0.5 seconds. It takes roughly 10 seconds before they can collide. So for a good 6-7 seconds there is no need for collision checks - unless you have free cycles. So lets say after half of that time has expired we check again, if the boxes are closer - only wait for 3 seconds or so before re-checking.

---

One way to limit spectator lagg is to buffer it slightly, say 10-15 seconds behind the actual game play. It its not absolutely essential that the spectator sees real time then it will make for a much smoother performance.

You can also cheat slightly if its just simple movement by not sending as many updates:

Your first spectator receives 100 packets of co-ordinates.

Your second spectator receives 50 packets of co-ordinates, but extrapolates them into 100 by working out the direction the player was moving at the time.

Say you have packet#1: 100, 100
packet#2: 200, 200

Smooth this by averaging the distance between them (100, 100) and dividing it by two (50, 50) and add this to the packet#1 ---> (150, 150)

Share this post


Link to post
Share on other sites
Edit(sorry about putting it at the top of the post, would hate to make you read the wall of text only to find out that it was a waste of time): Decided it would be best to depend on client for collision checks(and allow collision incase of network delays), atleast at the moment. I feel like I'm getting too focused on this part of the development process. I'll work out these things once I get an actual playable game.

Also I'm going to create it in 2D instead of 3D for the time being, for a couple main reasons. First, It would be easier for me to create the graphics, second, it would be easier for me to create a tile game. Should I decide to move on to 3D, atleast I'll be more experienced and better qualified to do so.

I think I understand most of what you wrote there, but what I had in mind is that the 2 boxes must always be in sync.

For example: let's remove the spectator out of the game for now. There's a Red Box, and a Blue Box. I control the Blue, you control the Red. The objective of the game is for the Red Box to pass by the Blue Box, kind of like air hockey, without the hockey puck. I(the Blue Box) try to make sure nothing gets by me, and you try to score by getting inside the goal. Ofcourse, this is a horrible game, and even more horrible example, but I can't find a better one so I apoligize... For a game like this to work, I need to see exactly where you are, and to block you, I must move where I think you will go. If I let the client do the collision checks, this game could be cheated, also the client check would depend entirely on one client alone. So if you try to score, and as far as your client knows, I'm not blocking your way, you will be able to score. But the problem here is that, I was blocking your way, and server acknowledges that I was blocking your way, but your client was not updated yet because of network delays.

The game I have in mind is a little bit more forgiving with overlaps, so I'm not entirely sure this mini-game I'm working on is a good idea to begin with.

Let's say I'm creating a strategy game, where you build an army of tanks that you must use to destroy the other team's base. There is only one way in and out of your enemy's island. And that way is through a small bridge. This bridge could be blocked by enemy tanks, which you can't simply "walk through". If both teams are trying to get on the other side of the bridge at the same time(and collision checks are made client side), chances are, tanks will be overlapping enemy tanks tens of times because of network delays. I need a way to make it so that they can't overlap, yet allow for instant response if player decides to move their tanks. I'm thinking maybe that if you move your tank on a spot, which is already occuppied by an enemy tank(but you can't see it because of network delay), then server would send you a message that tells your client to "knock back" your tank to it's old position. Or, I could keep the collision checks entirely client side, and allow overlaps in cases of network delays. However, this then could allow hackers to cheat by modifying the client collision check to always allow movement.

What do you think? I hope I didn't misunderstand your last post.

Best Regards,
Ispiro.

Share this post


Link to post
Share on other sites

Edit(sorry about putting it at the top of the post, would hate to make you read the wall of text only to find out that it was a waste of time): Decided it would be best to depend on client for collision checks(and allow collision incase of network delays), atleast at the moment. I feel like I'm getting too focused on this part of the development process. I'll work out these things once I get an actual playable game.

Also I'm going to create it in 2D instead of 3D for the time being, for a couple main reasons. First, It would be easier for me to create the graphics, second, it would be easier for me to create a tile game. Should I decide to move on to 3D, atleast I'll be more experienced and better qualified to do so.

I think I understand most of what you wrote there, but what I had in mind is that the 2 boxes must always be in sync.

For example: let's remove the spectator out of the game for now. There's a Red Box, and a Blue Box. I control the Blue, you control the Red. The objective of the game is for the Red Box to pass by the Blue Box, kind of like air hockey, without the hockey puck. I(the Blue Box) try to make sure nothing gets by me, and you try to score by getting inside the goal. Ofcourse, this is a horrible game, and even more horrible example, but I can't find a better one so I apoligize... For a game like this to work, I need to see exactly where you are, and to block you, I must move where I think you will go. If I let the client do the collision checks, this game could be cheated, also the client check would depend entirely on one client alone. So if you try to score, and as far as your client knows, I'm not blocking your way, you will be able to score. But the problem here is that, I was blocking your way, and server acknowledges that I was blocking your way, but your client was not updated yet because of network delays.

The game I have in mind is a little bit more forgiving with overlaps, so I'm not entirely sure this mini-game I'm working on is a good idea to begin with.

Let's say I'm creating a strategy game, where you build an army of tanks that you must use to destroy the other team's base. There is only one way in and out of your enemy's island. And that way is through a small bridge. This bridge could be blocked by enemy tanks, which you can't simply "walk through". If both teams are trying to get on the other side of the bridge at the same time(and collision checks are made client side), chances are, tanks will be overlapping enemy tanks tens of times because of network delays. I need a way to make it so that they can't overlap, yet allow for instant response if player decides to move their tanks. I'm thinking maybe that if you move your tank on a spot, which is already occuppied by an enemy tank(but you can't see it because of network delay), then server would send you a message that tells your client to "knock back" your tank to it's old position. Or, I could keep the collision checks entirely client side, and allow overlaps in cases of network delays. However, this then could allow hackers to cheat by modifying the client collision check to always allow movement.

What do you think? I hope I didn't misunderstand your last post.

Best Regards,
Ispiro.


Probably should have asked this in the first place but are you using UDP or TCP?

UDP are network packets, TCP is a constant connection.

My suggestion would be to use TCP and have a constant stream of updates going to both clients and back to the server. This way it shouldn't matter as much if the connection is delayed slightly as you'll still have more data than you need.

You can still check for collision locally but have the client use the last known position from the server.

If there is a delay of say 500ms in the connection, disallow all commands until a connection is re-established. This should mean if you do lagg, you cannot move the unit at all, solving the problem?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!