Procedural map generation

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
Gunroar:Cannon()
Party member
Posts: 1128
Joined: Thu Dec 10, 2020 1:57 am

Re: Procedural map generation

Post by Gunroar:Cannon() »

fridays18 wrote: Sat Dec 17, 2022 9:09 pm
Would you happen to know any tutorials or areas to learn about how to use it since the docs are kinda just a command dump?
I don't know the docs seem to have a lot. Even examples.

Code: Select all

--[[ Uniform ]]
ROT= require 'src.rot'
update= false
function love. load()
f  =ROT.Display( 80 , 24 )
uni=ROT.Map.Uniform(f:getWidth(), f:getHeight())
update= true
end
function love.draw() f:draw() end
function calbak(x, y, val) f:write(val== 1 and '#' or '.' , x, y) end
function love.update()
if update then
update= false
uni:create(calbak)
local rooms=uni:getDoors()
for k,v in pairs (rooms) do
f:write( '+' , v.x, v.y)
end
end
end
function love.keypressed(key) update= true end
Most of the maps just decide if an x,y position is solid or not and let you decide how to deal with that in the callback. Pretty Straight forward.
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
fridays18
Citizen
Posts: 90
Joined: Tue Nov 01, 2022 3:24 pm

Re: Procedural map generation

Post by fridays18 »

Gunroar:Cannon() wrote: Sun Dec 18, 2022 7:29 am
fridays18 wrote: Sat Dec 17, 2022 9:09 pm
Would you happen to know any tutorials or areas to learn about how to use it since the docs are kinda just a command dump?
I don't know the docs seem to have a lot. Even examples.

Code: Select all

--[[ Uniform ]]
ROT= require 'src.rot'
update= false
function love. load()
f  =ROT.Display( 80 , 24 )
uni=ROT.Map.Uniform(f:getWidth(), f:getHeight())
update= true
end
function love.draw() f:draw() end
function calbak(x, y, val) f:write(val== 1 and '#' or '.' , x, y) end
function love.update()
if update then
update= false
uni:create(calbak)
local rooms=uni:getDoors()
for k,v in pairs (rooms) do
f:write( '+' , v.x, v.y)
end
end
end
function love.keypressed(key) update= true end
Most of the maps just decide if an x,y position is solid or not and let you decide how to deal with that in the callback. Pretty Straight forward.
Tysm!
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 6 guests