Bip bop with
LIKO-12

A Fantasy Computer

A talk by Ciro Durán (@chiguire)
ciro.duran@gmail.com
FLISOL Madrid 2018
This talk has speaker notes! Press 's' to read.
Estas láminas también están en español: http://ciroduran.com/talks/2018/liko12/es

Agenda

  • What is LIKO-12?
  • Hello World in LIKO-12
  • Programming in LIKO-12
  • Editors
  • DiskOS Operating System
  • What can I do?

What is LIKO-12?

LIKO-12 after booting

Specs

Component Info
CPU LuaJIT (Lua 5.1)
GPU 192x128 4-Bit screen
Map 144x128 cells (255 tiles)
HDD 2x 25MB drives
Input Keyboard, mouse, touch and control
LIKO-12 after booting
Sprite editor
Text editor

Hello world in LIKO-12

(First attempt)


-- Hello World 1
clear(0)
print("HOLA FLISOL!",50,50)
line(12, 12, 50, 60)
						

Code in https://pastebin.com/5pmdw4cL
Run it in LIKO-12: pastebin get 5pmdw4cL hola1.lk12

Hola Flisol 1

Hello world in LIKO-12

(Second attempt)


-- Hello World 2
function _init()
 clear(0)
end

function _draw()
 print("HOLA FLISOL!",50,50)
 line(12, 12, 50, 60)
end

function _update()
end
						

Code in https://pastebin.com/C801GkkQ
Run it in LIKO-12: pastebin get C801GkkQ hola2.lk12

Hola Flisol 2

Hello world in LIKO-12

(Third attempt)


-- Hello World 3

n = 1
COLORS = {2,4,3,5,6,8,7,9}
max = 30
angle = 60
speed = 15
timer = speed
x = 0      -- initialized in _init()
y = 0      -- initialized in _init()
radius = 0 -- initialized in _init()

function pointCircle(x,y,r,angle_rad)
 return
  x+math.sin(angle_rad)*r,
  y+math.cos(angle_rad)*r
end

function screenDims()
 return {
  x = screenWidth()/2,
  y = screenHeight()/2,
  radius = (screenHeight() < 
   screenWidth()) and
   (screenHeight()/2*0.9) or
   (screenWidth()/2*0.9)
 }
end

function _init()
 clear(0)
 dims = screenDims()
 x = dims.x
 y = dims.y
 radius = dims.radius
end

function _draw()
 clear(0)
 for i=1,n do
  coloralt=(i%#COLORS)+1
  a = math.rad(i*360/max + angle)
  b = math.rad(i*360/max - angle)
  p1_x, p1_y = pointCircle(x,y,radio,a)
  p2_x, p2_y = pointCircle(x,y,radio,b)
  line(p1_x,p1_y,p2_x,p2_y,coloralt)
 end
 print(
  "HOLA FLISOL!",
  screenWidth()/2 - 28,
  screenHeight()/2
 )
end

function _update()
 if timer > 0 then
  timer = timer - 1
  if timer == 0 then
   n = n + 1
   timer = speed
  end
 end
end
						

Code in https://pastebin.com/x7wuaWTH
Run it in LIKO-12: pastebin get x7wuaWTH hola3.lk12

Hello world in LIKO-12

Hola Flisol 3, animated

Programming in LIKO-12

(Vou baixar a Lua)

Lua programming language logo

https://www.lua.org/

Some graphical operations

clear(colourn)
Cleans screen
print(text, x, y, [colour])
Prints a text in position
line(x1,y1,x2,y2,[color])
Draws a line
Sprite(tileID,x,y,[rotation])
Draws a sprite in position
map(x,y,tx1,ty1,tx2,ty2)
Draws a map
mset(x,y,tile)/mget(x,y)
Manipulate the map
clip(x1,y1,x2,y2)
Limit drawing to this area
cam(...)
Camera operations

Included external libraries

  • Middleclass: for classes and subclasses
    
    local Fruit = class("Fruit") -- a class called "Fruit"
    Fruit.static.myvalue = 2 -- static values and function
    function Fruit:initialize(color) -- ...
    local Mango = class("Mango", Fruit) -- subclassing
    							
  • Bump: simple collisions, AABB (Axis-aligned bounding box).
  • JSON: "as its name says"
  • Lume: nicely complements Lua's standard library, very useful for tables.

Editors

Sprites

Sprite editor

Sprites

Sprite editor with sprites

Code

Text editor

Code

Text editor with text

Maps

Map editor

Maps

Map editor with map

Sound

Sound editor

Music (WIP)

Music editor

...but you can generate it with code


Audio.generate(1,250,1) -- to play a note
Audio.generate()        -- to stop
						

DiskOS, operating system

DiskOS

What can I do?

Install games and demos

In the command line:

install_demos

install_games

Erni's Iceberg (WIP), by Thirite

A frogger clone

This game and code available in http://github.com/chiguire/sapper

Documentation and community

itch.io https://ramilego4game.itch.io/liko12
Wiki http://liko-12.readthedocs.io/en/latest/
Twitter https://twitter.com/ramilego4game
Discord https://discord.gg/GDtHrsJ
Trello https://trello.com/b/bHo8Y9sx/liko-12
Github https://github.com/RamiLego4Game/LIKO-12
Email ramilego4game@gmail.com

Questions?

¡Thank you!

This slides, and notes, in http://ciroduran.com/talks/2018/liko12/es

I'm on Twitter: @chiguire

Email: ciro.duran@gmail.com