zondag 23 januari 2011

Handshaking part 3

like the handshake parts on the team level is implemented by now. Initially I am going for the Team 1 Challenges Team 2. Which is probably the hardest part of the system. Setting up an Admin for team1 vs team2 is only extending the system with a few parts (which is going to be easy).

Initially I had to remodel the database structure once more, since there were 2 things that I felt the need to remodel again. Which is the status field on Dates and Maps.

Eventually I had a similar approach on how I did the whole Match setup, where each team had their own field inside the match table. Now I have extracted the team from the dates and maps and made it their own field.

So maps looks like:

- Id
- MapId
- MatchId
- TeamId
- Status

Dates look like:
- Id
- MatchId
- TeamId
- Status

The reason why I am choosing this method is because it makes it easier to fetch the whole date and maps list. I don't need to worry who is belongs too now since that is just the TeamId in ever table.

This leads me with having the option of an Admin adding a match (since this one was really going to be a bitch with the previous method I setup). In anycase, the status will determine if a 'record' is accepted, declined, pending, or new.

So from an admin point of view, I only need to add the status "New" in there and I am done. For a team challenging another it means that all the dates/maps etc are accepted for Team 1, however they get the New status for Team 2 (since they still need to accept one).

If one is accepted, then THAT specific one gets a new state, the rest just gets ignored. Simple as that.

So the process as it currently goes with the "challenge Team 1 vs Team 2" goes as followed, I as team 1 select my own team. Since I am able to have more then one team, I still need to select which team I am going to pick.

Next up, I need to challenge someone. This is where Team 2 needs to be selected.

Last bit, I have 3 fields to pick from where I can input "potential" dates (which are NOT final) where I think the match can take place.

Also, I have to pick 1 till 3 maps to play (since the other team needs to accept at least one of them). And lastly we have the server bits. Which is in this case optional, and can be altered in a later stage.

I fill in this form, and we have ourself a pending match. At this point, I might add that the "SAVE" button DOES save all the information, however it does not show it after I pressed save. This is something I still need to fix.

When I log out and log in as the team captain I just challenged, I'll see this notification at the lower left corner:

Offcourse, this needs to be tweaked and all that. But at least it keeps track of the amount of pending matches that I have in my "inbox" more or less. So that part of the system is more or less working. But needs a fine tune somewhere. We'll get back to that one.

Anyways, to popup the pending matches, I have used the Team Control panel to show most of the important stuff about the team. This might lead to some confusion in the long run (since the team control panel shows alot of info).



There is a section called "PENDING MATCHES". There is will display the once that have been accepted, declined, pending or are new. Eventually this part needs to have a fine tune moment aswell, since there is no date involved yet (so the list just becomes bigger). But that will come in time.

But anyways, by clicking on the match details (which is in this case "TITLE", and has the status NEW) I can bring up the match details and see what dates the other teams have suggested for the match to run.



At this point it has a few different sections:

- Team vs Team
- Dates
- Maps
- Match information
- Player lineup

The last part is not visible on this picture, but in simple terms it just shows a list of all the players belonging to both teams.

The team vs team still needs to be finished, since I haven't gotten around to the inputs of the scores yet. As soon as I get there, and have a ladder/tourney, I can start adding losses/wins (hopes that makes sense).

The dates section is the dates that were recommended by the other team who challenged me. In this case I can only choose from 1 of the 3 dates. If someone enters 2 dates, I can only select 1 date from 2.

Same goes with the maps. We have 3 maps to choose from, and we need to select at least one.

The rest (match info, player line up) is just additional info which tells us what type of game,map, who made the challenge bla bla etc.

in this case, I'll select 1 feb 2011, and go with the map "Kaboom" (does that map even exists? I don't know).

After pressing the "Accept the match" I'll get the same screen, but... without the optional dates.



In fact, it tells me now that the match takes place on 1 feb 2011 19:00, i have 1 week 1 day, 12 hours and 35 before this match starts. The match accepted is filled in with my name (because I accepted it under the account "YO YO")

