Solved

php mmorpg group interaction

Posted on 2011-02-16
20
832 Views
Last Modified: 2012-06-22
Hi,

After having made some websites for clients, I dont have any job ftm... So I'm getting bored :)
In the mean time, I would like to create my own php mmorpg... I know alot of people ask this, but my question will be different.

First of I know how to write php.. i think that is quite important for this matter :)

So, I'm willing to write some sort of dungeon and dragons website. so this means:
several groups playing different games
each group consist of a number of players
one person in each group is a dungeonmaster

Now i've been thinking while writing down some analyses on how to write this website... How would you interact the group with each other? How would you write this part? (not what but how?)

Would you store it all in a database? I mean a group is something that comes and goes... player can leave whenever they like...

But how would you write the code while they are playing?

0
Comment
Question by:Mutsop
20 Comments
 
LVL 13

Expert Comment

by:darren-w-
ID: 34906023
Perhaps you should look to setting up a bulletin board phpbb could be a good option, this uses php and mysql and then modify it to your needs, instructions on site, but suffice to say your server will need to support php and mysql.  www.phpbb.com/
0
 
LVL 3

Author Comment

by:Mutsop
ID: 34906112
euhm.... are you sure this answer belongs to my question? or did you perhaps made a mistake.

I don't really get why a forum has aything to do with what I need.
0
 
LVL 19

Accepted Solution

by:
Bardobrave earned 400 total points
ID: 34906460
I've thinked a lot of times myself in this type of projects.

A game of this type requires some type of dynamic interaction, so a forum is not the best option. It should be something like a chatroom, but, at same time, you would like to have info about users and some ability to change profiles or show certain info.

So my idea coming to scratches is something like this:

1) A web where players, profiles, groups, etc are managed, you even can get a forum inside to publish and arrange gameplay sessions between groups, news, looking for groups, etc...

2) Inside the web, you must allow your users to launch a session of chatroom (or "gameroom" if you prefer). The user who creates the gameroom is the "dungeon master" for this session, and can send invites to other users to join to the chatroom. This "gameroom" should allow users to check their stats and should allow "dungeon master" to check the stats of all the players.

3) A virtual checkboard where players can position their characters and where the "dungeon master" could draw would be very useful.

Once a Session ends, the dungeon master makes some anotations into it's "campaign" data and the "gameroom" instance is deleted (while data referring the session, as duration, players deaths, date, etc, etc... are stored into database)

Hope this helps.
0
 
LVL 3

Author Comment

by:Mutsop
ID: 34906742
There are some nice ideas :)

But how would you do this codewise? For example, the position/coordinates of a player.
This has to be updated everytime he moves his token (using draggable jquery), how would you process this in php?

How about updating this on teh browser of the other players?
0
 
LVL 8

Assisted Solution

by:rationalboss
rationalboss earned 100 total points
ID: 34907020
If you will be using coordinates to keep track of your players, then:

-yes, you have to put it in a database
-make sure you don't allow users to teleport. That means, a user from 1,1 cannot just teleport all the way to 50,50. So, you have to check that the user should be moving only to an acceptable coordinate (around current position).
-whenever he moves his token, jquery will also update the server and say the new coordinate
-the clients who are all connected to the website who are in the vicinity of that player (say 1,1 -- the players within the vicinity of 1,1), should all get the updates that the player has moved from one coordinate to another
-you can identify the players using player IDs. since you know that player IDs are unique, you can use it to identify their characters in your user interface. for example:
 mmorpg-the line of sight dictates to whom they can interact with :)
-your UI should constantly connect to the server for updates, you need to call a single page every how many seconds so when something happens in the server, clients will know about it once they fetch for an update.

As for the deletion of users when they leave, you can set accounts to expire after a month of inactivity.
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 34907304
I don't think a restriction of interaction is really needed on the board, as in this type of game there can be so many different situations in each moment (teleport is actually one of those, but also invisibility, going prone, fly, terrain effects, etc, etc....) So I would let that rest on the back of the "dungeon master", who will determine if a movement is valid or not.

This way, the master will be able to move any token on the map, while players will only be able to move it's own tokens. If I make a bad move, the master will correct it and warn me, or explain me why this type of movement is not valid.

Of course, in every moment you must track the coordinates of every token in the board (probably storing them in a database after each movement) and the main difficulty, as you point, is to update those movements in every player browser.

Usually, this type of gameplay, get a rotational turn-based style. So maybe you can allow the master to create the default positions in the map and assign initiative rotation order. After that, all the players get the initial map and the one with the highest initiative order is able to move it's token, after he makes it's move, he push a button that let it's turn pass. You can create a javascript function that works as a "listener", asking the server every 5 seconds or so if it is your player's turn. When the server returns a change in the turn status you force a reload of the board, and if it is also your player's turn, you get access to movement.

I don't really know... this is a difficult task and it must be cool planned before starting. I'm afraid here the most we can do is brainstorm a bit in order to orientate you in a direction that allows you to reach success.
0
 
LVL 3

Author Comment

by:Mutsop
ID: 34909657
Waw, thanks alot for the explanation... I just came from work and need to go again. But i certainly think about all these points tomorrow and start planning. I'll let you guys know :)

0
 
LVL 3

Author Comment

by:Mutsop
ID: 34915803
@rationalboss

