Transparencies for sprites?

Chris H.'s Ultima / ACS-style game development system!

Moderators: Ice Cream Jonsey, joltcountry

Biffsnot

Transparencies for sprites?

Post by Biffsnot »

Any way to keep the black box of death from surrounding all your sprites? Besides the Icon setting I mean, as that only affects your player char, and not any npc's. Any idea's appreciated! :mrgreen:

jjsonick
Posts: 145
Joined: Tue Apr 10, 2007 2:49 pm

Post by jjsonick »

No, there is no transparency with ACK's graphics. The tile graphics of the games it's based on (Adventure Construction Set, early Ultimas) were like this too -- those games got around this by making character sprites fill up most of the tile they occupied, with just a bit of black around the edges, so it didn't look like a big black square was blotting out the tiles they were on top off. But some sprites will just have the black showing if they don't fill up the full square:

http://www.kehlet.cx/images/2004/06/ful ... re%204.jpg

One solution is to make black (or whatever color you choose for the background of all your sprites) be the general background color for terrain and default 'empty space', then the black around sprite edges isn't as noticeable. Wasteland did a good job of this:

http://www.mobygames.com/game/apple2/wa ... tId,43159/

JJ

jjsonick
Posts: 145
Joined: Tue Apr 10, 2007 2:49 pm

Post by jjsonick »

Oops, I forgot about TBMP. If you're displaying a bmp graphic in a macro script, you CAN have transparency. From the manual:

"TBMP: "TBMP 306" - Like SHOWBMP, but the color of the lower-left pixel is considered the “transparent” color for the rest of the image. Useful for overlaying one BMP onto another, or overlaying special effects if you can match the BMP palette with the game palette. Warning: it is likely to be slow, as it has to loop through each pixel."

So you can do graphic tricks with that, but of course it can't be used as the graphic for a normal object/npc/etc (ie, it's a graphic effect, instead of something tied to a game object).

Biffsnot

k

Post by Biffsnot »

Ok thanks I figured as much. Funny you should mention Wasteland cause thats the tile set I am using, but the PC version, so the tiles are fairly detailed and it is easy to spot the black. Doesn't matter tho, guess the black is the price to pay.

Wastelands people graphics are fine enough and I doubt I want to expand them to fill up more space.

In general you think people who would play this sort of game engine care much if there is a black border anyway?

Biffsnot

oO

Post by Biffsnot »

BTW here are 2 screen shots showing what it would look like - tell me if this is acceptable :)


http://www.angelfire.com/droid/biffsnot

jjsonick
Posts: 145
Joined: Tue Apr 10, 2007 2:49 pm

Post by jjsonick »

Ah, I see - very cool that you're using Wasteland tiles! Yeah, I think the Apple II tiles have an elegant solution to that problem, but the higher res and tons more colors of the PC version more than make up for it. And yeah, I doubt people interested in playing something nostalgic like ACK will care too much about the black squares o' doom.

You can change the player icon, both from object actions and macros, so, depending on how much you wanted to mess around with it, you could try stuff like having the player icon change to one that has a sandy background when you enter desert regions, and then switching black to the normal black background when you enter urban areas/buildings.

jjsonick
Posts: 145
Joined: Tue Apr 10, 2007 2:49 pm

Post by jjsonick »

D'oh - of course using the Icon feature for terrain objects (as you mentioned in your first post) is much simpler than manually changing the player Icon. For NPCs, monsters, if you carefully limit how far they can wander by fencing them in with tiles not passable to them (but passable to the player), you could give some of them terrain-specific backgrounds for their sprites that matches their stomping grounds.

Chris H
Posts: 272
Joined: Sun Dec 02, 2007 4:07 pm
Location: California, USA

Post by Chris H »

I've toyed with the idea of transparency, but it would end up being extremely processor-intensive to loop through and render tiles pixel by pixel (instead of just being able to copy a tile straight to video memory.)

I don't think people mind the black box during actual play. It only drives us nuts at the beginning of game design when all we have are graphics. As it actually becomes playable, these details start to become much less significant.

Some other possible solutions:

1. Try a background color other than black -- I remember the C64 version of Ultima 2 used a green background for all tiles, which seemed to work well.

Image

2. Use a border around tiles for people or items, and/or give those tiles a color other than black, like Civilization 1:

Image

GB

black spaces

Post by GB »

I personally favor using black as your normal background space color. Though the screenshots you were asking about show the limitations of that method.

I really like the Ultima tile set, though I never played any of the Ultima games, but the one problem I have with it is the extensive use of the brick floor tiles, especially as backgrounds to tables, objects & etc. I would seriously consider editing those graphic tiles to have a black, or else a generally much darker background.

