Interchangeable Clothing

Started by Frinkky, Sun 13/07/2008 15:47:32

Previous topic - Next topic

Frinkky

Hi guys and gals,

I've had an idea for a rpg(ish) game running through my head for a couple years now and, not being a c++ whizz I'm using AGS to create a proof of concept to hopefully generate interest at a later date. I will post the project when I have something more tangible but for now I'm testing out various concepts and elements.

One thing I'm interested in deploying is to have interchangeable clothing, i.e. I can find or create a new shirt and wish to 'wear' it. the obvious, but least efficient, method I can think of is to create sprites for each clothing combination and swap out the player sprite on equipping the new clothing item but I feel this would limit the total amount of clothes. So I guess my main question is - is it possible to layer sprites on top of each other for the player character so I'd only need to create one set of sprites for the character, and one set for each item of clothing? Or perhaps there's another way I'm not thinking of right now?

I've attached an example of what I mean.



Khris

You can use global DynamicSprites to store the player character frames, redraw them freely in-game (e.g. by combining a nude sprite & clothing), then assign them to the ViewFrames of the player.
So yes, definitely possible.

I'm not sure about how useful this is though; you can import tons of sprites, have hundreds of characters & views, so there wouldn't be any limits doing it by simply switching views.
I doubt using the on-the-fly method will save much memory either.

Baro

Yeah, doing a lot of views would save a lot of memory, considering the huge amount of sprites you can import. You could create global variables for each type of cloth (torso, helmet, pants, etc) for each character that will change clothes and then call a function to update clothes every time you update the variables. Then that function would change the views depending on each combination of clothes the character should wear.

----------------

Also, there's the character.followcharacter function. I still haven't seen it in action, so I dunno if it would look well, but it theoretically looks like it would do the trick, passing FOLLOW_EXACTLY as the distance and 0 as the eagerness.

Quote from: help fileThere is also another special use for this command. You can pass the special value FOLLOW_EXACTLY as the DIST parameter rather than passing a number. If you do this, then CHARID will always remain at exactly the same X and Y co-ordinates as CHARTOFOLLOW. This might be useful for effects such as a temporary halo over the character and so forth.

If you use FOLLOW_EXACTLY, then EAGERNESS has another meaning. If you pass 0, CHARID will be drawn in front of CHARTOFOLLOW; if you pass 1, it will be drawn behind.
So making non-clickable characters using the clothes' sprites and make them follow the character that wears it would do it. You would need as many characters for each cloth as characters that can wear it.
This would also allow you to make walking views for each cloth and so.

I dunno if FOLLOW_EXACTLY makes the following character look the same direction as the character it follows, but some facecharacter in the repeatedly_execute section would do the fix.

Frinkky

Thanks for both replies - I've got plenty of time so I think I'll try all three and see which is the most efficient.

My only concern with creating views for all clothing combo's is that even with just 2 clothing items (pants and shirt) with, say 8 varieties each, thats 81 different views (8 pants varieties + 1 nude * 8 shirt varieties + 1 nude). And thats just for one direction - so multiply that by 8 directions, allowing all possible combinations (nude top + pants 3 or shirt 1 + pants 8 etc). So 648 views at 31 frames per view (30 + 1 standing) thats 21204 frames not to mention the idle and different action views. Phew!

Might be ok if i just go with complete outfits and not individual items. I'm definitely intrigued by the FOLLOW route - one thing that immediately springs to ind is whether or not the z-index of sprites can be controlled, but I still need to finish reading the manual so I'll work that out when I get to it.

Thanks again!


Ghost

#4
I wouldn't use the FOLLOW command because it can be "off sync" easily, and in a high-res game it will defenitely happen. This will result in the clothes skipping away from the body, and that is bound to look weird.

The command is really meant to allow real characters follow you; but you could, of course, have a non-clickable GUI displaying the clothes, setting their x/y in repeatedly execute. This will result in a speed drop maybe, but should still prove a more reliable method.

AJA

Quote from: Ghost on Mon 14/07/2008 00:21:50
I wouldn't use the FOLLOW command because it can be "off sync" easily, and in a high-res game it will defenitely happen. This will result in the clothes skipping away from the body, and that is bound to look weird.

I didn't have any sync problems with it in my orow game "How many...", in which the player character is composed of other characters (limbs). I think using FOLLOW_EXACTLY is the easiest way to achieve something like this. At first, I was thinking of trying to take the dynamic sprite approach to the problem and make a module out of it, but since I only had a week to make the game I decided to go for the easy way.


Quote from: Baro on Sun 13/07/2008 19:53:35I dunno if FOLLOW_EXACTLY makes the following character look the same direction as the character it follows, but some facecharacter in the repeatedly_execute section would do the fix.

I don't really remember but I did manually update frames and loops in the repeatedly_execute_always function to match them with the character's loop and frame. It shouldn't be that big of a problem. Also, I took a shortcut and made every loop the same length even if there was no animation for a specific limb so that I wouldn't have to check how many frames there are in a loop in the scipt.

SMF spam blocked by CleanTalk