Examples
PlayStation programs in Go, running in the browser.
The examples are ports of Sony's Net Yaroze samples and demos and of games its members wrote, each chosen to put a different part of the machine to work, and a few programs of this repository's own. Every one runs in the browser, on its page, in the emulator this repository contains, with the keyboard, a gamepad or, on a phone, the controller drawn under the picture.
Each example is one directory under examples. Its main.go begins with a comment that is the example's page here: what it is, what it shows of the machine, where a port departs from the original and why, and its controls. Its assets/ directory holds the files it reads off the CD, each registered with the disc package so that the build places it, and go run ./cmd/nyc disc ./examples/dino builds its disc, which task build:disc NAME=dino does too.
- dinoA dinosaur walking in front of a castle, animated vertex by vertex by the GTE, to music with reverb.
- squareA box to move around the screen in front of a turning cube, to music: the program to start from, which the tutorial writes.
- aiSeven simple ways for an enemy to move: chasing and fleeing, bouncing, wandering, following a set pattern, buzzing like a fly, switching between them at random, and swooping in a wave.
- blowA model viewer that blows a space shuttle apart, with every light and fog parameter on a menu.
- breakoutBreakout in sprites, ten levels of it, with music and a high score table.
- carA textured car driving in from the distance, at sixty frames a second or thirty.
- cardA memory card, its files listed, dumped and deleted, and a number saved to it with an icon and a title, and loaded back.
- cddaCD audio: tracks of music recorded on the disc after the program, played by the drive while the program goes on, with a level meter of what the SPU is mixing.
- checkBouncing balls, with music, after the SDK's own first sample.
- chromeA chrome torus turning: environment mapping with the GTE, worked out again every frame.
- cloneA first-person maze shooter, three levels deep, in fog, with a heartbeat that quickens as the monsters close in.
- dogtaleA Dog Tale, a platform game across a desert in parallax, to free a dog chained up with five padlocks.
- dungeonA random maze of stone walls walked in the first person, built around the viewpoint every frame, in blue fog.
- flameA sheet of fire at 640 by 480: a model built in memory and recolored every frame.
- invadersSpace Invaders in sprites, ten levels of it, with music and a high score table.
- mdecFull-color video through the motion decoder, driven by its registers.
- morphA textured sheet morphing into a cylinder, a torus and a sphere, vertex by vertex, as it tumbles.
- odenThe lighting calculation: a ball, a cone and a cube under three lights you aim and color.
- offscrA sprite painted onto a sphere's texture while it runs: drawing into video memory off the screen.
- padsEvery kind of controller: what is plugged into each port, what it is sending, and a cursor any of them can move.
- sceneTwo scenes placed by scene files, cubes over a tile map and the same cubes stacked in a tower, drawn from one archive of textures and models, with a badge in the corner cut from a picture: the program the playground starts from.
- splitA split screen: two players, each with a cube to drive among stone pillars and a camera of their own following it, one above the other or side by side.
- terraTerra Incognita, a 3D action adventure on an island, reconstructed from its executable.
- tilesTile scrolling: a map of 16 by 16 cells two screens wide and two high, drawn by the library's fixed background, scrolled with the directions.
- timersTime three ways: a root counter counting the screen's lines, a clock kept by counting frames, and how much of each frame the program's work takes, with sprites to add until it takes too much.
- tunnelA ship down an endless tunnel, shooting waves of enemies under three colored lights.