kaboom icon indicating copy to clipboard operation
kaboom copied to clipboard

Add Isometric level support

Open gugiserman opened this issue 4 years ago • 13 comments

Hey guys,

I just recently found out about kaboom and I was totally in love with it, but I really wanted to be able to work with isometric tilemaps (mostly generated via Tiled). I was going to work on it as a plugin or maybe fork already existing plugins but I felt like this should be supported by Kaboom first and then integrated with external software as add-ons for extended support and more advanced use cases.

New logic added is mostly addIsometricLevel function in /src/kaboom.ts


image


Obs: I thought of maybe adding a isometric?: boolean to addLevel and make conditional rendering from there, but decided to go with separate method instead, so let me know what you think!

gugiserman avatar Nov 10 '21 06:11 gugiserman

Thank you! This will be an exciting feature

slmjkdbtl avatar Nov 11 '21 03:11 slmjkdbtl

I'm not familiar with isometric games, is it common to make sprites directly in isometric format, or is it common to make sprites in normal format, but use skew transform to make it look isometric (skew transform doesn't exist in kaboom yet but is trivial to implement)?

slmjkdbtl avatar Nov 12 '21 02:11 slmjkdbtl

I'm not familiar with isometric games, is it common to make sprites directly in isometric format, or is it common to make sprites in normal format, but use skew transform to make it look isometric (skew transform doesn't exist in kaboom yet but is trivial to implement)?

It is ideal to make it in isometric format from start, but there are tools and techniques to convert traditional topdown squared assets like terrain tiles into isometric formats. Sometimes the outcome is perfect and seems like it was planned and done in isometric, sometimes not so much...

For characters and other objects I think there's usually no way around, unlike terrain tilesets you can't really play around with resizing and skewing it and expect it to look good enough 😝

You can take a look at various different isometric resources, from flat terrain tiles to block ones at sites like opengameart and itch.io. I'm not sure how we would go about supporting the block tile type though, maybe it would need a Z dimension handled for each symbol...


Here's a conversion software for example (never used this one, just did a quick search now)

  • https://melikepixels.itch.io/isometric-tileset-generator

A block type tile for example:

  • https://mosvisio.itch.io/isometric-tileset-nature

Flat floor tiles:

  • https://opengameart.org/content/1000-isometric-floor-tiles

gugiserman avatar Nov 12 '21 04:11 gugiserman

@slmjkdbtl any idea what could have happened here? I simply rebased the branch and adjusted getPos() of isometricLevel to match level's interface.

image

FYI I'm dismissing your approval and requesting a new review because of this.


I just rolled back to several commits which I know for sure were working, it's not working in any of them anymore. Something changed in some of the components of kaboom that broke this, any idea what exactly could have been?

gugiserman avatar Nov 26 '21 05:11 gugiserman

Weird, maybe the break is introduced by 72b59c8ce50c7369d9ef52d211901fe48e299ff6 which does some refactoring on how game objects work, can you try if reverting to rebase on the previous commit 03c23a292a8792be6e238c37d77b731e481486b2 to see if that's the case

slmjkdbtl avatar Nov 26 '21 20:11 slmjkdbtl

Weird, maybe the break is introduced by 72b59c8 which does some refactoring on how game objects work, can you try if reverting to rebase on the previous commit 03c23a2 to see if that's the case

Yep, it works on top of https://github.com/replit/kaboom/commit/03c23a292a8792be6e238c37d77b731e481486b2. I've squashed this PRs commits because I thought it made it easier to handle and test across branches etc.

image

gugiserman avatar Nov 26 '21 22:11 gugiserman

Thanks 👍 I'll investigate the break

slmjkdbtl avatar Nov 26 '21 22:11 slmjkdbtl

Sorry for the delay. The issue should be fixed in #468, if it does feel free to merge anytime

slmjkdbtl avatar Dec 16 '21 23:12 slmjkdbtl

Sorry for the delay. The issue should be fixed in #468, if it does feel free to merge anytime

Thanks! But it's still pending your review before I can merge.

gugiserman avatar Dec 24 '21 06:12 gugiserman

Sorry thought already approved 😅

slmjkdbtl avatar Dec 24 '21 08:12 slmjkdbtl

@slmjkdbtl hello man, I just ran a very difficult rebase of my branch and was checking if everything is good. Can you help me out here if there's still any chance of us merging this branch? 😆

I'm getting this one error from the newly added demo when running the test suite. I assume there's a list of globals this needs to be included, but I can't seem to find it. A lot of changes since I first created this PR which is awesome 👍🏻

image

I have also noticed addLevel now returns a GameObj, but addIsometricLevel still returns a IsometricLevel. Let me know if that needs to be refactored to mirror addLevel or not really.

Other than that, it seems like everything else is in order and it still works.

image

gugiserman avatar Aug 20 '22 05:08 gugiserman

Does it exist a tutorial or demo for isometric games with kaboom?

jumpjack avatar Dec 06 '22 09:12 jumpjack

Hey, sorry for very much delay on this PR. Was away from kaboom for a while and recently got back.

The level system is going to go under some big change soon so I'm thinking to merge this after the change is done so we only have to rebase to the new code once.

slmjkdbtl avatar Dec 07 '22 05:12 slmjkdbtl