Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Armor shows on character

Xyphien

Owner
Staff member
Administrator
Resource Team
Xy$
9.57
Could someone make a plugin that allows your character in game to show what armor he/she's wearing. So, if they put on regular armor, that armor shows up. If they put on a hat, the hat shows while they walk around, etc.
 

eivl

Local Hero
Xy$
0.00
Hmm..... how would this actual work?
Item need to be enabled as wearable in some way, via note tag maybe.

But how would you know where to draw the item. a hat will be placed a different way then a red cape.
Maybe you would need to have special custom graphics for these items. Like actor1_5.png, but only with the item in question.
Then on movement update, in and out of combat you would need to update the battlers.

Well.... anyone else have any ideas?
@Tsukihime do you have any thoughts on this?
[doublepost=1446034349,1446026106][/doublepost]http://pastebin.com/rFegMPMZ

Have a look and see what you can do with it.
I can contact the author and ask if i can modify it to your needs.
 

Tsukihime

Praised Adventurer
Xy$
0.00
I was going to post the link to the Graphic Changer plugin as well lol
But I'm assuming if they change armor and hats, and both were separate things, then you would need a new graphic for that. And for every combination of equips, you will need new graphics for those. Now how fast do factorials grow?

I have a plugin in mind called "composite characters" which should be much more powerful.

It is basically a character generator, in-game, that runs automatically depending on what you're wearing, what your state is, your class, and so on.

If you think about how the character generator works, all of the different pieces are set up appropriately based on a given template. You could then mix and match pieces with the correct layering to get your final sprite.

I wrote an article about it once
http://himeworks.com/2014/11/designing-a-script-for-composite-character-sprites/

It describes things like how you would set it up in your database, some of the details, and so on.
 

Tsukihime

Praised Adventurer
Xy$
0.00
Excellent post, do you need any assistance with this project?
There's one thing that I haven't completely thought through yet, and it's related to optimization.

For example, you're wearing a hat right now. And you walk around for a few minutes. The game will need to know that it should draw the sprite with the hat.

However, then you take off your hat. Now the game needs to know to take off your hat.

In all of these scenarios, it would be terrible if you were to redraw the sprite at every frame.
Any thoughts on how you would optimize that?
 

eivl

Local Hero
Xy$
0.00
Would need to cache the sprites.
First thought is to use PIXI.RenderTexture. This allows for any pixi display object to be rendered to a texture instead of the screen. Sprite Caching should then possible.
 

Tsukihime

Praised Adventurer
Xy$
0.00
I'm thinking of caching textures and then having sprites pick up the textures.
Would there be some advantage to caching entire sprites?
 
paper dolling might be possible in MV if you can find the info on how the generator knows where exactly to post its graphical changes to the chars it makes it wouldnt be to hard to find this info , but implementing it is def going to be more so of a advanced scripter know how though .. def beyond my knowledge
 

eivl

Local Hero
Xy$
0.00
I'm thinking of caching textures and then having sprites pick up the textures.
Would there be some advantage to caching entire sprites?
well.. that was what i meant, i might have my termology mixed up.
[doublepost=1446068142,1446068105][/doublepost];)
 

Tsukihime

Praised Adventurer
Xy$
0.00
well.. that was what i meant, i might have my termology mixed up.
[doublepost=1446068142,1446068105][/doublepost];)
I'm just worried about what happens if you change outfits too many times and you run into memory issues lol
But I'm assuming the game will take care of it...
 

eivl

Local Hero
Xy$
0.00
The JavaScript engine handles garbage collection so that is no big problem. But you should always delete big objects if you do not need them.
Event handling can cause memory leaks, but as long as you are careful it should not be a problem.
Since every Actor needs to be generated there has to be a 3 step process.
1. the current object
2. a temp object, build from scratch by a template and only called when you change gear
3. the new object

copy the new object to current, set temp and new to null, and there no memory leaks.
I might not know a lot about drawing, but fixing memory leaks in enterprise scale applications, that is my main job ;)

how we construct the object, i am not sure..
Maybe something like a stacked template where you divide between changeable and unchangeable information
<base actor> // nude model, will never change
<hair 1>
<hair 2>
..... //more unchangeable
<Clothing> // changeable
<Cloak> // changeable
<Accessory 1> // changeable
<Accessory 2> // changeable
</>

