fix: clarity & polish pass

This commit is contained in:
Brett Chalupa 2022-12-12 17:36:43 -05:00
parent 3d8ec86e86
commit 01809ed30a
13 changed files with 72 additions and 68 deletions

View file

@ -2,7 +2,7 @@
We've _almost_ got a game. But we need some way for the game to end. A lot of game loops end with the player's character dying, where they respawn or start over again. Other game loops end when the player reaches the end of a level.
For our simple game, let's add a 30 second timer that counts down. The objective of our game will be to see how many targets can the player hit in that time window. Let's call our game **Target Practice**. Every dragon needs some practice before they head out into battle, right?
For our simple game, let's add a 30 second timer that counts down. The objective of our game will be to see how many targets the player can hit in that time window. Let's call our game **Target Practice**. Every dragon needs some practice before they head out into battle, right?
Adding a timer to our game introduces a few new concepts we'll build out in this chapter:
@ -81,7 +81,6 @@ Because so much has changed and shifted around, I'll just walk through the main
- `#handle_player_movement` does just what it describes. That code has a lot of checks but we haven't changed much, so let's put it in a method to get it out of the way.
- `#game_over_tick` is our own special method for when it's game over that gets called from our main `#tick`. It makes it easier to refer to and change what happens when our game is over.
I hear you over there screaming, "You expect me to rewrite the entire game line-by-line?!?! I quit!" It's okay to copy and paste what's provided above into your game. If you've made some adjustments, make them again. This refactored code is going to be the foundation for the rest of the book.
## What's Next

View file

@ -1,15 +1,15 @@
# High-Score
Saving and loading game data is a key piece of functionality when it comes to making games. We may want to keep track of all sorts of important data across play sessions. For _Target Practice_, let's keep it simple and keep track of the high-score each time a new one is set.
Saving and loading data is a key piece of functionality when it comes to making games. We may want to keep track of all sorts of important data across play sessions. For _Target Practice_, let's keep it simple and track the high-score each time a new one is set.
## Load & Save Data
When the game is over, let's display whether or not a new high-score was achieved. If it is higher than the previous, we'll save that new high-score. Otherwise, we'll display the high-score and encourage the player to try to beat it.
This will require two parts to working with save data:
This will require two parts:
- Saving the score when a new high-score is achieved
- Loading the previous high-score to compare the player's score to
1. Saving the score when a new high-score is achieved
2. Loading the previous high-score to compare the player's score to
DragonRuby GTK gives us two handy methods to do so:
@ -40,7 +40,7 @@ When we're constructing our `labels` to render, we add a condition that checks i
## Summary
We load and save data relating to how our player has done. While saving one value is likely to be a bit too trivial for most games, the core concepts are pretty similar. You'll write your data to a file, you read that file, and then you do whatever you need to with it.
We load and save data relating to how our player has done. While saving one value is likely to be a bit too trivial for most games, the core concepts are pretty similar. You'll write your data to a file, read that file, and then do whatever you need to with it.
## Extra Credit
@ -49,4 +49,4 @@ We load and save data relating to how our player has done. While saving one valu
## What's Next
Let's add some music and sound effects to our game. Even just a simple track with a couple sound effects will make a _significant_ difference.
Let's add some music and sound effects to our game. Even just a simple music track with a few sound effects will make a _significant_ difference.

View file

