Jump to content

Help with Multi Player Game?


Lunar Tripsa
 Share

You are about to reply to a thread that has been inactive for 2844 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi Everyone,

I'm tring to figure out a script for a game and I need a little help in what direction to go with it.  If only one person was going to be playing I;d have no problem with this, but I;d like to be able to have several people play at once.  

Player A clicks a piece then clicks where he wants the piece to go.  Player B is doing the same thing.  It will not be turned based  so there may be two or more active pieces waiting for locations at the same time.

I can record the uuid of the touchers and what was touched but when they touch the location for the piece to go, whats the best way for that spot to get the info?

Any help would be great!  This is new tterritory for me.

Link to comment
Share on other sites

This is really a logic question. (Actually, most scripting puzzles are logic questions. :smileywink: )  Unless you can carry it all in your head, the best approach is to map out a diagram on paper so you can see all the decision points and what information you will need at each one.

From a mechanical point of view, though, you have an array of possible spots for a piece to land, and you really have two states for each spot: (1) empty or (2) occupied by a piece that was placed by player X or Y.  You really only need to keep a record of the spots that are occupied, so build a strided list:

glOccupied = [spotID, Player_UUID, SpotID, Player_UUID, SpotID, Player_UUID....]

Then, if a player wants to move a piece, check the list to see if the spot is already occupied. If not, move the piece and then update the list by replacing the old SpotID for that piece and replacing it with the new one (llListReplaceList).  If you are clever about how you design your playing area and how you name the SpotID, you can make the SpotID carry implicit information about the spot's location.

SpotID = 3550;

vector SpotPos = <(float)llGetSubString(SpotID,0,1), (float)llGetSubString(SpotID,2,3), Z>;

So, in this case SpotPos = <35.0,50.0,Z>

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2844 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...