How to add more player character models

From Platinum Arts Sandbox Free 3D Game Maker
Revision as of 13:49, 3 June 2012 by Chocolatepie33 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  • Before doing this tutorial, you need to understand how to use Code::Blocks to compile Sandbox. To do so, read the Compiling the source code tutorial first.
  • To start: Open up main/src/fpsgame/render.cpp. Scroll down a little bit, and you should find a list that looks like this:

    static const playermodelinfo playermodels[8] =
   {
       { "rc", "rc/blue", "rc/red", NULL, NULL, NULL, { NULL, NULL, NULL }, "rc", "rc_blue", "rc_red", true },
       { "rc/blue", "rc/blue", "rc/red", NULL, NULL, NULL, { NULL, NULL, NULL }, "rc_blue", "rc_blue", "rc_red", true },
       { "rc/red", "rc/blue", "rc/red", NULL, NULL, NULL, { NULL, NULL, NULL }, "rc_red", "rc_blue", "rc_red", true },
       { "rc/pink", "rc/blue", "rc/red", NULL, NULL, NULL, { NULL, NULL, NULL }, "rc_pink", "rc_blue", "rc_red", true },
       { "ogre", "ogre/blue", "ogre/red", NULL, NULL, NULL, { NULL, NULL, NULL }, "ogre", "ogre", "ogre", false },
       { "ogre/blue", "ogre/blue", "ogre/red", NULL, NULL, NULL, { NULL, NULL, NULL }, "ogre", "ogre", "ogre", false },
       { "ogre/red", "ogre/blue", "ogre/red", NULL, NULL, NULL, { NULL, NULL, NULL }, "ogre", "ogre", "ogre", false },
       { "uh/chars/man", "uh/chars/man", "uh/chars/man", NULL, NULL, NULL, { NULL, NULL, NULL }, "uh/chars/man", "uh/chars/man", "uh/chars/man", false }
   };

  • This is the code which loads all of the playermodels.
  • The first part, the "static const" is an array which holds all of the playermodel data. In the original code, there are 8 playermodels, (4 rcs, 3 ogres and the human), and that's within the brackets.
  • To add a playermodel, simply change the bracket number to 9 (or add however many playermodels you're adding), then add a line below the uh/chars/man line.
  • The first part is the path of the model in quotes. I don't know about the next few parts, it's possible they may be failsafe, or backup options in case the original fails. Just copy and paste the NULL area, as it appears to be the same throughout the code lines.
  • The last three lines are the icon names which are shown when the player dies. Like the model loading section, these come in a primary value followed by possible backup values. I'm not sure about the true and false values, it may be whether the playermodel has all the animations ready (e.g. the RC has a swim animation whereas the ogre doesn't). Once you have your new models added, recompile via build, then run. Test within Sandbox.