The history tile set suffers from the same problem, but to a much lesser degree. The brick floor it uses, being comprised mostly of black with dotted brick outlines makes the character's borders much less obtrusive.

Another very good solution is that shown in the last area of the new demo adventure, which has characters with a grey background against mostly grey tiles.

All of the good solutions have this in common: They rely on a neutral color, grey or black, which is dominant in all background spaces.

What I mean is probably best contrasted with the yellow desert approach of your game. If you followed the convention of the history tile set, by representing the desert with a tile that was mostly black, with only a few yellow dots the characters would blend in much better.

I don't blame you if you don't like that, but I think it beats setting them off so strongly with black boxes.
What might work better for you, is using grey as the dominant background color. Set character backgrounds to gray and symbolize the desert with dots of yellow and orange. Not the most strongly saturated or the brightest yellow either. Symbolize roads with gray dotted with darker gray, and maybe some slightly lighter gray, some black and some low-saturation, neutrally toned blue. Symbolize grass, if you have any, with gray with dots of green and brown. etc.
Though considering how much work that might be, I think I'd prefer to start with a set that uses mostly black, and modify it to use more black more consistently.

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Post by Garth's Equipment Shop »

jjsonick wrote:D'oh - of course using the Icon feature for terrain objects (as you mentioned in your first post) is much simpler than manually changing the player Icon. For NPCs, monsters, if you carefully limit how far they can wander by fencing them in with tiles not passable to them (but passable to the player), you could give some of them terrain-specific backgrounds for their sprites that matches their stomping grounds.
Could you tell me more about this Icon feature your talking about? Also how would I go about changing the PC's icon? I am guessing the easiest method from a designer's perspective for changing the PC icon would be to keep terrain separated into different rooms so that it is a simple matter of changing the PC tile each time it is entering a new room. Does the macro script language have a method for keeping a record of the room the PC is in and storing that in a variable which can be checked in an endless loop or the general game routine and execute a PC icon change when the variable changes? Are there arrays or vectors in this language which could be used to match up certain rooms with certain PC tiles?
Which of you is interested in my fine wares?

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Re: Transparencies for sprites?

Post by Garth's Equipment Shop »

Biffsnot wrote:Any way to keep the black box of death from surrounding all your sprites? Besides the Icon setting I mean, as that only affects your player char, and not any npc's. Any idea's appreciated! :mrgreen:
Actually the PC is your only real concern here as you can create different NPCs for different areas and thus their backgrounds can always be made to match wherever their home is going to be. It is only the PC icon that needs to look good on every background. So if this Icon thingy your referring to really works I'd like to know how to do it!
Which of you is interested in my fine wares?

Chris H
Posts: 272
Joined: Sun Dec 02, 2007 4:07 pm
Location: California, USA

Post by Chris H »

The "icon thingy" is for any terrain where you want anything that passes on it to look different while it's there. For example, a chair:

Image

The "icon" setting is what you change there with the "I" key, and shows a chair with a person in it. This will change the appearance of anything that steps there -- PC or NPC.

I'm continuing to ruminate over the idea of transparency. It would be an easier problem to tackle than adding more tiles, certainly. I may be able to add it just for creatures (and the player) -- doing it for items might be tougher.

I want to finish my Ultima parody first of course, but I'll keep this in the back of my mind. It may require cranking up the cycles on the DosBox window, which will raise the PC requirements accordingly -- and areas with lots of creatures might bog down a little.

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Post by Garth's Equipment Shop »

That would be awesome Chris! But like I said the PC icon is the only thing that really needs it since it is the only icon that switches from place to another and travels over all backgrounds. NPCs generally stay in one area even if they move around. So it is easy enough to create an appropriate background for them included in their icon even if just a solid color.

If it would be easier for you perhaps you could impliment an easy way for the designer to assign different character icons depending on the room, area or level it is located in. That way it would be as simple as having several different colored solid backgrounds to go with each area's dominant background color and then we can just paste our char icon on to each solid background in an external paint prog and import them. On the other hand transparency would be even cooler. But beggars can't be choosers right? ;)
Which of you is interested in my fine wares?

Chris H
Posts: 272
Joined: Sun Dec 02, 2007 4:07 pm
Location: California, USA

Post by Chris H »

Yes, you could set a step macro, have it look at what object type the player is standing on, and have it set the icon accordingly:

