Page 4 of 4

Re: Procedural map generation

Posted: Sun Dec 18, 2022 7:29 am
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.

Re: Procedural map generation

Posted: Mon Dec 19, 2022 8:46 pm
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!