I need to create an online game using solidity. The games have games within them with each game having their respective players. it can be likened to a battle royale on a FPS game where there are various battle royales going on simultaneously within the game with their respective participants. I tried using an array within a struct to keep record of the games. However, I have been facing error after error trying to do this.
The Struct:
struct Game {
address[] participants;
uint amountRequired;
uint Duration;
uint id;
bool ended;
uint createdTime;
}
The function to create the game:
function CreateGame(uint amountRequired, string memory timeoption) public restricted{
setGameDuration(timeoption);
gameid++;
Game memory newGame = Game({
participants: address[] participants,
amountRequired: amountRequired,
Duration: gametime,
id: gameid,
ended: false,
createdTime: block.timestamp
});
}