Jump to content

Untested Character hair customization (+ basics for expansion)


Cheshire
Message added by jcsnider

Warning! There be dragons!: This mod introduces new field(s) into the games' databases. Database migrations are one-way upgrades. Make database backups before applying! If you later decide that you want to remove this mod you will likely have to restore from those backups or manually make dangerous edits to your database in order to get your game running again. 

Recommended Posts

Character hair customization (+ basics for expansion) 

 

Description:

This patch adds a few new features, some under the hood and some exposed through the editors, most notably:

  • Hairstyles rendered on the (configurable through server config.json) Helmet paperdoll layer if no paperdoll is used!
  • Compatible with the new entity animations in 6.2!
  • Configurable Hair selections per class (Check the class ediitor)
  • Event support for the Hair system
  • Prepared storage and communication between client/server for Custom Sprite Layers (to let people expand upon this system!)
  • Modified GUI to allow for selecting hairstyles on character creation.
  • Language additions for all additional editor functions.

 

How does it work exactly?

To save you the technical mumbojumbo; It will render a configured hairstyle (from the resources\hairs) folder as if it were a paperdoll item in the Helmet slot (by default, can be configured if you want to change your paperdoll slots around) should the player not have a helmet equipped. If they DO have a helmet equipped, the helmet paperdoll is rendered instead.

 

What do I mean by expanding upon it?

Well, it's pretty simple.. The storage and communication classes/methods have been adjusted to be able to retain as many entries for custom sprite layer data as you'd like to add. This can be found on the Player classes both client and server side (Player.CustomSpriteLayers), and the size of this array can be configured through an enum called CustomSpriteLayers.

 

Adding an additional entry to this array will NOT require you to add any additional database tables or columns, so expanding upon it will not cause you to have to adjust or migrate any databases beyond this basic install! 

Adding an additional entry to this array will NOT require you to add additional networking edits to pass this data along between server and client, as I've already taken care of this for this particular system.

 

You will however, of course need to create your own rendering mechanism if you wish to add anything beyond the provided hairstyle..!

 

WARNING(s):

  • There is a very distinct possibility that this may break compatibility with any other mod that edits the class editor and event editor!
  • Please backup your Game and Player databases before applying this modification, there is no going back after installing this if you want to remove it unless you edit your database manually!
  • This does not work with face rendering on the gui enabled! There's no face support in this at all. So enable that in the source at your own risk. 

 

Media:

 

GUI and In-game / Event Support:

63a56700aab9cae47bdd326fada61dac.gif

 

Animated player sprite support:

d97b41e6f25700191c1dabdec385f933.gif

 

Character Creation (Yes, I know it looks like the sprite selection arrows.. They are not):

c8acb9b00fa4ac6a048d6c89bec1ed7a.gif

 

Event Support:

a8fc00731f1704f767260e27fec5ed30.png

 

Class Editor Support:

7bd808995ed5a999d8bccccf1c6543f8.png

 

Git Patch:

 

6.1 Stable branch

Download (NOTE: This is an outdated version which does not contain some generalization adjustments. It does work and I provide bugfixes for it, but is harder to add new layers to)

 

Updates:

 

  1. Download - Fixes player hair not displaying correctly upon warping between maps.
  2. Download -  Fixes a crash in the class editor when swapping between genders without having a hair option selected. Also fixes minor visual issues in the class editor.
  3. Download - Fixes two editor crashes. One event editor crash relating to a missing None entry. One class editor crash where I referenced the wrong update method.

 

6.2 Development Branch

Download

 

Updates:

All updates are part of the patch file.

 

Changelog:

  • 04/04/2020 - Fixed an issue where your target EntityBox would display your own hair.
  • 05/04/2020 - Made the patch compatible with build 0.6.1.243b of Intersect and integrated previous fixes.
  • 09/04/2020 - Made the patch compatible with build 0.6.2.408 of intersect and made some methods in the Development build version more generic.
  • 14/04/2020 - Fixed an issue where player hair would not always display correctly after warping between maps.
  • 16/04/2020 - Made the Development patch compatbile with build 0.6.2.412 
  • 17/04/2020 - Fixed a crash in the class editor when swapping between genders without having a hair option selected. Also fixes minor visual issues in the class editor.
  • 18/04/2020 - Fixed two editor crashes. One event editor crash relating to a missing None entry. One class editor crash where I referenced the wrong update method.
  • 16/05/2020 - Updated for development build 0.6.2.419

 

Based On:

Build: 0.6.1.243b

Build: 0.6.2.419

 