and since you make your character from scratch in game, the unchangeable parts will always be known.
Changing gear should not impact anything, it is how the creation of the current object that will be the most costly process, i am guessing now that working with graphics rendered to memory is just as easy as working with a actual sprite file, the rest should give no impact on performance.
 

Tsukihime

Praised Adventurer
Xy$
0.00
The JavaScript engine handles garbage collection so that is no big problem. But you should always delete big objects if you do not need them.
I did notice while I was looking at the sprite classes that there were no dispose/destroy methods, so I assumed it's not an issue anymore unlike in previous versions where not disposing it would 100% result in memory leaks.

I tend to rely on GC to handle things as well.

I might not know a lot about drawing, but fixing memory leaks in enterprise scale applications, that is my main job
Actually this other problem might be of interest for you then: http://www.rpgmakermv.co/threads/is-caching-a-memory-leak.610/
Which would impact any plugin that requires intensive image loading use.

how we construct the object, i am not sure..
Maybe something like a stacked template where you divide between changeable and unchangeable information
I'm thinking of it as a set of layers, similar to what you have thought

Base layer
Layer 2
Layer 3
...

Each layer would have separate properties (hue, opacity, etc) so you could take advantage of the drawing library instead of preparing different colors beforehand.

I am not completely sure yet, but I may assume the actor's character graphic will be the base layer, and everything else will build on it.

Anyways, so users would specify all of these layer properties themselves when they are setting up their project, and the engine would take this information and build their composite sprites based on that input.

Rather than hardcoding layers (eg: pants go above shirt, socks go below pants), I will leave the base implementation completely free and leave it up to the user to figure out how to order their layers. I may then provide a separate add-on plugin that will provide users with hardcoded setups so that they don't need to figure that part out (eg: the stack you showed)

Changing gear should not impact anything, it is how the creation of the current object that will be the most costly process, i am guessing now that working with graphics rendered to memory is just as easy as working with a actual sprite file, the rest should give no impact on performance.
Hopefully the bitmap copying process will be fast!
 

eivl

Local Hero
Xy$
0.00
The easiest way to do this is simply just to make a sprite for each armour - not including helmets, accessories, etc. Just the clothes found in the gen, but with additional clothes.
This is true, but it will not work as intended. The script you linked is a good starting point, but what if you want to only change the color of the cloak?
The change face or graphic on state are very nice, i will work on this when my other projects are done.. looking forward to getting more time to program this weekend. ;)
[doublepost=1446535552,1446535516][/doublepost]
Btw, I'm not sure when I will get to this so anyone can feel free to provide their own solutions
Sure thing, i will continue this!
[doublepost=1449234568][/doublepost]you might find this interesting : http://www.rpgmakermv.co/xfa-blog-entry/change-armor-and-stuff.28/
 
I was going to post the link to the Graphic Changer plugin as well lol
But I'm assuming if they change armor and hats, and both were separate things, then you would need a new graphic for that. And for every combination of equips, you will need new graphics for those. Now how fast do factorials grow?

I have a plugin in mind called "composite characters" which should be much more powerful.

It is basically a character generator, in-game, that runs automatically depending on what you're wearing, what your state is, your class, and so on.

If you think about how the character generator works, all of the different pieces are set up appropriately based on a given template. You could then mix and match pieces with the correct layering to get your final sprite.

I wrote an article about it once
http://himeworks.com/2014/11/designing-a-script-for-composite-character-sprites/

It describes things like how you would set it up in your database, some of the details, and so on.
First I love your plugins! Second is there a way to contact you? I wanna have a conversation with you and third I was also wondering if there was a plugin for sprite images that basically place the image on top of the current gear item for example; your base sprite is the character you made without clothes and then for armor when you put a piece of armor on a chest and leg piece of armor will be put on top of the base character in underwear so the base sprite looks like it has the armor on and things like shoulder pieces are pasted onto of the chest piece but only cover the area around the shoulders and the belt is covering the pants but only at the top of the leg item. Things can be placed in order depending on the gear they have for example if you put a cape on it will go over the back of the chest piece and under the shoulder pads or what ever order you chose to make the priority armor on it will be on top and less priority will be on bottom so you do not need a combination of each picture but instead a base sprite that changes with the gear you have and if you can make it to where when you can make a slot for weapons to go over all the gear as weapons are normally on all the armor when sheathed like IRL and most RPG games like WoW and such the item sprites for armor and weapons will be much easier and versatile so there can be combinations made for even more things than just gear.
 
Top