A very simple love2d project starter because i wrote
function love.update(dt)
...
endso many times its crazy...
- Organized project structure, s eparates game logic, utilities, and assets
- OOP-style foundation, uses Lua tables and metatables for reusable modules
- Custom color palette, predefined RGB constants for consistent visuals
- Seeded RNG, random generator initialized using system time
- Virtual resolution, configurable resolution independent of screen size using https://github.com/Ulydev/push
- Automatic scaling, handles resizing, offsets, and different displays
- Canvas rendering, consistent rendering using virtual resolution
- Coordinate conversion, utilities for game-space and screen-space mapping
- Basic input, includes Escape to close the game
- Minimal boilerplate, only essential systems included
myLoveProject/
├── assets/
├── src/
│ ├── game.lua
│ └── push.lua
├── .luarc.json <- this is only good if you use nvim, you can delete it if u dont
└── main.lua
- Lua
- Love2D
- Git
git clone https://github.com/baccinrafael/starterLuaProject myLoveProject && cd myLoveProject && love .Virtual resolution is defined in src/game.lua:
local GameData = {
width = 500,
height = 500,
}This defines the internal coordinate system used by the game.
A seeded random generator is initialized using system time:
local rng = love.math.newRandomGenerator(GameData.seed)Defined in src/game.lua:
local Colors = {
inkBlack = CH(13, 19, 33),
linen = CH(255, 237, 223),
-- and more... CH is a simple function i made beacuse love2d uses 0~1 values instead of 0~255 for colors
}The project uses a virtual resolution system handled by push.lua.
main.lua
↓ calls
src/game.lua
↓ calls
src/push.lua
↓ help render
Love2D
- setupScreen
- resize
- start
- finish
- toGame
- toReal
- switchFullscreen
- getDimensions
The assets folder is prepared for:
- images
- fonts
- sounds
- music
- shaders
- maps