Procedural Cave/Map Generation Experiment
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Procedural Cave/Map Generation Experiment
I've added another .love file, which generates maps with land/water, etc. See the main post for more details.
Re: Procedural Cave Generation Experiment
kikito wrote: PS: I don't know many people from Australia. Is your accent from Victoria?
As a Queenslander I can say that his accent is much like my own, it isn't a specific Victorian dialect, Australians tend to have a fairly uniform accent, with only small variation between states/territories, unless you're a boganBlackBulletIV wrote:
It's not the highly-posh British-like accent (is Victorian what you call it?) that was around during the earlier nineties. I'm actually not sure what it is. It's definitely not the aussie ocker accent. The accent isn't from Victoria I believe, as I've been up and down the east coast (Queensland, New South Wales, and currently Victoria).
My Development Diary - http://shanegadsby.info
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: Procedural Cave Generation Experiment
I had to have each block separate in Underlife because adding and removing tiles is a core gameplay mechanic. Or maybe I was just doing it wrong, who knows. Stacking boxes and stuff is possible without Box2D, but you'd need your own Lua-based physics for it (like Hardon Collider or something. My own Fizz isn't suited to stacking).BlackBulletIV wrote:Ah ok, that explains (that number would apply to shapes too, as I tested it by using a single body too). Yeah I'd appreciate a snippet, not sure whether I'll use cave generation in a game for a while though.
Custom physics wouldn't go well if you wanted to do complex stuff like stacks of falling boxes, joint systems and the like; the only feasible way then would be to load/unload small sections of map.
Here's the physics I use in Underlife at the moment (it needs slight tweaking and a good bit of refinement, but it works quite well for me):
Code: Select all
-- pc is the player object, which has (amongst other things) variables x, y (coordinates), xv, yv (velocity), facing (-1 or 1, pc is facing left or right)
local p = pc
-- check for key input
local w,a,s,d,j = love.keyboard.isDown("w"), love.keyboard.isDown("a"), love.keyboard.isDown("s"), love.keyboard.isDown("d"), love.keyboard.isDown(" ")
if map[math.round(p.x)] and map[math.round(p.x)][math.ceil(p.y+.01)] then -- touching the ground
p.yv = p.yv + (j and -.2 or 0) -- jumping
p.xv = p.xv + (a and -.8 or d and .8 or 0)*dt -- running
p.xv = p.xv*(1-dt*6) -- horizontal friction
end
if p.xv<.15 and p.xv>-.15 then p.xv = p.xv + (a and -.2 or d and .2 or 0)*dt end -- limited air control
p.yv = math.min(p.yv + .6*dt, 1) -- falling
p.x,p.y = p.x+p.xv, p.y+p.yv -- add velocity to coordinates
p.facing = p.xv<-.04 and -1 or p.xv>.04 and 1 or p.facing -- determine if pc is facing left or right
-- check for collision with tiles
-- tiles are in form of map[x][y] = tile (or nil if there's no tile there). No decimals. No numbers skipped between touching tiles.
-- please note, in Underlife, the pc is two tiles tall, one tile wide
if map[math.round(p.x)] and map[math.round(p.x)][math.ceil(p.y)] then p.y,p.yv = math.ceil(p.y)-1,0 end
if map[math.round(p.x)] and map[math.round(p.x)][math.floor(p.y-1)] then p.y,p.yv = math.floor(p.y)+1,0 end
if map[math.floor(p.x)] and (map[math.floor(p.x)][math.round(p.y)] or map[math.floor(p.x)][math.round(p.y-1)]) then p.x,p.xv = math.floor(p.x)+1,0 end
if map[math.ceil(p.x)] and (map[math.ceil(p.x)][math.round(p.y)] or map[math.ceil(p.x)][math.round(p.y-1)]) then p.x,p.xv = math.ceil(p.x)-1,0 end
Code: Select all
map={
1={ 2=tile, 3=tile, 4=tile, },
2={ 1=tile, },
3={ 1=tile, 4=tile, 5=tile, },
4={ 1=tile, 5=tile, },
5={ 2=tile, 3=tile, 4=tile, 5=tile, },
}
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Procedural Cave Generation Experiment
Thanks for that.Taehl wrote:...
I know that stacks of boxes and stuff is certainly doable in Lua, it's just that it would be reinventing the wheel, and in a slower environment.
Bogan sounds a bit like an ocker from the description. There are also more skewed accents like many from the country, pronouncing "like" as "lyke", "life" and "lyfe", and a number of other weird sounding stuff. Julia Gillard also has a rather strange accent.schme16 wrote:kikito wrote: PS: I don't know many people from Australia. Is your accent from Victoria?As a Queenslander I can say that his accent is much like my own, it isn't a specific Victorian dialect, Australians tend to have a fairly uniform accent, with only small variation between states/territories, unless you're a boganBlackBulletIV wrote:
It's not the highly-posh British-like accent (is Victorian what you call it?) that was around during the earlier nineties. I'm actually not sure what it is. It's definitely not the aussie ocker accent. The accent isn't from Victoria I believe, as I've been up and down the east coast (Queensland, New South Wales, and currently Victoria).
Re: Procedural Cave Generation Experiment
I'm willing to blame that on her being originally a pomBlackBulletIV wrote:Julia Gillard also has a rather strange accent.
My Development Diary - http://shanegadsby.info
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Procedural Cave/Map Generation Experiment
The English have a pretty nice accent (excluded cockney and an over-done royalty-like accent), so she must've unfortunately got her accent mixed up between the two, with possibly some New Zealand thrown in.
Re: Procedural Cave/Map Generation Experiment
Isn't she from Wales? They have pretty funny accents.
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Procedural Cave/Map Generation Experiment
Wouldn't have a clue of their accents.
Who is online
Users browsing this forum: Google [Bot] and 74 guests