Log In  
Follow
sulai

Cart #crystal-9 | 2022-07-11 | Code ▽ | Embed ▽ | No License
4

Colonize the planet!

To win the game, find, activate and connect 5 ancient crystal drills with the core!

How to play

  • start building solar panels and hydro-power-plants
  • connect them to quarries to get more minerals
  • build more stuff using minerals

keyboard

O - choose things to build (terrain dependent). Destroy building.
X - construct building. mass building with X+arrows. terrain sensitive. pipette tool.

hold X on building - investigate requirements, connected suppliers and consumers, and the cluster's netto production
keep holding X - show map and stats

Game Mode: Post Apocalypse

You find the ruins of a lost civilization scattered on the planet. The mineral resources have been depleted and the yield of mineral mining is low.

You have to refactor, rebuild and recycle of what is left on the surface.

You can start this game mode from the pause menu.

Credits:

[ Continue Reading.. ]

4
16 comments



Cart #gobliiins-16 | 2022-07-08 | Code ▽ | Embed ▽ | No License
21

You play 3 goblins:

  • one is intelligent and can do wizardry
  • one is strong and can move things
  • one is crafty and can use items

Together they set out
To find great riches,
Which are said to be found
On level 20 of the Lost City!

Features:

  • Tutorial: 12 hand crafted levels
  • The Lost City: 20 procedurally generated levels
  • 3 characters with different abilities
  • items, spells and interactive blocks
  • music. each character got its own tape played in the boom box.

Credits

  • Thanks for all the play testers and their feedback!
  • Special thanks to the Lazy Devs Community (Discord)

Recent changes

  • Level 10 (Wizard Magic) changed to have many ways to solve it
  • New Level 12: Teleporters and Explosives!
  • Level 7 redesigned (was too hard)
  • Hold C (O) to restart
  • Removed back-up (regenerate) in the Lost City
  • New Level: Lasers and Diamonds!
  • New Level: Teleporters!
  • Added music for each character
21
10 comments



I recently tried to implement an enum structure in Lua, which turned out to be very useful. So I thought I might share it here :)

Find the latest version here (it's part of a Pico-8 library) https://github.com/sulai/Lib-Pico8/blob/master/lang.lua

Then enum(...) function generates an enum structure from a list of names.

The generated structure is useful when it comes to readability and object orientation.

As a use case for Pico-8, you can comfortably generate named objects that map to sprite ids. So if you want to associate names to your sprites like "sword", "shield", etc to show that to the user, this is a nice way to do it.

Example usage in a RPG:

tiles = enum( {"grass" ,"water", "rock"} )     -- landscape sprites start at 1
items = enum( {"sword" ,"shield", "bow"}, 16 ) -- item sprites start at 16
colors = enum( {"black", "blue", ... }, 0 )    -- map color palette.
actions = enum( {"look", "take", ... } )       -- just an enum.

[ Continue Reading.. ]

5
5 comments



I'm just starting a new game from scratch and programming pico-8 feels really nice :)

So the first step is to have a cursor moving on a map. I wanted it to be really smooth and snappy and fast. So this is what I came up with.

Feel free to use it in your projects :)

Cart #43864 | 2017-09-02 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

3
0 comments



I'm happy to announce my very first contribution to the Pico-8 community, which is a spin-off of Makiki's game title "A lone colony on a small planet".

Your goal now is to colonize an even smaller planet, but with some difficulties added to it. So this one is a more of a thinking game, while Makikis original is more of fast builder.

Credits:

Story:

"You have been given a mission. You need to purify a small planet, so we will be able to colonize it. It is rich in resources, so it shouldn't pose a big problem for you. We believe in your management skills. Good luck." -- Makiki

Controls:

  • O to build.
  • X is a multi tool.
    • build faster. you can keep it pressed and move around.
    • select what to build by using X over an existing building
    • get information about a building
    • change transport type
    • show the map and statistics


[ Continue Reading.. ]

7
2 comments



Hi there,

I wrote a script which helps to write lua code in an external editor. The script listens to changes in the .lua file and re-integrates the lua code back into the .p8 cartridge. Each time you save.

So you can happily change lua files and edit assets in Pico-8 and everything gets merged back as soon as you save. Write some code in your editor, switch to Pico-8 and press ctrl-R to reload. It's quick :)

Works great for me in Intelij Idea, where I have syntax highlighting, code analysis and code completion. When trying to call a function, the IDE even shows the function parameters and lua-doc. What more can you ask for?

Some other things the script can do for you

  • include library code (#include library)
  • remove debug code on release (#define debug, #if debug, #end debug)
  • strip comments if you hit the size limit (please consider that comments are helpful for the Pico-8 community ;))
  • convert pico-8 specific statements like += to plain .lua. Some IDEs might work better with plain lua.

That's it, hope you like it. Download it here:

https://github.com/sulai/p8lua

Have a look in the python file, there is more detailled und up to date instructions on the features.

PS: one down side though: the script works for Linux only at the moment, since it uses pyinotify for getting notified about file changes. I'm happy to accept pull requests if you want to port it to windows, maybe doing polling on the .lua files.

2
3 comments



In case your game gets slow, it's always helpful to identify the parts of code that take up too much time to compute. This is how you can measure execution time:

local start = stat(1)
-- .... do some intensive stuff ....
printh("this took "..((stat(1)-start)*100).."% of a frame")

Hope it helps, and thanks to @Felice for pointing out how to accomplish this.

sulai

0 comments



You can use this function in your program to do some basic memory profiling. Given the limit of 1MB memory for Lua variables, a little profiling will be much needed for many of us ;) It will return the amount of all elements of a table, including the content of sub tables.

It will not show the actual amount of bytes used, would be interesting if there is a way to calculate that? But you can use this as a rough estimation and check if your optimizations show any effect on the table size.

table={}
function table.size(t)
	local size=0
	for k,v in pairs(t) do
	 size+=1
	 if type(v)=="table" then
	 	size+=table.size(v)
	 end
	end
	return size
end
1 comment



-- converts anything to string, even nested tables
function tostring(any)
	if type(any)=="function" then 
		return "function" 
	end
	if any==nil then 
		return "nil" 
	end
	if type(any)=="string" then
		return any
	end
	if type(any)=="boolean" then
		if any then return "true" end
		return "false"
	end
	if type(any)=="table" then
		local str = "{ "
		for k,v in pairs(any) do
			str=str..tostring(k).."->"..tostring(v).." "
		end
		return str.."}"
	end
	if type(any)=="number" then
		return ""..any
	end
	return "unkown" -- should never show
end

Example usage:

> print(""..tostring({true,x=7,{"nest"}}))
{ 1->true 2->{ 1->nest } x->7 }

[ Continue Reading.. ]

11
5 comments