Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 100587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:36:29+00:00 2026-05-11T00:36:29+00:00

How can I have that functionality in my game through which the players can

  • 0

How can I have that functionality in my game through which the players can change their hairstyle, look, style of clothes, etc., and so whenever they wear a different item of clothing their avatar is updated with it.

Should I:

  • Have my designer create all possible combinations of armor, hairstyles, and faces as sprites (this could be a lot of work).

  • When the player chooses what they should look like during their introduction to the game, my code would automatically create this sprite, and all possible combinations of headgear/armor with that sprite. Then each time they select some different armor, the sprite for that armor/look combination is loaded.

  • Is it possible to have a character’s sprite divided into components, like face, shirt, jeans, shoes, and have the pixel dimensions of each of these. Then whenever the player changes his helmet, for example, we use the pixel dimensions to put the helmet image in place of where its face image would normally be. (I’m using Java to build this game)

  • Is this not possible in 2D and I should use 3D for this?

  • Any other method?

Please advise.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T00:36:29+00:00Added an answer on May 11, 2026 at 12:36 am

    3D will not be necessary for this, but the painter algorithm that is common in the 3D world might IMHO save you some work:

    The painter algorithm works by drawing the most distant objects first, then overdrawing with objects closer to the camera. In your case, it would boild down to generating the buffer for your sprite, drawing it onto the buffer, finding the next dependant sprite-part (i.e. armour or whatnot), drawing that, finding the next dependant sprite-part (i.e. a special sign that’s on the armour), and so on. When there are no more dependant parts, you paint the full generated sprite on to the display the user sees.

    The combinated parts should have an alpha channel (RGBA instead of RGB) so that you will only combine parts that have an alpha value set to a value of your choice. If you cannot do that for whatever reason, just stick with one RGB combination that you will treat as transparent.

    Using 3D might make combining the parts easier for you, and you’d not even have to use an offscreen buffer or write the pixel combinating code. The flip-side is that you need to learn a little 3D if you don’t know it already. 🙂

    Edit to answer comment:

    The combination part would work somewhat like this (in C++, Java will be pretty similar – please note that I did not run the code below through a compiler):

    //  // @param dependant_textures is a vector of textures where  // texture n+1 depends on texture n.  // @param combimed_tex is the output of all textures combined void Sprite::combineTextures (vector<Texture> const& dependant_textures,                                Texture& combined_tex) {    vector< Texture >::iterator iter = dependant_textures.begin();    combined_tex = *iter;     if (dependant_textures.size() > 1)      for (iter++; iter != dependant_textures.end(); iter++) {         Texture& current_tex = *iter;          // Go through each pixel, painting:         for (unsigned char pixel_index = 0;               pixel_index < current_tex.numPixels(); pixel_index++) {            // Assuming that Texture had a method to export the raw pixel data            // as an array of chars - to illustrate, check Alpha value:            int const BYTESPERPIXEL = 4; // RGBA            if (!current_tex.getRawData()[pixel_index * BYTESPERPIXEL + 3])                for (int copied_bytes = 0; copied_bytes < 3; copied_bytes++)               {                 int index = pixel_index * BYTESPERPIXEL + copied_bytes;                 combined_tex.getRawData()[index] =                     current_tex.getRawData()[index];               }                        }      } } 

    To answer your question for a 3D solution, you would simply draw rectangles with their respective textures (that would have an alpha channel) over each other. You would set the system up to display in an orthogonal mode (for OpenGL: gluOrtho2D()).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 58k
  • Answers 58k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Python isn't compiled in the same sense as C or… May 11, 2026 at 8:48 am
  • added an answer I know people are loathe to use them, but this… May 11, 2026 at 8:48 am
  • added an answer You want to stop event propagation, you do this in… May 11, 2026 at 8:48 am

Related Questions

No related questions found

Top Members

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.