ID:152719
 
I recently decided to do a soccer RPG, but I seem to have run into a fix already. I want the game to have multiple matches going on simultaneously. However, I'm not sure how to handle this. The most logical way would probably be a datum with variables on the opposing sides and everything, but there's one problem.

I have the goal as an area (appropriately called /area/goal) which has the variables team (to see what team the goal belongs to) and game (which game is using the particular goal).

My question is, how would I either do this more efficiently (if this is inefficient) or how to build up on what I have (if this is the best method possible for such a system).
As something I have attempted to do before, with many sports, I think a datum would work to hold a match, but also you can use it to hold team information as well.

I'm not sure exactly how you are handling maps if you are using them, but I used SwapMaps by Lummox JR and it suited my purpose perfectly.

The /match datums should be stored in a /list so they can be accessed quickly and easily.

A possible example for you:
match
var
team
home_team
away_tem
home_score = 0
away_score = 0

team
var
match
current
list
roster

area
goal
var
team
owner
match
current


By the way, if you need it, I wrote a semi-functional program that determines the best possible players for the positions on a team for a preset formation if you need it. =)
In response to Polaris8920
Thank you; the idea worked well. As for the part about the game choosing the best players, I don't think that would fit in well with my idea; I want the RP elements to be as player-driven as possible.

However, the goal still has problems at compile-time (I'm not sure how to access the variables of datum type /match from /area/goal). I'm handling it using an Entered() proc from /area/goal instead of an Enter() from /obj/ball. I think that would be more efficient since, using the ball, it would have to check the area twice (checking if the area it entered is a goal, and, if it is, who owns the particular goal), but, from the goal, it has to check if the thing entering it is a ball, and if it is, who owns itself.

Of course, I could be completely off-base here, and perhaps external (outside the atom itself) checks are more efficient than internal (within the atom) checks , and, if I am, please tell me. I don't want to have to do 600 rewrites just to make the game playable (I doubt it'll be very fast on most computers, since I'm thinking about having the possibility of allowing 30 matches occuring simultaneously).
In response to Drafonis
When you make a new map for the game then I assume you would make a new /match datum. Then you need to find the goal areas in the map using locate() and then set its variable to the current /match.

After this is done, you can access the current /match variable by using something like:
area/goal/proc/GetMatch() return current
if you are using the system I just posted.

I don't know if that is what you want, probably not.

P.S. If the game is multi-player then it may be laggy, and if not then you may still want the position picker for the A.I. opponent teams. Let me know when there is a playable version of the game as I would like to see how it has come.