@ -17,7 +17,7 @@ Download the following files and put them in the `mygame/sounds/` folder:
- [game-over.wav](./code/chapter_08/01_sound/sounds/game-over.wav)
- [flight.ogg](./code/chapter_08/01_sound/sounds/flight.ogg)
A note on audio file formats: in DragonRuby, sound effects are generally WAV (`.wav`) files. WAV files are uncompressed, meaning they can be quite large in size, but are high-quality. Because sound effects are so short, the file size is less of a concern. Music files are OGG (`.ogg`), an open-source format for audio that works across all of the platforms you game can run on. OGG files are compressed, thus smaller in size than WAV files, making them good for music tracks.
A note on audio file formats: in DragonRuby, sound effects are generally WAV (`.wav`) files. WAV files are uncompressed, meaning they can be quite large in size, but are high-quality. Because sound effects are so short, the file size is less of a concern. Music files are OGG (`.ogg`), an open-source format for audio that works across all of the platforms your game can run on. OGG files are compressed, thus smaller in size than WAV files, making them good for music tracks.
## Playing Sounds in DragonRuby Game Toolkit
@ -43,7 +43,7 @@ That says when we're on the first tick, play the `flight.ogg` music track on rep
Let's add the sound effects and music track to the game.
Let's kick things off by starting the music track on the first tick at the top of `#tick`:
We'll kick things off by starting the music track on the first tick at the top of `#tick`:
``` ruby
{{#include code/chapter_08/01_sound/app/main.rb:102:105}}
@ -76,7 +76,7 @@ Now we've got music and sound effects in our game. Isn't it wild how the game fe
I use [jsfxr](https://sfxr.me/) to create sound effects for games. It's simple and free with a lot of settings to tweak. You can quickly download a WAV file that you can drop into your game. Try making your own sound effects and replacing the ones I've provided. You often won't know if a sound effect sounds _right_ until you drop it in your game. So experiment and see what works best.
As for making your own music, there are lots of options out there. I use [1BitDragon](https://1bitdragon.com/), a limited (in a good way) tool for making music. [LMMS](https://lmms.io/) is a free, well-loved tool. Garageband on MacOS would get you pretty far too!
As for making your own music, there are lots of options out there. I use [1BitDragon](https://1bitdragon.com/), a limited (in a good way) tool for making music. [LMMS](https://lmms.io/) is a free, well-loved tool. Garageband on MacOS will get you pretty far too!
There are many ways to convert the sounds you make to various formats, from command-line tools like ffmpeg to desktop apps. [Convertio](https://convertio.co/) is a free online service, among many, that you can use as well.
@ -86,10 +86,10 @@ If you do change the sounds in your game, you'll need to restart it to get Drago
## Extra Credit
- Replace the provided sound effects with ones you made
- Make your own music and drop it in
- Replace the provided sound effects with ones you make.
- Make your own music and drop it in.
- It can be a little bit annoying to hear the music over and over while you're making your game, so how would you make it so you can mute the music while working on it? [This resource can help you out.](https://www.dragonriders.community/recipes/music)
## What's Next
In the next chapter we'll continue to polish our game to prepare it for release by making the background blue and displaying clouds that float by.
In the next chapter we'll learn about drawing shapes with DragonRuby GTK.

View file

@ -4,9 +4,9 @@ We're eight chapters in and haven't even touched upon a simple and useful piece
## Blue Sky
Up until now, our dragon has been flying around in a gray sky. Let's make the sky blue to start.
Up until now, our dragon has been flying around in a gray sky. Let's make the sky blue by drawing a rectangle behind our sprites and text.
DragonRuby provides `args.outputs.solids` to easy display filled rectangles.
DragonRuby provides `args.outputs.solids` to easily display filled rectangles.
At the top of `#tick`, below where we start the music, create a solid rectangle that's the size of the screen and placed at 0, 0:
@ -14,7 +14,7 @@ At the top of `#tick`, below where we start the music, create a solid rectangle
{{#include code/chapter_09/01_blue_sky/app/main.rb:102:115}}
```
We're familiar with a lot of the shape hash keys for the position and size, but `r`, `g`, and `b` are new. They specify the values for the red, green, and blue color values for the rectangle we're drawing. Their values can be set to anything between 0 and 255, inclusive. Adjust the values to see a different color displayed. The higher the value for a given color, the more it'll be part of the mix. So our color has a blue of 230, meaning blue comes through more than the others. You can also specify `a`, the alpha value, between 0 and 100, inclusive, to get transparency in our shape.
We're familiar with a lot of the shape hash keys for the position and size, but `r`, `g`, and `b` are new. They specify the values for the (r)ed, (g)reen, and (b)lue color values for the rectangle we're drawing. Their values can be set to anything between 0 and 255, inclusive. Adjust the values to see a different color displayed. The higher the value for a given color, the more it'll be part of the mix. So our color has a blue of 230, meaning blue comes through more than the others. You can also specify `a`, the alpha value, between 0 and 100, inclusive, to get transparency in our color.
Now we've got our dragon flying over a blue sky. That looks quite a bit better.
@ -28,4 +28,4 @@ Now we've got our dragon flying over a blue sky. That looks quite a bit better.
## What's Next
We've got one more piece of polish to implement—animation! Let's make our dragon flap their wings because they're flying in the sky.
We've got one more major piece of polish to implement—animation! Let's make our dragon flap their wings because they're flying in the sky.

View file

@ -1,14 +1,12 @@
# Animation
While the polish we've implemented in our game is making it feel a lot better to play, it feels a bit lifeless. There's a key piece missing that we haven't covered yet. It's animation! Whether it's Sonic tapping his foot when he hasn't moved in a while or his feet moving as he runs, animating our sprites gives our game personality. It makes the game feel alive.
While the polish we've implemented in our game is making it feel a lot better to play, it's still a bit lifeless. There's a key piece missing that we haven't covered yet. It's animation! Whether it's Sonic tapping his foot when he hasn't moved in a while or his feet moving as he runs, animating our sprites gives our game personality. It makes the game feel alive.
Have you ever made a flip animation in the bottom corner of a notebook? You draw each frame and then flip through the pages quickly to see it animate. That concept of drawing the frames and each frame subtly changing what's drawn to convey motion is core to 2D animation, whether it's a game, an animated GIF, or a classic Disney film.
In this chapter we'll make our dragon flap its wings because it's flying through the air.
Have you ever made a flip animation in the bottom corner of a notebook? You make a different drawing on each page corner and then flip through the pages quickly to see it move. That concept of drawing the frames and each frame subtly changing what's drawn to convey motion is core to 2D animation, whether it's a game, an animated GIF, or a classic Disney film.
## Animating Our Dragon
In `mygame/sprites/misc/` there are more dragon images than just `dragon-0.png`. There are 5 additional frames of the dragon flapping their wings. Perfect! That's just what we need.
In the `mygame/sprites/misc/` folder, there are more dragon images than just `dragon-0.png`. There are 5 additional frames of the dragon flapping their wings. Perfect! That's just what we need.
The core of how this will work is that each dragon frame will be displayed for some period of time and then we'll switch to the next frame after that time has passed.
@ -19,11 +17,9 @@ The core of how this will work is that each dragon frame will be displayed for s
Where we lazily set `args.state.player`, we no longer specify the `path` to the sprite. We'll set that as part of animating the player right below.
`#frame_index` is a method DragonRuby GTK gives us on integers to keep track of what frame to use when animating. `0` is when we want to start the animation, which we want to start at the beginning. We have 6 frames total, and we want to display each of them for 8 ticks, repeating forever! Change the `hold_for` value and see how it affects the animation speed and feel of the game. Pick a rate that feels good for you or just stick with 8.
`#frame_index` is a method DragonRuby GTK gives us on integers to keep track of what frame to use when animating. `0` is when we want to start the animation, which we want to start at the beginning of our game. We have 6 frames in our animation, and we want to display each of them for 8 ticks, repeating forever! Change the `hold_for` value and see how it affects the animation speed and feel of the game. Pick a rate that feels good for you or just stick with 8.
Then we take the `player_sprite_index` and use that when specifying the `path` of our player sprite by interpolating it into the path to our sprite. Our dragon sprites are named `dragon-0.png`, `dragon-1.png`, and so on. So we take what `#frame_index` gives us and inject it into the path to the image to make that value dynamic.
In Ruby, when you have a string that uses double quotes, `"hi there"`, you can inject Ruby code inside of it using `#{}`. This is really useful and is known as string interpolation. For example: `"2 + 2 = #{2 + 2}"`, that evaluates the mathematical expression and converts the answer (`4`) to a string and returns `"2 + 2 = 4"`.
Then we take the `player_sprite_index` and use that when specifying the `path` of our player sprite by interpolating it into the path to our sprite. Our dragon frames are named `dragon-0.png`, `dragon-1.png`, and so on. So we take what `#frame_index` gives us and inject it into the path to the image to make that value dynamic. Remember string interpolation from Chapter 1? It comes into play all the time when coding.
## A Note on Spritesheets
@ -41,4 +37,4 @@ When making a game, it's likely that anything that moves will animate, even if i
## What's Next
We're nearly finished with our game! All that's left is to add a title screen and then publish the game online.
We're nearly finished with our game! All that's left is to add a title screen and then publish the game online so others can play it.

View file

@ -1,13 +1,13 @@
# Scenes
When making a game, there are all sorts of scenes that exist, from the main menu to the actual gameplay to the pause menu. Often these scenes have different interactions than the main game. Instead of moving your character around the world you instead move a cursor up and down menu options. In this chapter we'll refactor our main gameplay and game over state to be a bit easier to manage and then introduce a title scene that's used to start the game.
When making a game, there are all sorts of scenes that exist, from the main menu to the actual gameplay to the pause menu. Often these scenes have different interactions than the main game. Instead of moving your character around the world you instead move a cursor up and down menu options. In this chapter we'll refactor our main gameplay and game over state to be a bit easier to work with and then introduce a title scene that's used to start the game.
The concept of a "scene" isn't specific to DragonRuby Game Toolkit or any given game engine. It's just a generic concept that we're introducing to make our game code easier to work with. In GameMaker they're called "rooms" and in HaxeFlixel they're called "states." For our purposes, we'll move forward with scenes because they don't conflict with other terms in DragonRuby GTK, and much like a movie scene, it's clear when one ends and when one begins.
The concept of a "scene" isn't specific to DragonRuby Game Toolkit or any given game engine. It's just a generic concept that we're introducing to make our game code easier to work with. Much like a movie scene, it's clear when one ends and when one begins.
When we introduced the game over functionality, we actually introduced a scene separate from gameplay. Kinda neat! But it wasn't the time to think about them in terms of scenes and reckon with how we add more.
## Refactor
When we introduced the game over scene, we actually introduced our second scene. Kinda neat! But it wasn't the time to think about them in terms of scenes and reckon with how we add more.
So we've got two scenes right now: gameplay (where we shoot at targets) and game over (where we display the score and allow the player to restart). Let's refactor the code to put our scenes in different methods and allow the game to switch between them given certain conditions being met.
Containing our scenes in methods will make it much easier to change one scene without impacting the others. It sets clear boundaries and will make our code easier to maintain.
@ -42,13 +42,13 @@ Then, finally, `#tick` has been drastically simplified. It no longer needs to be
2. Lazily initializing the scene to start with (in our case, `"gameplay"`)
3. Calling the proper scene tick method and passing in `args`
The third item there is the new part of this chapter. `#send` is a method in Ruby that allows a method to be called by passing in the name of the method as a parameter. This is really powerful! We use string interpolation to take the value set in `args.state.scene` and append it with `_tick`. Our game then calls that method and passes in `args` as the first parameter to the called method. So if `args.state.scene` is set to `"gameplay"`, the `#gameplay_tick` method gets called. If it's set to `"game_over"`, then `#game_over_tick` gets called. If it's set to `"credits"`, then `#credits_tick` would get called.
The third item there is the new part of this chapter. `#send` is a method in Ruby that allows a method to be called by passing in the name of the method as the first parameter. This is really powerful! We use string interpolation to take the value set in `args.state.scene` and append it with `_tick`. Our game then calls that method and passes in `args` as the first parameter to the called method. So if `args.state.scene` is set to `"gameplay"`, the `#gameplay_tick` method gets called. If it's set to `"game_over"`, then `#game_over_tick` gets called. If it's set to `"credits"`, then `#credits_tick` would get called.
The various scene tick methods _need_ to exist in order for changing `args.state.scene` to work. But that's quite simple to do, we just introduce a new method and set `args.state.scene` to change between scenes.
## Title Scene
When player's launch our game, they get dropped right into the gameplay. This can be a bit jarring, so let's introduce a new scene that displays the title of the game, controls, and let's them press a button to start.
When players launch our game, they get dropped right into the gameplay. This can be a bit jarring, so let's introduce a new scene that displays the title of the game, controls, and lets them press a button to start.
In our game code, let's introduce `#title_tick` that takes `args` as its only parameter, just like our other `*_tick` methods for our scenes. In `#title_tick`, we'll render some labels and look for input to start our game. If the fireball input is pressed, we'll play a sound effect, change the scene, and return early so we can move on to the next scene.
@ -72,11 +72,11 @@ When you press the fire button, the game will start. And when you restart after
## Extra Credit
- Display a label with the current high score in the title scene so players know what to aim for
- Display the dragon sprite in the title scene to give a player a taste of what they can expect
- Display a label with the current high score in the title scene so players know what to aim for.
- Display the dragon sprite in the title scene to give a player a taste of what they can expect.
- How could you make it so that the music doesn't start until gameplay starts? Or play different music during the title scene?
- Restarting the game back on the title scene may not be ideal. How would you change it so that restarting the game automatically goes to the `gameplay` scene?
- Allow players to pause the game while in the middle of the gameplay scene
- Allow players to pause the game while in the middle of the gameplay scene.
## Summary
@ -84,4 +84,4 @@ We've now got three scenes in our game and can easily switch between them. The c
## What's Next
For all intents and purposes our game is done! You can start it, play it, replay it, and we've got a title scene. All that's left to do is release it so that the world (or at the very least our friends) can play it.
For all intents and purposes our game is done! You can start it, play it, and replay it. All that's left to do is release it so that the world (or at the very least our friends) can play it.

View file

@ -2,15 +2,15 @@
So far you've been playing the debug development build of your game within the DragonRuby GTK engine. In order to get it to friends, we'll need to build versions for other players to use. We'll use the `dragonruby-publish` tool that comes with the engine to do so.
Releasing your game is a process that has only gotten easier and easier over time. One of the coolest things about DragonRuby GTK is that you can build your game for the web, Linux, Windows, and MacOS with one command. No matter what device (within reason) your friends have, your game will work on their computer.
Releasing your game is a process that has only gotten easier and easier over time. One of the coolest things about DragonRuby GTK is that you can build your game for the web, Linux, Windows, and MacOS with one command.
We'll release _Target Practice_ on [itch.io](https://itch.io/), an open marketplace for distributing your game. You can share your games for free on itch or sell them. The html version will even be able to be played in the browser. So go ahead and sign up for an itch account.
We'll release _Target Practice_ on [itch.io](https://itch.io/), an open marketplace for distributing your game. You can share your games for free on Itch or sell them. The html version will even be able to be played in the browser. So go ahead and sign up for an Itch account.
## Prep for Release
While the code of our game is done ([view the finished source](https://github.com/DragonRidersUnite/book/tree/main/src/code/chapter_12/01_release)), we need to specify some info about the game, like its title and our information.
First, delete `mygame/high-score.txt`. We don't want our high-score from building the game to get released with the game we build to share. You'll need to make sure you do this every time before building your game. How could you turn the build and publishing process into a script that automatically does this for you?
First, delete `mygame/high-score.txt`. We don't want our high-score from building the game to get released with the game version we share publicly. You'll need to make sure you do this every time before building your game. How could you turn the build and publishing process into a script that automatically does this for you?
In `mygame/metadata/` you find a file called `game_metadata.txt`. Open that up and specify the following values:
@ -26,15 +26,15 @@ How you version your game is up to you, but I generally think about it like this
- While your game is actively being developed and isn't done, increase the minor number to the right of the `.` with each release, so `0.1`, `0.2`, and so on. Minor versions can go as high as you want, `0.24` or however many releases you have.
- When your game is done, increase the major version on the left of the `.` to 1, so it'd be version `1.0`. When you increase the major version of a piece of software, you reset the minor version back to 0.
- As you fix bugs and expand upon it after initial release, increase the number to the right, so `1.1`, `1.2`, and so on.
- If you ever majorly overhauled your game—rewrote a lot of the code or the systems, you might want to consider bumping the major version to `2.0`.
- If you ever majorly overhaul your game, you might want to consider bumping the major version to `2.0`.
If your eyes are glazing over at this versioning stuff, don't sweat it. It's something may be more useful to you in time, but it may also not be useful to you at all.
If your eyes are glazing over at this versioning stuff, don't sweat it. It's something that may be more useful to you in time.
You'll also see that there's a `mygame/metadata/icon.png` file. The default DragonRuby logo is fine, but if you ever wanted a custom icon, you could swap that out with your own image. That's what'll be displayed as the application icon when people run your game.
You'll also see that there's a `mygame/metadata/icon.png` file. The default DragonRuby logo is fine, but if you ever want a custom icon for your game, just change that file to be your own image. That's what'll be displayed as the application icon when people run your game.
## Publish Your Game
DragonRuby GTK makes it really easy to build your game for the web and the major operating systems and publish it right on itch.
DragonRuby GTK makes it really easy to build your game for the web and the major operating systems and publish it right on Itch.
Open a new terminal. If you're using Visual Studio Code, there's an option to do so right within it. Don't be frightened by the terminal, we'll just be running a simple command to build our game for all of our platforms.
@ -44,28 +44,30 @@ Open a new terminal. If you're using Visual Studio Code, there's an option to do
That command will build your game for all platforms DragonRuby GTK can target. Check out the `builds/` folder. You'll see all sorts of files that are your game builds.
Depending on what operating system your computer is using, you can even launch and play the release version of your game. On Linux, open `targetpractice-linux-amd64.bin`. On MacOS, open `targetpractice-mac-0.1/Target Practice.app`. On Windows, launch `targetpractice-windows-amd64.exe`.
Depending on what operating system your computer is using, you can even launch and play the release version of your game. On Linux, open `target-practice-linux-amd64.bin`. On MacOS, open `target-practice-mac-0.1/Target Practice.app`. On Windows, launch `target-practice-windows-amd64.exe`.
## Upload to itch
## Upload to Itch
Go to your [itch Dashboard](https://itch.io/dashboard) and tap the "Create new project" button.
Go to your [Itch Dashboard](https://itch.io/dashboard) and tap the "Create new project" button.
Fill out the details for your game. Be sure to write a description, add screenshots, and more. If you want your game to be played in the browser, set the type to HTML. But the most important part is that you upload your game.
<img alt="itch upload screenshot with button to upload files" src="./img/c12-itch-upload.jpg" style="max-width: 380px; width: 100%;" />
<img alt="Itch upload screenshot with button to upload files" src="./img/c12-itch-upload.jpg" style="max-width: 380px; width: 100%;" />
Tap "Upload files" and select the zips of the game for all of the platforms you want to upload it for. For `targetpractice-html5.zip`, check the "This file will be played in the browser" box, as itch will use that to determine what to make playable. For the other platforms, choose the proper OS for each file. Be sure to set the web embed size to 1280 pixels wide and 720 pixels tall so it renders at the proper size.
Tap "Upload files" and select the zips of the game for all of the platforms you want to upload it for. For `target-practice-html5.zip`, check the "This file will be played in the browser" box, as Itch will use that to determine what to make playable. For the other platforms, choose the proper OS for each file. Be sure to set the web embed size to 1280 pixels wide and 720 pixels tall so it renders at the proper size.
If you make changes to your game, you can upload new versions to itch automatically by running `./dragonruby-publish mygame` without having to upload them through the web browser.
If you make changes to your game, you can upload new versions to Itch automatically by running `./dragonruby-publish mygame` without having to upload them through the web browser as long as `gameid` in `game_metadata.txt` matches your Itch project slug.
Save your game on Itch and then view it. You'll see it download and run your game by displaying the splash screen:
![Target Practice splash screen](./img/c12-itch-web.jpg)
Your game isn't published yet, and that's a good thing. Only you can see it for now. If you want to share an early build with a friend, you can get a secret URL to send. Or go back to editing your game and set the **Visibility & access** to be public to launch it.
Your game isn't published _yet_. Only you can see it for now. If you want to share an early build with a friend, you can get a secret URL to send from the top navigation bar on Itch when viewing your game. Or go back to editing your game and set the **Visibility & access** to be public to launch it.
When you're happy with your game and ready for the world to play it, make it public!
## You Shipped a Game!
Can you believe it? That's awesome! You've got a game you can share with your friends and keep making more awesome.
Can you believe it? That's awesome! You've got a game you can share with your friends.
Congratulations, and nice work on sticking through the book.

View file

@ -10,25 +10,29 @@ When youre just starting out in any creative endeavor, set your sights on sma
## What Can You Cut?
When you have an idea for a game, ask yourself what you can cut from it while still maintaining the core essence of it. Dont dwell on adding a bunch of complex systems. Focus on the fun and how you can subtract to bring that forward. Arcade games do a great job of making short, repayable, minimal experiences.
When you have an idea for a game, ask yourself what you can cut from it while still maintaining the core essence of it. Dont dwell on adding a bunch of complex systems. Focus on the fun and how you can subtract to bring the fun forward. Arcade games do a great job of making short, repayable, minimal experiences.
## Finish Your Games
When making your small games, finish them! Finishing what you start is so important. Having a bunch of unreleased prototypes isnt fun for anyone. Its okay to share works in progress and tiny games. Finish what you make and release it. Shipping games is a muscle and different skill set than building the game. The more practice you get, the better off youll be when it comes time to ship.
When making your small games, finish them! Finishing what you start is so important. Having a bunch of unreleased prototypes isnt fun for anyone. Its okay to share works in progress and tiny games. Finish what you make and release it. Shipping games is a muscle and different skillset than building the game. The more practice you get, the better you'll be at finishing your games.
## Release Them for Free
Release your games for free for a while. Dont put the pressure on yourself of making a commercial project when youre just starting out. Your goal should be to build an audience of fans who enjoy your game. Make that barrier as low as possible by releasing your game for the web and the major operating systems. And release them for free. Would you rather make and release a free game 1000 people play or a paid game that only 5 people play? Its defeating to release a paid game no one buys. Also, your first games wont be very good. Thats okay! No one who starts playing the guitar is very good right at the beginning. The only way to get better is to suck at first and keep working at it. Getting your games in peoples hands and getting feedback is much more important than trying to make money. Once youve shipped a bunch of small games, youll have gained new skills and confidence. Youll also be grounded in reality and not be fantasizing about selling millions of copies of your idea. Make and release small, humble games.
Release your games for free for a while. Dont put the pressure on yourself of making a commercial project when youre just starting out. Your goal should be to build an audience of fans who enjoy your games. Make that barrier as low as possible by releasing your game for the web and the major operating systems. And release them for free.
Would you rather make and release a free game 1000 people play or a paid game that only 5 people play? Its defeating to release a paid game no one buys.
Also, your first games wont be very good. Thats okay! No one who starts playing the guitar is very good right at the beginning. The only way to get better is to suck at first and keep working at it. Getting your games in peoples hands and getting feedback is much more important than trying to make money. Once youve shipped a bunch of small games, youll have gained new skills and confidence. Youll also be grounded in reality and not fantasizing about selling millions of copies of your idea. Make and release small, humble games for free for a while.
## Don't Worry About Being Original
When youre making your small, free games, dont worry about being original. That may sound like blasphemy, but the best way to learn is to copy mechanics and systems from your favorite games to learn. Youll inevitably infuse your own sensibilities into them and make something unique. When we learn an instrument, we play covers of our favorite songs and thats encouraged. What would it be like to “cover” your favorite game? Originality will come with time when the ideas are flowing and dont agree with how other games do something.
When youre making your small, free games, dont worry about being original. That may sound like blasphemy, but the best way to learn is to copy mechanics and systems from your favorite games to learn. Youll inevitably infuse your own sensibilities into them and make something unique. When we learn an instrument, we play covers of our favorite songs and thats encouraged. What would it be like to “cover” your favorite game? Originality will come with time when the ideas are flowing and you don't agree with how other games do something. You'll naturally want to do something different!
## Do Game Jams
Game jams are constrained events where people make games within a certain time frame, sometimes with specific rules. They're a great way to start and finish a game in a short period of time. You can experiment and take risks and connect with the community of your fellow participants. I can't recommend them enough. Try to do at least one jam a year (or more if your heart desires).
[Itch has a directory of jams](https://itch.io/jams) and [Ludum Dare is a long-running jam with many participants](https://ludumdare.com/).
[Itch has a directory of jams](https://itch.io/jams) and [Ludum Dare](https://ludumdare.com/) is a well known jam that happens multiple times every year with many participants.
## Share Your Work
@ -41,10 +45,10 @@ If youre interested in making games, its likely you enjoy playing them. Wh
## Find a Community
Find a community of developers making similar caliber games. Whether its a Discord or in-person meet up group, surround yourself with people making games who have similar goals to you. Support and push each other. Play each others games and learn from one another. You may even find collaborators among the community with difference strengths that you can leverage to make an even better game.
Find a community of developers making similar caliber games. Whether its a Discord or in-person meet-up group, surround yourself with people making games who have similar goals to you. Support and push each other. Play each others games and learn from one another. You may even find collaborators among the community with different strengths that you complement to make an even better game.
## Pace Yourself
Its important to take breaks. Pace yourself! If you love games and are enjoying making them, think about what it'd be like to make games for the next 40 years of your life instead of just the next 4 months. What would you do differently to sustain yourself?
It's important to take breaks. Pace yourself! If you love games and are enjoying making them, think about what it'd be like to make games for the next 40 years of your life instead of just the next 4 months. What would you do differently to sustain yourself?
Being a game developer requires determination and passion, but it also requires a lot of self-care. ❤️

View file

@ -1,6 +1,6 @@
devid=youritchusername
devtitle=Your Name
gameid=targetpractice
gameid=target-practice
gametitle=Target Practice
version=0.1
icon=metadata/icon.png

View file

@ -7,5 +7,7 @@ What follows is a directory of useful resources for continuing your journey with
- [Community Discord](https://discord.dragonruby.org)
- [Dragon Riders Community Recipes](https://www.dragonriders.community/recipes) — solutions to common needs when building games with DragonRuby GTK
- [Awesome DragonRuby](https://www.dragonriders.community/awesome-dragonruby/) — community-curated list of resources
- [Scale](https://github.com/DragonRidersUnite/scale) — a starter game template I made
- [DragonOS](https://dragonridersunite.itch.io/dragon-os) — an interactive showcase of DragnRuby GTK demos
- [DragonRuby Newsletter](https://dragonrubydispatch.com/)
- [Justin Collins (a.k.a. presidentbeef)'s DragonRuby blog series](https://dev.to/presidentbeef/api-levels-in-dragonruby-game-toolkit-4jb4)

View file

@ -18,7 +18,7 @@ Here are some ideas for what you could do to put your personal stamp on it:
## Say Thanks
Say thanks in [the DragonRuby Discord](https://discord.dragonruby.org) or on [Mastodon](https://mastodon.gamedev.place/@brettmakesgames). It would mean so much to me know that you've read the book. The website version of this book has no tracking. My success metric isn't number of views. I'll only be able to measure the success of this book through community and connecting. Share what you've made!
Say thanks in [the DragonRuby Discord](https://discord.dragonruby.org) or on [Mastodon](https://mastodon.gamedev.place/@brettmakesgames). It would mean so much to me know that you've read the book. The website version of this book has no analytics tracking. My success metric isn't the number of views this book goods. I'll only be able to measure the success of this book through community and connecting. Share what you've made!
If you really want to say thanks, [buy me a coffee](https://www.buymeacoffee.com/brettchalupa) by sending me a small tip. Financial support means the world and helps me continue to make free resources like _Building Games with DragonRuby_.
@ -26,13 +26,13 @@ If you really want to say thanks, [buy me a coffee](https://www.buymeacoffee.com
Writing a book about making games is challenging to scope properly because games are so complex. We built a pretty simple game that covered a lot of the core concepts of making games, but there are _so_ many directions a sequel could head in.
A second edition of the book could deep dive into making a shmup with enemy waves and bosses. Or we could build an entirely different game, like a platformer or a dungeon crawler. I'd also love to write about more advanced programming topics like encapsulating behavior with classes and sharing behavior with modules. It'd be great to over adapting a game for iOS and Android too.
A second edition of the book could deep dive into making a shmup with enemy waves and bosses. Or we could build an entirely different game, like a platformer or a dungeon crawler. I'd also love to write about more advanced programming topics like encapsulating behavior with classes and sharing behavior with modules. It'd be great to go over adapting our game for iOS and Android too.
But I _need_ to be sure people want a follow up book where we build a more complex game using DragonRuby Game Toolkit. Let me know if you'd like to see a sequel in [Discord](https://discord.dragonruby.org).
## Extra Credit
You'll find bonus chapters after this outro. They're one-off deep dives into specific topics, from the mindset that's required to make games to how to back up your game's source code. Check them out and see what you can learn!
You'll find bonus chapters after this Outro. They're one-off deep dives into specific topics, from the mindset that's required to make games to how to back up your game's source code. Check them out and see what you can learn!
## Gratitude
@ -42,7 +42,8 @@ In particular, in alphabetical order, thank you to:
- Akzidenz for feedback and support
- Amir for encouraging me to write this book & making DragonRuby
- The rest of the DragonRuby core team for making such a great engine
- Levi for nitpicking
- [Nick Culbertson](https://twitter.com/MobyPixel) for the dragon sprite included with DRGTK
- Owen for corrections
- Pineapple for Discord feedback
- Pineapple for feedback

View file

@ -1,6 +1,6 @@
# Ruby Primer
New to Ruby? Here's a brief walk through of the common language features and syntax as a quick reference.
New to Ruby? Here's a brief walk through the common language features and syntax as a quick reference.
## Core Types
@ -106,7 +106,7 @@ Blocks are chunks of Ruby code that yield to the caller. At first you'll use blo
## nil
`nil` in Ruby is known as `null` in other languages. It's the absence of a value.
`nil` in Ruby is known as `null` in other languages. It's the absence of a value. nil is a huge topic and not something gone over in the book explicitly.
## Exceptions

View file

@ -4,7 +4,7 @@ When working on any piece of software, whether it's a video game or an app to tr
Imagine this scenario: you work on your game for three months. It's amazing. It's your X-Files Dating Sim. You've painstakingly drawn all of the characters, written the scenario, coded up all the interactions. Then one day your computer gets stolen by a giant crow! I don't trust those crows, I never have. Suddenly your game is gone, poof. All that hard work just sitting on a hard-drive barely being protected by the shell of your laptop from the aggressive pecks of the entire local union of crows.
You'd just have to start over, from scratch. That is if you aren't too bummed out about losing the entire game. Crow theft--it's the number one reason to back up your game's source code.
You'd just have to start over, from scratch. That is if you aren't too bummed out about losing the entire game. Crow theftit's the number one reason to back up your game's source code.
## Back Up Your Game