Engine and graphics

Here's where all things related to Book II are being discussed!
Post Reply
Lamoot
Pledge
Posts: 2
Joined: February 20th, 2009, 12:44 pm

Engine and graphics

Post by Lamoot »

Hello,

It's my first time posting here, I've been following this project here and there and kudos to you, BasiliskWrangler, for persevering and pulling this through. Especially as a more or less single man effort.

But there is another reason I am posting here. I am involved in an open-source, 2d isometric RPG project (in very early stages of development) and I am making some research how other similar projects handle graphics. Eschalon Book: I & II have rather nice visuals and are a good reference to the quality of graphics we'd like to achieve. However, my questions are not so much "how you achieved the look" but more "how does the engine handle graphics". I'm especially interested in the following:
  • How does the engine handle different ground types and transitions between them? Do you have a complete set of all possible transitional tiles between two ground types, or do you use some more advanced methods like Texture splatting? (if they can even be adapted to 2d that is)
  • Would it be possible to post a picture of a single tile from Eschalon - an image can tell more than a thousand words.
  • How does the engine handle character sprites. The weapons are the only equipment that show on the character sprite. Do you use a new sprite altogether for this, or is the weapon a separate sprite attached to the main character sprite.
  • Do you know of any useful methods how 2d engines handle graphics that are worth mentioning?
Hopefully, it's not too much work to answer these questions.

Regards,
Lamoot
User avatar
Kreador Freeaxe
Major General
Major General
Posts: 2425
Joined: April 26th, 2008, 3:44 pm

Re: Engine and graphics

Post by Kreador Freeaxe »

Lamoot wrote:How does the engine handle character sprites. The weapons are the only equipment that show on the character sprite. Do you use a new sprite altogether for this, or is the weapon a separate sprite attached to the main character sprite.
Hello, Lamoot. I'm sure BW will hop in to tell you about some of this, but you are in fact wrong in this point. Weapons and armor both change on the character sprite when you change them. You can wear hats and cloaks and all sorts of stuff. The shirts change. The pants change. It's a lot of fun.
---

Kill 'em all, let the sysadmin sort 'em out.
User avatar
xolotl
Lieutenant
Lieutenant
Posts: 777
Joined: August 21st, 2008, 1:54 pm

Re: Engine and graphics

Post by xolotl »

Lamoot wrote:
  • How does the engine handle different ground types and transitions between them? Do you have a complete set of all possible transitional tiles between two ground types, or do you use some more advanced methods like Texture splatting? (if they can even be adapted to 2d that is)
  • Would it be possible to post a picture of a single tile from Eschalon - an image can tell more than a thousand words.
  • How does the engine handle character sprites. The weapons are the only equipment that show on the character sprite. Do you use a new sprite altogether for this, or is the weapon a separate sprite attached to the main character sprite.
Hopefully I'm not posting info that BW wouldn't want out there, but I can at least tell you how the images are stored inside the main graphics archive.

To draw a single tile, you'd first grab a 52x26 bitmap of the base tile (which has an alpha channel, for transparency) - the non-transparent areas make up the diamond that you'd expect for an isometric tile. Then on top of that, you'd grab a 52x26 "decal" image which would get overlaid on top, which could be a blood splatter, or a "transition" overlay (like going from sand to grass, etc) - this one's mostly transparent, so you just composite the two together, basically. Then on top of that you'd grab whatever object happens to be on that square (door, wall, chest, monster, what have you) and do a similar composite, and then there's an object decal which goes on top of that (for windows, torch posts, etc). The map files simply define which floor, decal, object, object decal, or creature is present on each square. How the actual game engine itself handles all this I'm not sure; I'd imagine that the composites of floor+decal+object+objectdecal are cached somehow so it's not constantly regenerating the images. It's a very quick process to load in a whole map this way - I can do it in pure Python (which isn't the speediest) in just a few seconds (though of course the game engine takes into account lighting effects like torches, etc, so clearly it's got to go through another level there).

As for your avatar, it looks like a similar process, at least datawise. I'm pretty sure that BW uses 3D models to construct them, but by the time the game loads them in, they've been exported to a similar kind of bitmap. You have a base avatar image file which is a grid with a render of your avatar in all stages of its animation (it looks like fifteen frames), facing all eight directions. Then on top of that your armor, weapons, shields, torches, et are composited in, from separate pre-rendered files (so one file has a 15x8 grid of the shield, one has a 15x8 of the sword, etc). Again, I don't know how the game engine itself handles it, but I'd guess that it caches a composite of your currently-activated equipped-inventory set and then just updates those caches when you swap equipment. Just a guess though. Enemies' sprites are a bit simpler since the weapons are pre-rendered onto their main graphics files, so there's just the one 15x8 grid for each enemy.

(Edit: Well, I guess I shouldn't really say "Pure Python" there, since the actual graphics compositing happens via PyGTK, which runs stuff that's C and Assembly, in the background. Still, I'm guessing that to run at decent speeds you don't really need more than one pass at compositing and then caching the results.)
Lamoot
Pledge
Posts: 2
Joined: February 20th, 2009, 12:44 pm

Re: Engine and graphics

Post by Lamoot »

Hello, Lamoot. I'm sure BW will hop in to tell you about some of this, but you are in fact wrong in this point. Weapons and armor both change on the character sprite when you change them. You can wear hats and cloaks and all sorts of stuff. The shirts change. The pants change. It's a lot of fun.
Oh, I didn't know that, show how much I've played the demo :oops: :wink: Thanks for pointing this out.
Hopefully I'm not posting info that BW wouldn't want out there, but I can at least tell you how the images are stored inside the main graphics archive...
I tried opening the archive to inspect it, but was unable. Can you tell me how you did it, or is this information not to be spread around and the archive kept closed as it is?
As for your avatar, it looks like a similar process, at least datawise. I'm pretty sure that BW uses 3D models to construct them, but by the time the game loads them in, they've been exported to a similar kind of bitmap...
Yes, pre-rendered sprites :) and different sprites combined into a single "avatar". Some other games have this as well, for example Baldur's Gate 2. I know the approach in general, but not all the ins and outs and how the engine handles combining these separate sprites.

Also, what you say about handling the environment makes sense, but it would be useful to see individual sprites, to have a really solid (visual) understanding of the approach. I understand the nature of the project and reservations BasiliskWrangler might have with showing actual source files, so I hope it doesn't come as too senseless asking what I ask.

Anyway, thank you both for replying.
Post Reply