And I just realized a bug in the system because it displays the wrong map name... Nice!

Lets fix this one ;)

Handshaking Part 2

Ok, after having everything sink down a bit, while setting up the whole view match page its time for the whole handshaking bit. As far as I can tell now is that there are 2 levels of handshaking. One which is a must have, and the second is the optional part. I'll try to explain myself why, how and what in the next few segments.

Match handshake
First of all we have the match handshake. This is the point where teams accept the match, choose which map to play and set a date for the match.

Team 1 (the Attacker) determines 3 times (max) and 3 maps (max) to choose from.
Team 2 has to accept one time and one map to play

or

Team 2 can decline the match (which also results into a forfeit, and team 1 thereby automatically wins the match).

The second level of handshaking is on player level, which happends when both teams accepted the match. In this case the players have to submit if they are able to attend to the match. Thus the whole lineup will be known as well.

The latter part is the part I am making optional (but still make it into play). There are couple of reasons behind this.

- the system is brand new, making the match system too complex in the beginning makes people not to use it
- the lineup is in someway already known since a team has players and these players are identified
- it results into additional checksums that have to take place, since new team members which signed up after the match has been accepted, they cannot join etc.

I might add, in the long run a player handshake is important. That is why I am making this part optional. But for the short term it isn't needed to get the match underway.

So with the view match page already there, this will be the next section I will be implementing in the next day. Since it should not be that difficult to make it work.

vrijdag 21 januari 2011

Match reconstruction

Today i started with the whole match reconstruction. At least, my initial assumption right now is that the whole setup I have done inside the matches itself is eventually going to by myself in the head.

Currently I am having different states for a match for team1 and team2. From a query perspective it works if its limited. However, since the states have alot of impact on what the outcome of a match is going to be it will eventually start into one complicated mess.

In the new setup I have split the match up into 2 different tables. First you have the match, and next you have the team status. This team status is defined by the following parameters:

- Match Id
- Team Id
- Team Side (attack / defend)
- Match Status (accepted/declined the match)
- Match Score Accepted (accepted / declined the scores)
- Match Rescheduled (accepted / declined rescheduling)

From a query point of view it makes it easier for fetching the information. Even while its just another table.

Currently I have fixed the inserts (I am still inserting the old columns inside the matches, however eventually they will be phased out). I only need to fix the view match page where I am gathering the information from the new matchteam table. But... that should not take that long I think.

What else I need to change:
- pending matches on the team control panel
- pending matches notifications on the toolbar (footer)
- function getPendingMatchesCaptain2 is obsolete now

Update: And by now this all got sorted out. So this should hopefully make further developments on the match status a little bit more easy to implement.

donderdag 20 januari 2011

Match scores entering

Ok, this is an interesting process. Since it has been bugging me while i was writing down the code for viewing the matches. There is a point when the match completes. And when this happends the match results needs to be entered in right? Ok.. then comes the pop quiz question:

- Who enters the scores?
- How is this process done?
- is there any role from the admin point of view?

To get answers to these questions, I asked around about how other systems work with this process. And personally I think I understand now where to take this all... Let me write it all down in the next few segments while it is still fresh on my mind:

- The match scores get entered by either one of the 2 team captains
- A match score gets accepted withing 2 hours time
- if the other side does not agree with the scores, they file a complaint towards the admins (dispute).
- If they accept the match results they can simply say "accept"

So this whole process leads into a new section i need to add inside the whole match system. Next to accepting matches, I need to have a field called "accept results". And this needs to be saved for both team 1 and team 2.

If team 1 enters the scores the flag for accepted team 1 will automaticly be set to true.

If one of these 2 fields is set to true, and nothing has happened in the next 2 hours, the match will automaticly be flagged for completed. This also needs to be a seperate field