It might work with other versions of Intersect, and it might not.

I'll try and keep it updated when something OFFICIAL breaks it however.

If I can't replicate the issue on a clean source pull with this applied, you're on your own.

 

Setup:

The following steps are REQUIRED before this will work properly!

  1. Download and install the main patch file for the branch you are using.
  2. Download and install any update patches IN THE ORDER THEY ARE LISTED for the branch you are using.
  3. Create a new folder called hairs in your editor and client resources folder. (Optionally fill them with hair sprites!)
  4. MAKE A BACKUP OF YOUR GAME AND PLAYER DATABASES, THE NEXT STEP IS NOT REVERSIBLE IF YOU WANT TO GO BACK.
  5. Compile and run the server, it should automatically prompt you to migrate the database to the new format.
  6. Start your editor, and get cracking with the new system!

 

Additionally, there are several new language entries in the editor strings files. These will be generated automatically upon opening the editor for translation purposes.

 

I highly suggest you also download the following CharacterCreationWindow.json file and replace your client\resources\gui\layouts\menu\CharacterCreationWindow.json file with it. This file includes edits to make the sprite select arrows appear lower and adds positioning for the hair select arrows above them!

 

The option "HairSlot": "Helmet" can be used in the server config.json to adjust which Paperdoll layer is replaced by the hair.

Link to comment
Share on other sites

Lol @ Crappy Hat, love this! Thanks for doing all the hard work and suffering the turmoils of the three different renderings of paperdolls for all of our benefit! I am also stuck on step 1 for a considerable time, but will be merging this with my project later to test! (Def replaces my in game way of selecting hair at start via npcs standing around with the select hairstyles)

 

Thank you!

Link to comment
Share on other sites

5 minutes ago, Lathander said:

Hmm. I'm getting a warning at the command line that there's the patch is corrupt on line 7354.

 

Strange, does it work?

If not could you try this link?   https://patch-diff.githubusercontent.com/raw/Chronos-92/Intersect-Engine/pull/4.patch

 

Using my husband's github as I'm on his laptop for the time being and normally I edit my own name in instead of his.

Maybe I copy/pasted something wrong.

Link to comment
Share on other sites

I think that version worked, I'm doing a three way merge to address any conflicts with my code h/o the 3 way merge said there were 227 lines with whitespace errors, whatever that means. I'll report back after I address any conflicts thanks for the quick reply!

Link to comment
Share on other sites

Well this is fantastic! Works like a charm! I really love that you can define certain hairstyles at the start/character creation under class, and then when you use the event you can have access to the entire folder. I was concerned that I'd have like 8 color variations to fly through for each hairstyle, but this way I can define it as just one color for each hairstyle to start. Very awesome work, I appreciate all the time that went into this! Definitely saved me a good chunk of head-bashing-on-keyboard and coffee lol.

 

I found that I also had an error from a previous feature I programmed that I thought I might have to address, and this made me realize I did have to address it. Which is good. I was waiting to install this patch before I adjusted frames. I doubled character/entity frames to 8 for potential death of npc/character casting, and noticed that it works on map but needs adjusting in Target Window / Profile Window / Login Screen etc.

 

EDIT: I recommend anyone applying this use git apply -3 changes.patch (replacing changes with your patch name) this allowed me to go in there and see conflicts. Maybe one of the more experienced guys can confirm/deny if this is a good method? JC? I just researched before applying because the apply check reported only a few issues.

Edited by Lathander
added in git apply -3 changes.patch info
Link to comment
Share on other sites

Good to know it worked!

 

Just to be safe I uploaded the unedited file I linked earlier and put that in the first post.

It may have been related to your own previous edits and some minor whitespace issues., but better safe than sorry right?

 

And yeah, I wanted the events to allow you to use ANY hairstyle, in case you wanted to hide cosmetics in the world or just allow for more options from say a shop after the fact.

Link to comment
Share on other sites

And I ope! Think I found a bug. I was viewing another players target and it shows my head-hair instead of their head-hair. >_> Don't think I made that bug..

 

OK so, correct me if I am wrong but:

 

Inside EntityBox this:

paperdoll = Globals.Me.CustomSpriteLayers[(int)Enums.CustomSpriteLayers.Hair];

Should be something like:

var player = (Player)MyEntity;
paperdoll = player.CustomSpriteLayers[(int)Enums.CustomSpriteLayers.Hair];

 

Link to comment
Share on other sites

20 minutes ago, Lathander said:

