Gas efficient smart contract SDK for Multiplayer Game Matchmaking
This project aims to create an immutable smart contract that can be used by any game developer to create a matchmaking queue for a multi-player game. Developers can use player rankings and other settings to define how players should be matched for a game. All an onchain game developer needs to do is call "regsiterGame" with the number of players per game and the "rankingRange" (ex. 200 ELO points in chess), then enter players into the queue and MatchmakingQueue will do the rest!
This project uses Solidity smart contracts written for the EVM. The contracts can be called from game developers to enter players into a matchmaking queue. This project heavily uses Foundry's Forge tool for testing and gas estimates.
The main function of the contract is "enterPlayerIntoMatchmaking(address gameAddress, address player, uint256 playerRanking)" which "emits MatchMade(address[] players)" when a game full of players within "rankingRange" of each other are in the queue.
Right now the first version is "working" but quite gas inefficient. Instead of using an array as the data structure of the queue, I would like to use a binary search tree.