1: MAPCHK LOC[X] LOC[Y] Z
2: SET ICON=10 // in case nothing below matches
2: IF Z=21 THEN
3: SET ICON=30
4: IF Z=28 THEN
5: SET ICON=31

etc. But that seems like a lot of work (and a lot of tiles).

In the tile editor, it's easy to merge two tiles together for this, by the way -- you can copy one tile to the clipboard, and then paste it pixel by pixel onto another one. (That's how I did the brick floor behind the chair)

And again, when I finish the project I'm on now, I'll look into transparency. The more I think about it, the more I think it might be feasible for at least creatures and the player icon -- and maybe items too.

Chris H
Posts: 272
Joined: Sun Dec 02, 2007 4:07 pm
Location: California, USA

Post by Chris H »

Just an update on this -- I'm currently working on trying to implement transparency.

I think I've got something that will "work" (well, it compiled, anyway -- I'll test it tonight) but my fear is that it will be very slow. (Copying a block of tile memory to screen memory is very fast, while having to do pixel-by-pixel operations is very slow.) It may be that the DosBox "Cycles" (speed) will have to be cranked up quite a bit for it to be playable with this feature.

Having said that, it looks like it should be possible, at least for creatures and the player. (items will be a little trickier) Terrain won't be transparent, since it can't stack on worldmaps anyway -- so to make floor show under the chair, you'll still have to draw it in.

If it ends up working, I'll leave it as an option -- by default it's off, but if you want to use it, go for it. To turn it on, you'll go to the tile editor and choose the color to use for the "mask" color -- anywhere on the tile where that color appears, it's treated as transparent.

Stay tuned, I should have some results tonight.

Chris H
Posts: 272
Joined: Sun Dec 02, 2007 4:07 pm
Location: California, USA

Post by Chris H »

Image Good news, everyone!

Early results are encouraging: Here's an enlargement of a shot from the Tutorial adventure. Transparency is working fine around the player and around the two rats. (Animation still works)

Image



Here's how the rats look in the tile editor (note the purple masking indicating the transparent area -- you can of course pick whatever color you want, ideally some absurd color that none of your creatures would otherwise use)

Image



I need to implement this for room maps too (the two map types use separate code for most stuff), then I'll go back and see if I can do something for items too. The performance hit isn't very noticable with just three transparent tiles on the screen, it remains to be seen how it handles more...

Chris H
Posts: 272
Joined: Sun Dec 02, 2007 4:07 pm
Location: California, USA

Post by Chris H »

Well, that worked out pretty well.

Okay, it's now working for creatures AND items, AND it handles stacks in a reasonable fashion: if there's a stack of several items, it shows the top item and the base terrain under it -- it doesn't attempt to render the entire stack.

Tip: If you're going to use transparency -- which is by no means required -- make sure everything is on *some* kind of terrain. If you put items and creatures onto blank map, then you'll see the transparency mask.

As for what color to use -- you can certainly do it like I did, pick some freaky color and declare that as the mask color. It might be less work, though, to just pick whatever your usual background color is, for example black, and call that "transparent" for items/creatures. Then whereever you want actual black pixels on those things, just draw the darkest almost-gray in your palette.

So, the only part I need to do is clean up the UI in the tile editor a little, and then add proper handling for "darkened" tiles (they currently still ignore transparency).

Oh -- I'm not going to add transparency to the map editor. :) The effect will only happen during play.

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Post by Garth's Equipment Shop »

Oh my freaking GOD! CHRIS IS THE MAN! YES!!!! YES!!!! THANK YOU THANK YOU THANK YOU!!!!!!!!!!!!!!!!

Well that pretty much settles it then. I do believe we have an official winner for all time best classic/retro CRPG Util-kit EVER. ACK is IT! ACK RULEZ!!!!

Hmm... now all we need is the ability to have a different PC/NPC/MON icon show for attacks like in the combat of the old Gold Box games.

Hey Chris, any room on board the ACK dev team? If so , it would be a true honor and a privilege to contribute in any way I can. I can test new things before they are released, submit ideas for impovement, contribute art and useful utilities, and perhaps even experiment with a little bit of coding of my own. What do you think?
Which of you is interested in my fine wares?

Chris H
Posts: 272
Joined: Sun Dec 02, 2007 4:07 pm
Location: California, USA

Post by Chris H »

Just hammer away at the new features, let me know if you find any situations where they don't work as advertised. And create game content! To date I don't think there are any "complete" adventures out there yet. I think at this point, it needs games more than it needs additional features. :)

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Post by Garth's Equipment Shop »

Oh just don't you worry about that my friend! :mrgreen:
Which of you is interested in my fine wares?

Post Reply