You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-50Lines changed: 20 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,9 +35,7 @@ They resemble games from 8-bit and 16-bit computers, because:
35
35
36
36
## Why Pi?
37
37
38
-
Because it's probably the easiest and most fun way to write a game in Go.
39
-
No complex engine setup. No boilerplate. Just write code and see things happen.
40
-
Perfect for small projects, prototypes, jams — or simply to have fun.
38
+
Because it's probably the easiest and most fun way to write a game in Go. No complex engine setup. No boilerplate. Just write code and see things happen. Perfect for small projects, prototypes, jams — or simply to have fun.
41
39
42
40
## How to get started?
43
41
@@ -112,59 +110,44 @@ func main() {
112
110
}
113
111
````
114
112
115
-
When Pi opens a window for your game, it automatically adjusts the window size to match your monitor's resolution.
116
-
Since modern monitors have much higher resolutions (e.g. 1920×1080 or even 3840×2160), Pi needs to scale up the game screen.
117
-
Each game pixel is multiplied an integer number of times (integer scaling).
118
-
This ensures that the game screen always stays true to its original pixel-perfect look without any distortion.
113
+
When Pi opens a window for your game, it automatically adjusts the window size to match your monitor's resolution. Since modern monitors have much higher resolutions (e.g. 1920×1080 or even 3840×2160), Pi needs to scale up the game screen. Each game pixel is multiplied an integer number of times (integer scaling). This ensures that the game screen always stays true to its original pixel-perfect look without any distortion.
119
114
120
115
---
121
116
122
117
### Game screen
123
118
124
-
Pi gives you a small, low-resolution pixel canvas to draw on.
125
-
It's like an old-school screen: you can set pixels, draw lines, rectangles, sprites, and text.
126
-
The limited resolution encourages you to focus on clear shapes and designs.
119
+
Pi gives you a small, low-resolution pixel canvas to draw on. It's like an old-school screen: you can set pixels, draw lines, rectangles, sprites, and text. The limited resolution encourages you to focus on clear shapes and designs.
127
120
128
-
Each pixel on the game screen has (x, y) coordinates and a `pi.Color`.
129
-
`pi.Color` is a number from 0 to 63, letting you use up to 64 colors on screen at once.
130
-
Coordinate (0,0) is the top-left corner of the screen.
121
+
Each pixel on the game screen has (x, y) coordinates and a `pi.Color`. `pi.Color` is a number from 0 to 63, letting you use up to 64 colors on screen at once. Coordinate (0,0) is the top-left corner of the screen.
131
122
132
-
Pi does not impose any fixed screen size — you can choose resolutions like 128×128 or 320×180.
133
-
However, there's a limit on the total number of pixels: 128 KB (131,072 pixels).
134
-
It's recommended to start with a low resolution for your first game, such as 128×128.
123
+
Pi does not impose any fixed screen size — you can choose resolutions like 128×128 or 320×180. However, there's a limit on the total number of pixels: 128 KB (131,072 pixels). It's recommended to start with a low resolution for your first game, such as 128×128.
135
124
136
125
---
137
126
138
127
### Color palette
139
128
140
-
Pi uses a game-defined, configurable `pi.Palette` which maps each `pi.Color` to an RGB value.
141
-
For example, by default color 0 is black (0x000000), and color 7 is white (0xFFF1E8).
129
+
Pi uses a game-defined, configurable `pi.Palette` which maps each `pi.Color` to an RGB value. For example, by default color 0 is black (0x000000), and color 7 is white (0xFFF1E8).
142
130
143
-
You choose your game's palette, but you're limited to 64 colors.
144
-
That may seem small, but for low-resolution pixel-art it's usually plenty.
131
+
You choose your game's palette, but you're limited to 64 colors. That may seem small, but for low-resolution pixel-art it's usually plenty.
145
132
The palette can be changed during the game, but changes will appear only when rendering the frame at the end of the update cycle.
146
133
147
134
---
148
135
149
136
### Canvas, sprites, and blitting
150
137
151
-
`pi.Canvas` is a 2D structure storing color values. The game screen itself is a Canvas.
152
-
Your game can not only draw pixels on a Canvas but also read them back.
138
+
`pi.Canvas` is a 2D structure storing color values. The game screen itself is a Canvas. Your game can not only draw pixels on a Canvas but also read them back.
153
139
154
140
This makes it possible to copy pixels from one Canvas to another — for example, you can load a PNG file into a Canvas and then copy (blit) parts of it onto the game screen.
155
141
156
-
These source images (PNG files with your art) are typically called **sprite sheets**.
157
-
Pi can decode them into Canvases and help you define sprites that you then blit onto the screen.
142
+
These source images (PNG files with your art) are typically called **sprite sheets**. Pi can decode them into Canvases and help you define sprites that you then blit onto the screen.
158
143
159
144
---
160
145
161
146
### Keyboard, mouse, and gamepad input
162
147
163
-
Pi lets you check the state of buttons on various input devices.
164
-
To make sure games work across different hardware, Pi defines a subset of buttons that exist on most modern keyboards, mice, and gamepads.
148
+
Pi lets you check the state of buttons on various input devices. To make sure games work across different hardware, Pi defines a subset of buttons that exist on most modern keyboards, mice, and gamepads.
165
149
166
-
Pi also tries to offer only the kinds of input that were typical in the 16-bit era.
167
-
For example, mice had just two buttons, and gamepads had only simple digital (on/off) buttons — no analog sticks or triggers.
150
+
Pi also tries to offer only the kinds of input that were typical in the 16-bit era. For example, mice had just two buttons, and gamepads had only simple digital (on/off) buttons — no analog sticks or triggers.
168
151
169
152
For handling input devices, you can use these packages: [pikey](pikey), [pimouse](pimouse), and [pipad](pipad).
170
153
@@ -186,8 +169,7 @@ Pi intentionally limits:
186
169
* resolution
187
170
* color palette
188
171
189
-
These constraints force you to be creative and keep things simple.
190
-
It's easier to finish a game when you don't try to do everything at once.
172
+
These constraints force you to be creative and keep things simple. It's easier to finish a game when you don't try to do everything at once.
191
173
The goal is to have fun, not get lost in complexity!
192
174
193
175
## FAQ
@@ -197,9 +179,7 @@ The goal is to have fun, not get lost in complexity!
197
179
Yes — the core functionality is implemented and ready to use.
198
180
Currently, the focus is on developer tools like [piscope](piscope).
199
181
200
-
Note: Pi does not yet include built-in APIs for sound effects or music playback.
201
-
However, you can use [Ebitengine's audio API][ebitengine-audio] to play OGG or MP3 files,
202
-
or the external Go module [quasilyte/xm][quasilyte-xm] to play XM tracker files.
182
+
Note: Pi does not yet include built-in APIs for sound effects or music playback. However, you can use [Ebitengine's audio API][ebitengine-audio] to play OGG or MP3 files, or the external Go module [quasilyte/xm][quasilyte-xm] to play XM tracker files.
203
183
204
184
### What similarities does Pi have with Pico-8 on the API level?
205
185
@@ -209,24 +189,19 @@ or the external Go module [quasilyte/xm][quasilyte-xm] to play XM tracker files.
209
189
210
190
### Can I use Pi in a game that already uses Ebitengine?
211
191
212
-
Yes! You can use the [piebiten](piebiten) package to integrate Pi with your existing Ebitengine project.
213
-
For example, you can copy pixel data from `pi.Canvas` into an `ebiten.Image`.
192
+
Yes! You can use the [piebiten](piebiten) package to integrate Pi with your existing Ebitengine project. For example, you can copy pixel data from `pi.Canvas` into an `ebiten.Image`.
214
193
215
194
### What platforms do Pi games run on?
216
195
217
-
Pi runs on all platforms supported by Ebitengine.
218
-
However, it is currently tested only on Windows, Linux, and web browsers.
196
+
Pi runs on all platforms supported by Ebitengine. However, it is currently tested only on Windows, Linux, and web browsers.
219
197
220
198
### Can I write my own backend for Pi instead of Ebitengine?
221
199
222
-
Yes! You can create a specialized backend that runs on unusual devices or is optimized for a specific architecture.
223
-
For example, there's [piweb][piweb] — an experimental backend for web browsers.
224
-
Its goal is to cut the size of the generated WASM program roughly in half, which can be important for small browser-based games.
200
+
Yes! You can create a specialized backend that runs on unusual devices or is optimized for a specific architecture. For example, there's [piweb][piweb] — an experimental backend forweb browsers. Its goal is to cut the size of the generated WASM program roughlyin half, which can be important for small browser-based games.
225
201
226
202
### How can I contribute to Pi's development?
227
203
228
-
The best way to help Pi grow is by creating your own packages that add new or improved features.
229
-
Pi is designed so that anyone can extend it without needing to contribute code directly to the main Pi repository.
204
+
The best way to help Pi grow is by creating your own packages that add new or improved features. Pi is designed so that anyone can extend it without needing to contribute code directly to the main Pi repository.
230
205
Examples of useful packages include:
231
206
232
207
* developer tools that other programmers can run directly in their games
@@ -238,22 +213,17 @@ Examples of useful packages include:
238
213
239
214
First of all, you'll need a good Go editor. I recommend GoLand (paid) or Visual Studio Code.
240
215
241
-
For creating sprites, I highly recommend [Aseprite][aseprite] — probably the best pixel-art editor ever made.
242
-
It has tons of features, scripting support, and can export images with metadata.
243
-
In general, try to use the same color indices in your graphics program and in your game code.
244
-
It really simplifies game development. Aseprite is one of the tools that supports editing images with indexed colors.
216
+
For creating sprites, I highly recommend [Aseprite][aseprite] — probably the best pixel-art editor ever made. It has tons of features, scripting support, and can export images with metadata. In general, try to use the same color indices in your graphics program and in your game code. It really simplifies game development. Aseprite is one of the tools that supports editing images with indexed colors.
245
217
246
218
For creating tile maps, I recommend [Tiled][tiled].
247
219
248
220
### How can I persist game state or settings?
249
221
250
-
Pi itself doesn't include built-in save/load APIs.
251
-
To store your game's progress or settings, you can use the external Go module [quasilyte/gdata][quasilyte-gdata].
222
+
Pi itself doesn't include built-in save/load APIs. To store your game's progress or settings, you can use the external Go module [quasilyte/gdata][quasilyte-gdata].
252
223
253
224
### I have more questions or found a bug. Where can I ask?
254
225
255
-
Please open an [Issue][issues] or start a [Discussion][discussions] on GitHub.
256
-
Questions, ideas, bug reports, and contributions are all welcome!
226
+
Please open an [Issue][issues] or start a [Discussion][discussions] on GitHub. Questions, ideas, bug reports, and contributions are all welcome!
0 commit comments