Skip to content

Commit

Permalink
Adding initial documentation pages
Browse files Browse the repository at this point in the history
  • Loading branch information
EkoDy committed Mar 7, 2024
1 parent 7efbca1 commit 67f236a
Show file tree
Hide file tree
Showing 6 changed files with 355 additions and 0 deletions.
178 changes: 178 additions & 0 deletions docs/MatchmakingQueue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
# **MatchmakingQueue**

Provides access to a queue and all the functions to manage data/matchmaking.

## **General methods**
### **QueuePlayers**
The built in function to find a match for the given array of players.

**Parameters**
<table>
<tr>
<td style="background-color: gray">players: Object</td>
<td>The array of the player(s) looking for a match.</td>
</tr>
</table>

**Result**
<table>
<tr>
<td style="background-color: gray">Success: bool</td>
<td>Returns true if a match was found/created.<br>
Returns false if the operation failed.</td>
</tr>
<tr>
<td style="background-color: gray">Credentials: Object</td>
<td>The dictionary containing the MatchId and the AccessCode of the match.</td>
</tr>
</table>

<br>

### **CheckPlayerTeam**
This function can be used to retrieve a player's team, if they are in one.

**Parameters**
<table>
<tr>
<td style="background-color: gray">player: Player</td>
<td>The player to retrieve the team of.</td>
</tr>
</table>

**Result**
<table>
<tr>
<td style="background-color: gray">Success: bool</td>
<td>Returns true if the player's team was found.<br>
Returns false if the operation failed or the player is not in a team.</td>
</tr>
<tr>
<td style="background-color: gray">Team: String</td>
<td>The retrieved team.</td>
</tr>
</table>

<br>

### **CreateMatchAsync**
This function creates and publishes a new match instance returning the credentials of the new match. The function also supports an optional players parameter to automatically add players to the match before publishing.

**Parameters**
<table>
<tr>
<td style="background-color: gray">players: Object (optional)</td>
<td>The array of the player(s) to be added to the match.</td>
</tr>
</table>

**Result**
<table>
<tr>
<td style="background-color: gray">Credentials: Object</td>
<td>The dictionary containing the MatchId and the AccessCode of the new match.</td>
</tr>
</table>


## **Core methods**
### **AddAsync**
This function compiles a server instance from the passed credentials and adds it to the queue returning the added server instance and the number of players in the match.

**Parameters**
<table>
<tr>
<td style="background-color: gray">credentials: Tuple</td>
<td>The dictionary containing the MatchId and the AccessCode of the match.</td>
</tr>
</table>

**Result**
<table>
<tr>
<td style="background-color: gray">success: bool</td>
<td>Returns true the operation was successful.<br>
Returns false if the operation failed.</td>
</tr>
<tr>
<td style="background-color: gray">newServer: Object</td>
<td>The server instance added to the queue.</td>
</tr>
<tr>
<td style="background-color: gray">numberOfPlayers: Object</td>
<td>The number of players in the match.</td>
</tr>
</table>

<br>

### **ReadAsync**
This function accepts a MatchId and returns the server instance in the queue, if there is one.

**Parameters**
<table>
<tr>
<td style="background-color: gray">matchId: String</td>
<td>The indentifier string of the server.</td>
</tr>
</table>

**Result**
<table>
<tr>
<td style="background-color: gray">server: Object</td>
<td>The server instance associated to the giver MatchId.</td>
</tr>
<tr>
<td style="background-color: gray">numberOfPlayers: Number</td>
<td>The number of players in the match.</td>
</tr>
</table>

<br>

### **RemoveAsync**
This function accepts a MatchId and a callback function and returns the updates server instance and the player count.

**Parameters**
<table>
<tr>
<td style="background-color: gray">matchId: String</td>
<td>The indentifier string of the server.</td>
</tr>
</table>

**Result**
<table>
<tr>
<td style="background-color: gray">success: bool</td>
<td>Returns true the operation was successful.<br>
Returns false if the operation failed.</td>
</tr>
</table>

<br>

### **GetRangeAsync**
This function can be used to get a number of server instances from the queue. The amount returned is currently fixed to `10`. An optional players parameter can be passed to make the function ignore matches that don't have enough space for the players.

**Parameters**
<table>
<tr>
<td style="background-color: gray">players: Object (optional)</td>
<td>The array of the player(s) to be added to the match.</td>
</tr>
</table>

**Result**
<table>
<tr>
<td style="background-color: gray">success: bool</td>
<td>Returns true the operation was successful.<br>
Returns false if the operation failed.</td>
</tr>
<tr>
<td style="background-color: gray">servers: Tuple</td>
<td>The array of the matches found by the function.</td>
</tr>
</table>
22 changes: 22 additions & 0 deletions docs/ProjectLicense.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# **License**
MIT License

