Demo - tile, cell based world (with collision)

Show off your games, demos and other (playable) creations.
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Demo - tile, cell based world (with collision)

Post by Taehl »

This was mainly a test / code-doodle I just made. Its code is small and fairly straight-forward (albeit pretty unoptimized). It features:
- Tile-based, top-down smoothscroller (like an old Zelda game)
- Cell-based world (like Bethesda games or Minecraft uses - chunks are loaded dynamically as needed, rather than the whole world at once). This tried-and-true approach has several uses, such as allowing huge worlds without tonnes of memory.
- Cells are NOT forced to coincide with reality (I have two "warps" to demonstrate it)
- Simple physics (no walking through walls) (known bug: If you diagonally walk into a tile's corner just right, you'll get stuck. This could easily be fixed by making the collision code more than two lines long)
- Cells-over-cells, with parallax

Not sure I'm going to go anywhere with this. Like I said, I was mainly just messing around. But I thought it may be inspiring, or help provide an example of how top-down scrollers work.

Download

Image
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+.
User avatar
dandruff
Prole
Posts: 38
Joined: Fri Jan 15, 2010 1:39 pm

Re: Demo - tile, cell based world (with collision)

Post by dandruff »

It looks awesome and smooth. The only thing that annoyed me was the fact that the lower floor was visible from the level above, but you didn't notice that you went downwards. I understand that it's hard to find a way that looks and feels good doing this. It would be awesome if the stair-pieces popped up a small amount behind you and raises from in front of you when you walk down for example. Nonetheless, it looks really good and the warp-zones was impressive (didn't notice it at first, then I felt stupid :P).

.d
coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

Re: Demo - tile, cell based world (with collision)

Post by coffee »

I see you doing a project a bit similar to mine. But my game is turn-based instead. Your room-by-room map display is nice and interesting. Congratulations, all seem to be working great. And if you do the message display log before me you bet I will sneak in your code, lol. Have fun working on this Taehl.

EDITED: Only now noticed the discrete "paralax" layer bellow. It's awesome. Well done. You should do something with this, don't stop.
User avatar
lots_of_birds
Prole
Posts: 13
Joined: Sun Dec 11, 2011 12:09 pm

Re: Demo - tile, cell based world (with collision)

Post by lots_of_birds »

It could seem silly, but discovering theses simples lines in your game almost stole me tears of joy

Code: Select all

function love.update(dt)
        dt = math.min(dt, .07)
This resolve in a very simple way all weird cases of collision problem I had with my first love project.

Thanks for sharing
User avatar
Ensayia
Party member
Posts: 399
Joined: Sat Jun 12, 2010 7:57 pm

Re: Demo - tile, cell based world (with collision)

Post by Ensayia »

I like the parallax effect below, I assume you are loading the cell or cell data below?

Going up and down stairs feels a little weird in terms of graphics, but this was a quick prototype and that's cool. I like the cell approach... I should look at your source.
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: Demo - tile, cell based world (with collision)

Post by Taehl »

Yeah, the parallax loads and shows another cell. And since it's not based on physical locations, it could be any cell (I just avoided that in my test map to prevent huge confusion). As far as the stair transition... Eh. I had to choose a point to stop showing the "lower" floor and start showing the "upper" one, and this seemed the least strange.
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+.
User avatar
ishkabible
Party member
Posts: 241
Joined: Sat Oct 23, 2010 7:34 pm
Location: Kansas USA

Re: Demo - tile, cell based world (with collision)

Post by ishkabible »

parallax is really cool but in trying to get a better look i found a bug

Image

I was coming from the left and after I got there I coudln't move in any direction.

edit:
It's proving difficult to replicate; These are the kind of bugs I hate, the ones you have to can't seem to make happen again.
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: Demo - tile, cell based world (with collision)

Post by Taehl »

Taehl wrote:(known bug: If you diagonally walk into a tile's corner just right, you'll get stuck. This could easily be fixed by making the collision code more than two lines long)
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+.
User avatar
StoneCrow
Party member
Posts: 199
Joined: Sat Apr 17, 2010 9:31 am
Location: Wales the land of leeks and leaks
Contact:

Re: Demo - tile, cell based world (with collision)

Post by StoneCrow »

Wow really cool!
I wondered around the warp area for ages before realising it was bogus haha.
Dull but sincere filler.
User avatar
clickrush
Citizen
Posts: 83
Joined: Tue Dec 13, 2011 12:50 am

Re: Demo - tile, cell based world (with collision)

Post by clickrush »

wandering in and out of the infinite floor is a psychedelic experience! Everything in this program is beautiful. thx for sharing :)

The most usefull thing to implement from my point of view would be a minimap that also shows on which level you are. you could make a layered minmap or something idk.
Sry about my english.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests