Author Topic: Wall top sprites on 3/4 perspective  (Read 7307 times)

Slash

  • Creator of Roguetemple
  • Administrator
  • Rogueliker
  • *****
  • Posts: 1203
  • Karma: +4/-1
    • View Profile
    • Slashie.net
    • Email
Wall top sprites on 3/4 perspective
« on: January 24, 2015, 07:41:00 PM »
Hi!

I'm trying to devise an algorithm to determine what sprite to use as a "wall top" in order to make my game look like this: http://slashwareint.com/ananias/temple.png

Anyone has worked out something similar? any experiences to share?

Slash

  • Creator of Roguetemple
  • Administrator
  • Rogueliker
  • *****
  • Posts: 1203
  • Karma: +4/-1
    • View Profile
    • Slashie.net
    • Email
Re: Wall top sprites on 3/4 perspective
« Reply #1 on: January 26, 2015, 04:41:20 AM »
I ended up doing a lot of checks for whether neighbor cells where solid or not; it helped a lot that I already had a pseudo 3d system in place only that it always used a block instead of doing borders...
In any case it was most a thing of figuring out such rules; corners were a bit more tricky since sometimes they needed to overlay with other borders.
In the end I was able to do this with just 12 tiles, I wonder if that routine may be helpful for someone.
https://twitter.com/slashie_/status/559564072832622592

Danakh

  • Newcomer
  • Posts: 34
  • Karma: +0/-0
    • View Profile
    • Ratz 'N' Godz
    • Email
Re: Wall top sprites on 3/4 perspective
« Reply #2 on: January 26, 2015, 07:23:15 AM »
In the first version of 1Quest, I had a somewhat more complex system, with wall casting shadows on other tiles. I don't have any screenshot accessible here, but you can watch the video https://www.youtube.com/watch?v=gUTuM6-DnYc (at 15 seconds)

My way of dealing with it was looking at the 4 tiles around:
Code: [Select]
3 2 1
4 X 0
5 6 7
So I looked upon 0 2 4 and 6 (I use trigonometric order) and compute a simple string composed of 0 for non-wall and 1 for wall in that order

So for example
Code: [Select]
###
.##
...
would be 1100 (wall in 0 and 2, no wall in 4 and 6). And then I directly named my assets with this string in the names (cavewall_0011.png for this wall in caves) so I just have to create the asset name dynamically. You can check that it makes 16 different tiles and I needed the 16 for what I wanted.

I had to add special additional name for upper left and right corner, because if tile 1 or 3 and non wall, but 0 and 2 (2 and 4 resp.) are walls, you must add additional small corner to make things nice. So cavewall_0011 may add another graphic cavewall_UR.png for adding the upper right corner.

In top of that, I add a last "_0", "_1" etc... at the end for the different version of the same tile (to avoid repetition)
« Last Edit: January 26, 2015, 07:26:17 AM by Danakh »