And I ope! Think I found a bug. I was viewing another players target and it shows my head-hair instead of their head-hair. >_> Don't think I made that bug..

 

Ah, I copy/pasted most of the logic for the character window and entitybox, but forgot to change one reference (the one that actually tells the thing which image to render!). :) Found the issue and fixed it.

 

Apply this update on top of the base install:

https://s3.us-east-2.amazonaws.com/ascensiongamedev/filehost/fa1a22b7c4e939b1d9eb0694929f4b13.patch

Link to comment
Share on other sites

Yeah that is the exact same thing, I just made it a oneliner. :P 

 

Thanks for letting me know though, I've updated the first post to include the update patch along with listing it as an installation step.

I had a way larger and more convoluted way of injecting the hair sprite at first, which had some bugs and changed into this last minute. Was too hasty to copy the solution over to this method and never changed every reference of Globals.Me to MyEntity. lol

Link to comment
Share on other sites

3 hours ago, jcsnider said:

@Joyce I may have broke this mod tonight, but I'm not sure. We had to make some tweaks to the logic for player rendering in the character window. 

 

See: #82

 

That along with Panda's change of ONE line (despite there being many more using the same check around it he didn't replace! ;) ) did indeed break it. Thanks for the heads up!

 

Here's the new patch for build 0.6.1.243

https://s3.us-east-2.amazonaws.com/ascensiongamedev/filehost/25d2f8bdf8838d68bf72657fdb12a1a4.patch

 

Note that this means ANY build before the above will NOT work with this patch anymore!

Link to comment
Share on other sites

1 hour ago, Atsuya said:

it doesnt work with last build with all frame animation right ? I can't add the patch.

This only works on the stable branch, if you want to add it to the experimental branch you're on your own. The first post mentioned the supported version being 6.1. :)

 

I'll update it to support the new animation frames feature once that becomes part of the stable release.

Link to comment
Share on other sites

1 hour ago, Joyce said:

Because I kept getting people asking me about this, I've made this patch compatible with the development branch:

 

d97b41e6f25700191c1dabdec385f933.gif

 

Please destroy your game for me so I can tell you to stop using that branch. Kthx. <3

 

Download

I love your patience to upgrade to the branch ♥

Thanks for that

Link to comment
Share on other sites

Hey Joyce--

 

I believe I just found a bug with the hair layer addin. I was coding a toggle for show/hide helm, and I kept thinking I was making an error and had to go back and change up my code a few times. Then I realized I should probably go back to a master install and attempt to see if the bug existed from the start and it looks like it does. I can record a gif/video if it helps, but it looks like upon immediate warping out of a map into another map the other character/client on that map shows up as bald/without hair. If I continue to walk with the player past the map line/connection their hair pops on like it should.

 

Edit: adding in gif

1fcd09d441b69d0e4389a7190ba928db.gif

 

I am guessing it has to do with what order things get loaded after a player exits a map into the other map, but I haven't had time to really test my theory. Can you try to recreate the same bug?

Link to comment
Share on other sites

9 hours ago, Lathander said:

Hey Joyce--

 

I believe I just found a bug with the hair layer addin. I was coding a toggle for show/hide helm, and I kept thinking I was making an error and had to go back and change up my code a few times. Then I realized I should probably go back to a master install and attempt to see if the bug existed from the start and it looks like it does. I can record a gif/video if it helps, but it looks like upon immediate warping out of a map into another map the other character/client on that map shows up as bald/without hair. If I continue to walk with the player past the map line/connection their hair pops on like it should.

 

Edit: adding in gif

1fcd09d441b69d0e4389a7190ba928db.gif

 

I am guessing it has to do with what order things get loaded after a player exits a map into the other map, but I haven't had time to really test my theory. Can you try to recreate the same bug?

 

This seems to be rather inconsistent for me, as sometimes it's loaded and sometimes it isn't.

I wonder if a similar issue exists with equipment paperdolls, as I'm basically sending my data at the same time as equipment paperdolls.

 

The code itself is run for me, every time. The server sends the data.

But it looks as if something is overwriting the client's information or they never receive it.

 

I'll have to look into that further.

Link to comment
Share on other sites

Yeah, its weird to say the least. I also think I noticed (maybe I am wrong) but the character executes an update and also the map executes an update on the same exact principal? Which to me, didn't make sense but I guess I didn't really check if they were one way directions of data updates (like exiting player on arrival to all clients, and map only to arriving character?) I didn't really scrub that hard because I became frustrated after 5 hours of thinking my code was wonky and rewriting it over and over. -frustration- lol

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...