Or, the things I wish I'd known instantly when I experimented with the TIC-80 fantasy computer.
Some basics
The TIC-80 can be run locally on your computer, or it can be accessed from the tic80.com website. In any case, running the TIC-80, you will be greeted with a console, which resembles an OS shell.
No worries, we won't spend much time in here.
EDIT from the console will open the editor.
CTRL+r will run the cart (anywhere).
There should be a helloworld-style project by default. If not, it's worth looking at because the program shows a few basic things in a very concise way. NEW LUA should create the cart. TIC-80 supports other scripts, but at least if working with the internal editor Lua looks like the smartest choice.
Pressing ESC exits the running cart, inside the editors ESC will return to the console/menu.
When exiting the cart, you will be greeted with a menu confirming the exit. Here it's a good idea to open options, turn "Dev mode" ON, otherwise the time-wasting menu will pop up each time you press ESC.
If you need to get to the menu and change these options, use MENU from the console.
SAVE mydemo.tic
Will save the sketch. If you are using the online version, GET mydemo.tic will download it.
Locally, the cart will be saved on a specific folder, which can be viewed by using FOLDER.
Locally, QUIT exits the TIC-80 entirely.
I've had some keymap problems with the local TIC-80 running on Linux Mint, the + key doesn't work directly and had to press alt and plus to get it out. I had trouble with using | and < characters, good luck trying to use logical bitwise operators...!
The *.tic files are entire cartridges which contain all the graphics and sound and map elements you have created using the editors.
Or, the carts might be compared to the Soundtracker-style module format except instead of music data and samples the single file contains everything.
After EDIT you get to the code editor.
Top left corner has the tabs for different editors: Code, Sprite/Block, Map, Sound Effect, Music. Note that clicking Music editor more than once swaps between two kinds of views, the piano roll and tracker.
You can swap between the editors by clicking the tabs, or use keys F1-F5. F6 seemed to switch a scanline display style effect.
Anything you do, is in a way "saved", so if you change graphic tile or a sound effect, the change will already affect the outcome without a separate save command. Using CTRL-z, these moves can be undo'd.
You need to, of course, save the entire project to preserve your work.
Tiles and Map
The Tile editor makes it possible to edit sprites and background tiles. The division between sprites and tiles isn't final, but it is a good idea to respect the distinction at least in the beginning. The default hello-world program uses tiles as sprites.
The palette can be changed but it might make sense to stick initially to the default palette.
You can pick a tile from the grid at right and start drawing on the zoomed-in box at the left. The transparent color isn't decided here, the sprite commands in the code will decide it.
SPR (1,50,50,14,1,0,0,2,2)
Would draw a sprite 1 at the coordinates 50,50, using color 14 as the transparency. The later 1 indicates 1:1 scale, the following 0,0 values decide the mirroring of the sprites and the 2,2 say the sprites is made of 2 by 2 smaller elements. (The element being 8x8, so 2x2 is 16x16 pixels)
You can choose to edit larger entities, such as 16x16, by clicking that rail-selector at top right. This does not change code-wise how your sprites are displayed, it's just an editing assist.
The sprite number is according to the 8x8 scheme, so to draw the blue sphere in the list below I'd use sprite #3 whereas the red sphere is #1.
In the Map editor, you can draw a screen using the aforementioned tiles/sprites. The tile selector can be opened from the top right, and it's possible to grab larger entities and draw with them.
The tiles can be "pipette'd" from the map using middle mouse button, which can be more effective once you have some tiles on the map. Holding SHIFT temporarily displays the selection screen, which is also nice.
The parameters are also key to scrolling. Simple tile-based scrolling could be done with e.g. MAP (mx,my) and changing the values of mx and my.
To achieve smooth scrolling, you can use e.g.
MAP(mx/8,my/8,30,17,-(%mx)/8,-(%my)/8)
The % is the modulo of the division, meaning if I divide 10 with 8, the 8 fits there one time, and the remainder (modulo) is 2. The 2 will be the pixel offset.
In the example one screen is 30*8 wide and 17*8 high.
CLS(color) usually clears the screen with a chosen color, but if MAP fills the entire screen and has no transparency, then the CLS might not be needed and is a waste of resources.
Sound FX and Music
By default, the sound FX 0 is a square wave, which can be played from the keys at the bottom of the screen. Pressing SPACE will repeat the last note you used.
The volume curve can be hand-drawn to the top right corner. From the selection of waves at bottom leaft, different waves can be chosen. These can also be redrawn in the green window, but again it might be good idea to stick with the default ones for a while.
Picking from the grid at top left, it's possible to edit different sound FX and play with them.
Using a very short white noise wave (the waves that look empty) can act as snares and hihats, when played at a suitable octave.
A wave that pitches heavily downwards (using the x16 pitch table) can help create something that vaguely resembles a tom or a bassdrum.
Switching between VOL/WAV at the volume table, the sound can access different waves in quick succession, recreating a "wave table" style approach known from SID editors such as Goattracker. This can also help create more complex percussive sounds, but this requires experimenting.
Changing the SPD/speed at top left determines how fast the FX goes through these tables.
Opening the tracker, the song can play melodies using these above sound effects/instruments. Click the position on the "piano roll" on the right, choose an octave, and your note should play.
On the right side you can check various commands that can be assigned to a note, for example using the chord and inserting values 3 and 7 will play the note as a sort of major chord by alternating the notes very quickly. Pitch, vibrato, etc are available.
At the left side, there is the song order list, which shows that track 0 will be played at song position 0. Four tracks can be played in parallel.
Pressing SPACE will run the pattern once. The length of the pattern is by default 64 slots, whereas the screen can only show 16 at a time. The TIC-80 music editor is not especially good at showing where you are at the track.
Some might find it more comfortable to change the track length to 16, but then you will have a very short song, as the song editor to the left only has 16 positions.
Clicking the music editor icon again flips between the piano roll and a Soundtracker-style screen, where you can see multiple tracks in parallel.
Pressing 1 within a tracker editor position inserts an "empty" slot, which shuts any ongoing tones. You could also use the commands to turn volume to 0, but you need to change the volume back to 255 for that channel for the rest of the notes to play. So using the volume command for this would be uneconomic and perhaps confusing.
In the code, MUSIC(0) plays the tune. If you just want music rolling in the background of your simple looping demo, this instruction should be done before the function definitions.
Pro Version
I also compiled the "pro version" from sources, and got a working keymap as a result.
More importantly, it's possible to save projects as .lua files. The graphics, sound and music data are included in the lua script as metadata, although in some cases the ordering is rather silly (and different from how the TIC-80 machine stores them internally). But the tiles and maps are quite straightforward.
Getting it to compile was something of a hassle, but it's a little more comfortable to use a normal text editor for handling the source. The TIC-80 window can be kept open and the changes to the file are directly reflected in the opened file.
For some reason I didn't get the "bare metal" Raspberry version to work. I tried variants on 2B+ and 3. There aren't that many experiences and videos online, so I suspect not that many people have worked on it. It would have been fun to try it on a CRT display, and made the TIC-80 feel a little more like a real console.
No comments:
Post a Comment