Well I've been thinking about this movement phase. I could use some sort of array as a map and calculate their movement/view range or even line of sight :)

@Bardobrave

Well it's true that the dungeon master should always have its last word on it. But what if a movement has been comfirmed? So I should aslo keep track of previous movements of teh players, so some sort of undo can be done.

About the listeners, thanks for the idea :)


What I'm still not on is, how to process a game if a player is missing or disconnects. Should they pauze the game? Should they be able to continue? What if the players reconnects? Should he start at his leaving point? or should I just let the dungeon master decide?
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 34916809
I think it really depends on the type of game you want to describe. The most restrictive is your UI, the most difficult to fit the adventures into it, but probably your interface apps will be more useful and more powerful.

From my point of view, movement inside the board should be totally free, as the board is only a mere representation of player positions. If you are playing a game with a DM, he's who has to take the decissions about the things that happen on the board. If you restrict your player movements on the board... why do you need a DM?

What I would do in this event is to create a totally free board, where players can positionate their tokens in every place. Normal players only can move their token, and only in certain moments, where it's their turn. On the other side, DM users will be able always to alter the order of players moving and move every token on the map.

This way, if a player makes a mistake moving it's token, the DM can detect it, send to the server an alteration in the initiative order and get a turn after this player's one, correct the movement, explain what happened and let the whole proccess to continue.

As an advantage for this drawback, your games will not be restricted by a static ruleset, if the DM decides that a monster drops an object that doubles a character's movement, or that allows him to fly, or whatever action that your ruleset has not defined, the game will not be altered.

From my point of view, a static ruleset and the control of movement and interactions is absolutely needed in a game without DM, but more a problem that a solution in a game with one.
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 34916848
About reconnections... well... first idea that jumps to my mind. Once a player connects to a instance of gameroom, its ID is stored in player's profile. When he connects to the page it's checked if the last instance he was connected to is "alive", and in this case the user receive the offer to reconnect, otherwise the ID is erased.

When a player disconnects, and sticking to the DM theory, should be decission of the DM if the player disappears or continues being handled by himself (until a reconnection maybe?)

The problem here, of course, is what happen if the DM disconnects... :(
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
LVL 3

Author Comment

by:Mutsop
ID: 34917412
Well for the dm, I could make sure that the session would be saved.... afterwards a voting wold occur under the players of whoever may be the dm. Yet offcourse when the main dm comes back they have the possibility to reload there last session.
0
 
LVL 3

Author Comment

by:Mutsop
ID: 34950878
Okay,

So I've been setting up the core of the website and also started with the database.
Now I have one more problem.

I've set a table for the game room which hold:
title, description, created_date (which makes sure that after 30 days of inactivity the room will be deleted)
DM_ID (the user id of who is the dungeon master of that room)
map_id (text file of map)
isPublic (wether the room is public or not)
min_rating (so each public player gets rated by other players to prevent trolls from joining)

Now I also added a table which holds the connection between the users and gamerooms:
user_id
gameroom_id
coordinates

Now what I'm stuck at is, how would a dm add monsters/traps/.... to a map and be able to save it? Should I do the same as the connection between users and rooms? Or do you guys have another idea?

Also opinions/suggestions are welcome on the previous tables
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 34951359
I think that a board whould has it's own table, related to the gameroom. So a gameroom holds the chat and users interactions, and the board holds positions of tokens related to players.

You can treat the board as a matrix, so you load an image file as background for the map, and add a reticule over the image to allow players to precisely measure the movement of their players. DM should be able to stablish the size relationship of the reticule: i.e.: I want for my map a 30x60 reticule, and I stablish that every cell of the recitule will size ingame 3 foot by side.

This way, you can add tokens (monsters, players, structures) to the map by using image objects in a more external layer, and place them always related to the reticule coordinates.

So each time you have to load (or reload) the board, you read for the board instance:
The background map to render.
The characteristics of the reticule to draw.
For every Token (elements in a related table to the board) in this board instance
   read it's image file and it's coordinates inside the map
   load the token inside the point expected.

This is, at least, the way I see this structure. I hope it helps you.
0
 
LVL 3

Author Comment

by:Mutsop
ID: 34958613
k, but a chat would need it's own table no? also each user/room related stuff would also needs its own table I think (Let's say his character with level and attributes that improve).

Also for the board I might have found an nice addon which I might use and modify
http://www.wizards.com/default.asp?x=dnd/dnd/20061121t

0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 34958979
Yes, of course, every individual entity will need it's own table, even you should think in using a table for players and other one for characters, so this way one player could be able to play different campaigns with different DMs and characters.
0
 
LVL 3

Author Comment

by:Mutsop
ID: 34959022
Well thanks for your help :)

It helped me alot... Now I would need to find some time coding this project
0
 
LVL 3

Author Closing Comment

by:Mutsop
ID: 34959048
Thanks alot for your help
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 34959336
Good luck with your project. It's something I always wanted to do but never found time :)

Tell me when you need testers ;-)
0
 
LVL 3

Author Comment

by:Mutsop
ID: 34959565
I certainly will :)
any way to contact you? As I can't seem to find contact information on your profile

But same as you, I don't have that much time, so it might take a while before I'm at even alpha testing :D
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 34960693
You can contact me through bardobrave at gmail dot com

If I have any time when you start testing I'll lend you a hand.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now