Copyright (c) 2024 Dyamond

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
28 changes: 28 additions & 0 deletions docs/QueueOptions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# **QueueOptions**

The QueueOptions class is returned by the newOptions method and it contains all the parameters needed to customize a queue.

!!! tip
The server size should be bigger than the maximum amount of players you are planning to have in a single match to allow possible spectators and moderators to join the match.

## **Properties**
**MatchPlaceId** : number <br>
The PlaceId where the players will be teleported to.
***
**NumberOfTeams** : number <br>
The number of teams in the match.
***
**MaxPlayersPerTeam** : number <br>
The maximum number of players in a team.
***
**MatchExpirationTime** : number <br>
`Optional` <br>
The time in seconds the match will be available in the queue before being automatically deleted by ROBLOX's servers.

Default value: 600 (5 minutes)
***
**UseCustomTeleporting** : number <br>
`Optional` <br>
This setting can be used to chose if the module should use the bult-in teleport function or let you handle teleporting and skip the built-in function entirely.

Default value: true
14 changes: 14 additions & 0 deletions docs/Roadmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# **Updates Roadmap**

## Upcoming updates
* A better function to handle arriving players in the match server.
* An option to not save UserIds when queueing for games with teams of 1 player each.
* A fix to make AddAsync and CreateMatchAsync more consistent with their expected behavior.
* Make rquests scale with the amount of players passed in QueuePlayers.
* Add a way to support ranks and map selection.

## Delivered updates
### v0.2.0-beta `29 Feb 2024`
- Added an option to disable the built in teleport function.
- Implemented SortKeys.
- Added checks to not make CreateMatchAsync and TeleportPlayers functions error in studio.
52 changes: 52 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# **Introduction**

SimpleMatchmaking is a module built with ease of use and customizability in mind using ROBLOX's [MemoryStoreService](https://create.roblox.com/docs/it-it/reference/engine/classes/MemoryStoreService).
It works by publishing match instances to a SortedMap for easy and fast editing.
The module makes use of the behavior of the native UpdateAsync function to allow all servers to access the SortedMap instead of having one central server handle all the work.

!!! warning "Warning"
SimpleMatchmaking has not been tested in a production environment. If you encounter any issue please let me know.

## **Methods**
### **GetQueue**
This function returns a [MatchmakingQueue](MatchmakingQueue.md) class with the provided name and options.<br>
Subsequent calls with the same name and options will return the same Queue.

!!! warning "Warning"
Calling GetAsync multiple times with the same name but different options will cause issues such as having matches with different number of teams in the same queue.

**Parameters**
<table>
<tr>
<td style="background-color: gray">name: String</td>
<td>The name of the queue.</td>
</tr>
<tr>
<td style="background-color: gray">options</td>
<td>The options needed to set the parameters of the queue and its behavior.</td>
</tr>
</table>

**Result**
<table>
<tr>
<td style="background-color: gray">MatchmakingQueue</td>
<td>The class that exposes access to the different functions useful to manage the data.</td>
</tr>
</table>

<br>

### **NewOptions**
This function creates and returns a new [QueueOptions](QueueOptions.md) class.

**Parameters** <br>
no parameters needed.

**Result**
<table>
<tr>
<td style="background-color: gray">QueueOptions</td>
<td>The class used to set all the different options to customize a queue.</td>
</tr>
</table>
61 changes: 61 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
site_name: SimpleMatchmaking Documentation
nav:
- Introduction: 'index.md'
- Objects:
- MatchmakingQueue: 'MatchmakingQueue.md'
- QueueOptions: 'QueueOptions.md'
- About:
- 'Updates Roadmap': 'Roadmap.md'
- License: 'ProjectLicense.md'
theme:
name: material
features:
- navigation.top
- navigation.expand
- navigation.footer
- search.suggest
- search.highlight
- content.tabs.link
- content.code.annotation
- content.code.copy
language: en
palette:
- scheme: default
toggle:
icon: material/toggle-switch-off-outline
name: Switch to dark mode
primary: teal
accent: purple
- scheme: slate
toggle:
icon: material/toggle-switch
name: Switch to light mode
primary: teal
accent: lime

markdown_extensions:
- toc:
title: On this page
- md_in_html
- tables
- admonition
- pymdownx.highlight:
anchor_linenums: true
- pymdownx.arithmatex:
generic: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.details
- pymdownx.superfences
- pymdownx.mark
- attr_list
- footnotes

extra:
social:
- icon: octicons/bug-16
link: https://github.com/EkoDy/SimpleMatchmaking/issues
name: Report bugs
- icon: octicons/checklist-16
link: https://devforum.roblox.com/t/2850365
name: DevForum post

0 comments on commit 67f236a

Please sign in to comment.