Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (525)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  RPG-style Skin Handling  (Read 1979 times)
0 Members and 1 Guest are viewing this topic.
Offline ZaBlanc

Senior Newbie





« Posted 2005-04-15 01:32:40 »

In designing the crappiest RPG ever, I'm starting to think about how to handle the skinning system.  For example:

You enter a room with 15 people there.  They all have different permutations of pants (red, green, blue, polka dot) and shirts (Plaid, I'm With Stupid, Slipknot).

The question is, how best to handle and draw the characters.  Some issues:

1) Are all the possible paints and shirts already loaded into memory at startup?

2) Are the necessary pants and shirts loaded on an as/needed basis...such as, when a new type walks into the room?

3) Are the sprite objects for each character created to reflect the permutation, or is the pant/shirt/ead drawing all done individually per frame?

4) How does one handle palette shifting?  If a player's skin color is configurable, should that be drawn dynamically each frame, or as above, cached into the sprite?


My spidey-sense suggests that the sprites should be constructed for each unique look, then linked to each character that matches it.  Memory would be loaded/unloaded on an as/need basis.  Resources would be JAR-local, so it shouldn't be too much of a lag issue.

Anybody know of any tutorials on this aspect of the online world?  There's enough tile-based stuff out there that I've gone through. ;-)
Offline Jeff

JGO Coder




Got any cats?


« Reply #1 - Posted 2005-04-17 05:09:04 »

Is this a 2D or a 3D game?  

The techniques are very different.  2D games typically use "paper dolls". 3D games swap geometries and textures.

As for asset management, thats really an individual game choice.  There are tardeoofs that have to be considered with whichever way you chose to go.

Tell us a bit mreo about the project and we can probably be of more help.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline ZaBlanc

Senior Newbie





« Reply #2 - Posted 2005-04-18 01:13:52 »

Interesting.

The game is 2D.  Think classic Ultima stuff...nothing fancy.  There will be the standard variet of starter pant and shirt styles.  There will also be a selected skin color.

Over the course of the game, players can acquire new duds.  The problem hits when you have 30, 40, 50 people in a room...and drawing operations must be streamline while taking into account all the possible outfit pieces and the combinations players have them in.

Not sure what more I can explain than that...let me know.

The "paper doll" thing sounds interesting...can you elabortate?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jeff

JGO Coder




Got any cats?


« Reply #3 - Posted 2005-04-18 04:29:01 »

Sure, ever had a paper doll?

Basically the clothing is keyed with a "layer" numbre and drawn in layer order.  First the base character (who may have "molde on underwear" if you don't want peoep lto be able to strip to totally nude.  Many games do this for ratings reasons. as well as preventing in game streakers.)  Next under-garments, then pants/shirt, then robe/coat, then cloak, etc.

TYpically 2D games store 6 or 8 viewing angles for a character.  Soe acha rticle of clothing is really 6 or 8 images.  One is chosen to be overlayed in the right order dependign on the orientation of the charcter.

That all make sense?

Modern 2D games generally avoid trying to re-color thinsg in real time.  A LONG time ago when memory was limited and graphcis was all doen through color look up tables (CLUTs) games would reserve parts of the pallete for thionsg like "main character pants" and change them through CLUT manipulation.  Given the numerb fo characters onscreen at ocne in a MM game though thsi wpouldnt be terribly practical and besides, you can get better looking images through pre-rendered assets.

WIth the amoutn of main memory in a modern computer, Id preload all the 2D art into main-memory unless you intend to have an outrageously enormous selection. if you DO then you lneed to get a bit fancier and have a on-the-fly laoding scheme. here's a simpe, example:

On entering a "room":

(a) pre-load all the art for characters that are in the room at then moment.  This may include jsu twhat theya re currently wearing or everythign they have in ventory.  (The altter wil lavoid delays when they change clothing.)

(b) When a new character enters, add all the art for that character.  

(c) when new obejcts are egernated  ij the room, have the clinets load the art for that object.

(d) flush it all on room chnage.

HOWEVER Java actually gives you soem nice tools that can add some sophistication to this. Using SoftReference and a hash table you can easily add a memory sensative LRU cache layer to all this and speed up transitions between rooms by avoiding unecssary unload and reload of image data.  

I routinely use this caching technique  for all the image laoding i do in ANY image based app.  Yo ucan see it in the code for JNWN, look at the implementaion of ImageFactory i believe ( thats from memory).



Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline ZaBlanc

Senior Newbie





« Reply #4 - Posted 2005-04-18 11:26:58 »

OK cool, I'm getting the paper doll metaphor.  That totally solves my problem of how to implement skin color.

One more question, I still can't tell if you're insinuating that the complete character sprite model should be generated in advance, or if you should draw the character "paper doll style" each frame?

Thanks so much!
Offline Jeff

JGO Coder




Got any cats?


« Reply #5 - Posted 2005-04-18 16:33:54 »

Pre generate the layered peices.  Draw the paper-doll layers at run-time.  Pre-calculating all the possible combinatiosn would blow out the art you need exponentially.

As an rednerefficiency tuning thing you can build the layers up on the fly once and then store that combined image to use over and over until the player changes "clothes".  Thats a memory v. CPU trade-off thing which is typical of game programming.  

I wouldn't do that until you find you really need the speed improvement (eg profiling and tuning phase) but you want to leave your draw pipeline modular enough so its possible.

Does that help?

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (67 views)
2014-11-26 15:22:04

toopeicgaming1999 (58 views)
2014-11-26 15:20:36

toopeicgaming1999 (12 views)
2014-11-26 15:20:08

SHC (25 views)
2014-11-25 12:00:59

SHC (24 views)
2014-11-25 11:53:45

Norakomi (30 views)
2014-11-25 11:26:43

Gibbo3771 (24 views)
2014-11-24 19:59:16

trollwarrior1 (37 views)
2014-11-22 12:13:56

xFryIx (76 views)
2014-11-13 12:34:49

digdugdiggy (53 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!