== How to Write Your Own Game == -- This game will guide you through the process of writing your own game. -- ** Matthew Scroggs ** @@ 10 @@ vv 1 vv # start You wake up. It is the weekend, so you decide to write an AVE game. After spending some time thinking, you decide to write a shopping simulator. To test your game, you need to download the latest Python version of AVE, or the VirtualBox image of it. Help me download and run the Python version or image => download Get started => go # go To start your game, you make a new file called shop.ave and write the following: == Shopping Simulator == -- In this game, you go shopping. -- ** Billy Buxton ** Write the first room => first Disable the game => disable # disable You write: <| ~~ off ~~ |> This causes the game to stop appearing in the game menu. You realise this was a mistake. Enable the game => enable # enable You delete <| ~~ off ~~ |> from your game so that it appears in the game menu again. Write the first room => first Disable the game => disable # first To make the room in which your game will start, you write: # start You are in a shop. What do you want to do? Give the player some options => next # next What options do you want to give the player? Allow the player to go to the bread aisle => bread ?! bread + bread Allow the player to pick up a basket => basket ?! basket + basket Allow the player to pick up money => money ?! money + money Write the checkout => checkout ? checkout ? money No more, I'm done => done ? money ?! checkout ? bread ? basket # done Congratulations, you have written an AVE game! You can play the shopping simulator at avegame.co.uk/play/shop.ave. Continue => __WINNER__ # basket To allow the player to pick up a basket, you write the following under the description of <|# start:|> <|Pick up a basket => start + basket ?! basket|> This line makes the game show the option "Pick up a basket". This option will only appear if the player does not have a basket (?!) and will add a basket to the inventory (+). Later in the file, you write: <|% basket|> Shopping basket These two lines set the display name of the basket to be "Shopping basket". If no display name were set, then the item would be invisible. Continue => next # bread Under the description of <|# start|>, you write: <| Go to the bread aisle => bread |> This allows the player to go to a new room, named "bread". Make the "bread" room => breadroom # breadroom To make the bread aisle, you write the following: <|# bread|> <|You are in the bread aisle.|> Let the player get some bread => breadroom2 # breadroom2 To let the player pick up bread, you write: <|Put some brown bread in your basket => bread ?! brownbread + brownbread ? basket|> <|Pick up some brown bread => bread ?! brownbread + brownbread ?! basket|> If the player has the basket, this will let the player put bread into the basket. Otherwise, the player can pick bread up. Later in the file you write: <| % brownbread |> Brown bread This gives the bread the name "Brown bread" and makes it visible. Allow the user to go somewhere else => breadroom3 # breadroom3 To allow the user to go elsewhere, you write: <|Go to the checkout => checkout ? brownbread|> <|Go back to the entrance => start|> This allows the user to go to the checkout or back to the starting room. + checkout Write the checkout room => checkout ? money Go back to the start room to add more things => next # checkout You write: ~ checkout <| # checkout |> <| You do not have enough money. ? money<2 |> <| You buy the bread. ? money>=2 |> <| Continue => __GAMEOVER__ ? money<2 |> <| Continue => __WINNER__ ? money>=2 |> This will let the player win if the player has more than (or equal to) 2 money and lose if the player has less than 2 money. The special rooms __GAMEOVER__ and __WINNER__ will make the game over or winning boxes appear on the screen. Continue => next # money To allow the player to go to the cash machine, you write the following under <|# start|>: <| Get money from the cash machine => cash |> Let the player use the cash machine => money2 # money2 To let the player take out 1 or 10 money, you write: <| # cash |> How much do you want to withdraw? <| 1 => gotcash + money+1 |> <| 10 => gotcash + money+10 |> To make money work as a number, you write: <| % money |> Money <| __NUMBER__ |> The special property <|__NUMBER__|> makes money a number, with start value 0. Let the player continue => money3 # money3 To let the player either go back inside or get more money, you write: <| # gotcash |> You have withdrawn cash. <| Go back in the shop => start |> <| Get more cash => cash |> Continue => next # download Which operating system are you using? Windows => windows Linux => unix Mac => unix # unix On Linux and Mac, you can install AVE by opening terminal and running: pip install avegame You can then play AVE by opening terminal and running: ave To test out games you have written, run: ave /path/to/folder where /path/to/folder is the location where your games are saved. Start writing a game => go # windows On Windows, you can install AVE by opening command prompt and running: py -m pip install avegame You will need to install Python before you can do this. You can then play AVE by opening terminal and running: ave To test out games you have written, run: ave /path/to/folder where /path/to/folder is the location where your games are saved. Start writing a game => go