# Create the Game Handling
You added the message to create a game along with its serialization and dedicated gRPC function with the help of Starport in the previous section.
Now all that remains is to add code that:
- Creates a brand new game.
- Saves it in storage.
- Returns the ID of the new game.
Starport isolated this concern into a separate file,
x/checkers/keeper/msg_server_create_game.go, for you to edit:
All the message processing code were created for you and all you are left to do is code the meat of the action. Opting for Starport is a wise decision as you can see.
Given that you have already done a lot of preparatory work: what does it involve to code the action? With what do you replace
// TODO: Handling the message?
rulesrepresent the ready-made file with the imported rules of the game:
Get the new game's ID:
Keeper.GetNextGame(opens new window) function created by the
starport scaffold single nextGame...command.
Create the object to be stored:
Notice the use of:
rules.New()(opens new window) command, which is part of the Checkers rules file you imported earlier.
- The string content of the
Confirm that the values in it are correct by checking the validity of the players' addresses:
.Blackneed to be checked because they were copied as strings. The check on
.Creatoris redundant here because at this stage the message's signatures have been verified and in particular the creator is the signer.
Keeper.SetStoredGame(opens new window) function created by the
starport scaffold map storedGame...command
Prepare the ground for the next game with:
Keeper.SetNextGame(opens new window) function created by Starport.
Return the newly created ID for reference:
# Next up
You will modify this handling in the next sections:
- To add new fields to the stored information.
- To add an event.
- To consume some gas.
- To facilitate the eventual deadline enforcement.
- To add money handling including foreign tokens.
Now that a game is created, it is time to play it. That is the subject of the next section.