Next interesting point is "rescheduling a match". This can happen when something goes terribly wrong during the match or it just did not really work out for both teams (eg: too little players, no one showed up etc).

To make this workable there needs to be 2 additional fields for the match which is called rejected team1, and rejected team2.

To be honest, I am beginning to wonder if I shouldn't just seperate the whole match thing into 2 tables. One for the match, and one for the entered data (flags) by the teams. Since from a 'retrieval' point of view it gets pretty messy when they are spread over more then one field.

So more like:

Match, data

Match, Side, Team, Accepted, Reschedule, Score etc

Somewhere in that direction. I just need to think this one really through if I am gonna this or not. Since it requires some changes inside the entermatch/ view match scripts.

Ah well.. I need to edit them anyways.

View Match

Right, here goes the view match page. This one is pretty heavy when it comes to data retrieval, since there is so much info I can grab from a match alone.

My initial idea here is to copy most of that which cybergamer does. Which comes down to the line of "Who vs Who". The match details. The game which is played. The server info. etc.

Then there is the player line up. Now, here is the tricky part. The view page displays every single one. However... If there is going to be a handshake on player level, then this means that I need to find a way here that people are saying they are attending to the match.

The tricky part is that there needs to be some checksum if you are on the team, and if you haven't accepted / declined the match and so on. That is just a piece of logic that could be implemented into this page (since the logic / visual) is seperated from eachother.

Second, the same page could be used for accepting the dates/ maps for the team captains. Again, its defined by the logic, and then presented onto the page if this is the case.

I still need to find my ways on how to implement it. But in basic terms, it just comes down to flag it, say yes/no (or 1 and 0) and then show that part of the form if that would be the case.

Its a shameless plug really...

And we'r setup with most of the information we need...

woensdag 19 januari 2011

MatchStatus

I'll need 2 fields for the MatchStatus. One for team 1, and the other for team 2.
I just realized this when I was making the list of pending matches.

Ok, I just realized the same thing with the match maps, and the dates. What if... Yeah big if. But what if the match is made outside the challenge us section, but manually inserted by the administration.

In that case both teams need to handshake along with the whole thing.
the same thing is with the tournament. since a tournament is most often defined by a set of rules of engagment (at least I can remember this from a BF1942/BF2 tourneys we did).

The ladder however (outside a tourney) is often being handled by the teams themselves (thus the whole challenge us has an impact). And in that case the team that submits the challenge will most obvious accept the maps they selected (hell.. why else select maps that you would suck with right?!)

Anyways, I just modified the script a bit so the dates / maps are now fixed. Also, I noticed earlier on that team2 was never filled. I made a type there. And another thing I need to fix over here is the dynamic Ajax system I inserted. It needs to update when I pressed save.

At least all the data is stored now. I am gonna work on a view page so I can get the handshake system into play.

Handshaking

Ok.. now for the tricky part numero uno... The handshaking between the teams. First of all i need to send an email to the team primary assets (eg, the important dudes of the other team).

This can be fetched using a single query and grab all the people that have the rank of doing matches and so on.

With that in mind, the same people will get access to the pending matches. Since they are able to confirm if they accept or decline... or simply do nothing with it (which also results into a decline in x hours).

The team control panel will be the place to be at for this. However, I like it to be modular so I'll add this into a seperate block code and place it into the team control panel. So just in case I need this list else where I can plug it in... Just like in the Matrix...

The handshake will be a new screen (duh!). Its like an 'edit' match. but more simplfied. It should show the details of the match like who challenges who, which map, game etc.

The user is able to select the map he wants to do, and select the date he wants to do it. When this is done, then the match is set to go. The next step would be the whole player pool... thats comes after the handshake. Since we need a lineup of players who are able to attend to this match.

All this has to take place in like 48 hours or so. Which reminds me... I need to have a date checksum. Since a match cannot take place in the past. And a match has to be scheduled in like +4 days (since there is 2 days between the handshake, then 2 days for the lineup).