Thanks for your help Raven, really appreciate it!
No worries
The main ways to separate assets and keep things modular are
Interfaces
Soft references
Blueprint inheritance
Thanks Ocean.
There’s one more thing tho.
I’ve asked GPT and he told me that somehow the direct references that impacts the size of bp_player (2.6gb as in the SS above) are those on the right in the size map (I am not talking about reference viewer). I’ve marked them (red) in this SS.
I’ve got rid of a lot of those but now I have somewhere around 2.2GB and nothing too much size-wise on the right.
Do you have any idea how can I find the references that takes up so much memory?
Thank you
The main hitters size wise are
AC_Inventory 1.4 gb
Ui_ItemSystem 1.4 gb
AC_CurrencySystem 1.4 gb
Ui_CurrencyDrop 1.4 gb
F_Equipment 1.1 gb
Ac_EquipmentHandler 1.1 gb
Bp_sharedfunctions 1.1 gb
Try checking these blueprints with the reference viewer.
You probably have these systems cross referencing each other causing bloat in all of them.
Check which one has the most hard references and try optimizing it with soft references.
Also whtly does the character contain a dungeon plate? Break with interdependency with an interface. Equipment like shields also shouldnt be hard referenced.
Have a component to handle equipment and spawn and occupy weak pointers as needed.
Yes, regarding the dungeon plate I simply placed in on the character to see something, I do have a lot of equipment which is handled by a component.
I’ve also completely removed the Ac_EquipmentHandler to see if the bp_player size drops and still nothing.
I will dive right now in what you’ve said here and come back with feedback.
Thank you
I thought soft refs just weren’t shown in the size map, apparently they’re grey? Can’t check right now.
There’s still a way to go. Because soft or not, your player needs to be lightweight ( well, everything does ). This means trying to remove any coupling between your player and other objects.
You seem to have done everything in the controller and then referenced it in the player.
If you talk to the controller with an interface ( rather than casting ), that will at least get it out of the character.
Adding to ClockWorkOcean’s suggestions to make the character lighter I would suggest looking into PrimaryDataAssets to drive any extra actors / mesh components that can interact with the actor (equipment, clothes etc). Keep them lightweight and build them at runtime through data instead of making multiple copies of variants.
OFC decouple them as well and interact through interfaces.
@ClockworkOcean @3dRaven Hey again guys.
So, Ocean, I’ve deleted the casts to my player controller inside bp_player to see if anything changes inside size map but nothing happens.
Also, I’ve tried to create lots of soft references and the size keeps getting lower and lower.
However, I don’t understand inside Size Map why does memory size went down from 2.3 to 1.9gb while the Disk Size went down only from 2.5 to 2.4.
Is the Memory Size the one that’s more important? Can I keep going like this?
Raven, I didn’t quite analyzed PrimaryDataAssets, I have no idea what they do, I do work with Data Tables if that makes any sense or it has absolutely nothing to do with primarydataassets.
Thank you.
Good first step. You should see no player controller in the character size map when you get it right.
So, to be clear, all the player controller stuff should look something like
Of course, you can have parameters and return values with interfaces.
Here is a good summary of the differences between datatables, structs and primary data assets.
Ofc the documentation also has a description.
Hey Ocean,
Do you have any idea why does the size map is not decreasing after deleting those player controller casts?
I think you left soft refs to the controller, right? Hence the light blue tinge.
I think the only way to get rid of it totally, is to talk to it with an interface.
Ok I will take a look into that, thank you.
Could you please tell me the ideal size bp_player should have? (memory_size)
So I can keep decreasing it up until that sweet spot.
Thank you.
Well, as we can see above, the standard player is 30MB
You do have a lot to do, I’m afraid, because once you get the controller out of the player, you still have the problem that the controller is huge ( and the equipment handler ).
You are moving into the next level of dev concepts, and there is a bit of ‘hump’ here…
Ook, so, If i understand this correctly I have to reduce the size for playercontroller itself, equipment handler itself and so on.
First of all I’ve noticed that the size map of equipment handler, player controller and maaany other blueprints it’s exactly the same as the bp_player’s.
As soon as I remove/create soft ref of anything inside the player, both playercontroller, equipment handler and the other blueprints decreases in size, which I think it’s a good thing… right?
So, that means that somehow they might communicate through something.
Anyways, I will 110% find how they communicate and reduce their size.
Thank you again.
That’s because the PC is in the player at the moment
The problem still remains that the controller will be loaded with the player ( it always is ), but you probably only need some things in the controller some of the time. Same with the handler. But you have it all loaded all the time.
Can you show me a size map on the PC and the handler separately?
Sure, I will also share the player’s one.
So, as you can see, I’ve reduced the size down to 845mb and counting (please do keep in mind that this is Memory Size)
Ok, interesting…
So the controller is out of the player :), that’s because you used an interface
I see the equipment handler features heavily in the controller. That might easy to remove? That will get the controller under wraps.
Actually, I didn’t create any interfaces.
Something it’s strange…
Regarding the removal of the equipment handler, I don’t really want to remove it since that’s how I am handling equipment (perhaps I can use an interface like you said)
I’ve looked into reference viewer inside PC and again… very strange thing that I do not see Equipment handler… I honestly don’t understand this.
Could this mean that PC communicates with equipment handler through a component or something like that?
I do still have the player’s controller under bp_player (marked with red in SS) but it’s size is 236.7MB.
However, if I click on size maps, directly onto PC, then it’s size is 812.3 (the same as the player’s).This is the second thing that I do not understsand.
Everything I did since my very first post was to create lots and lots of soft references only on bp_player.
Can this be considered a good practice? to continue creating lots of soft refs on bp_player until I get it under 100mb and automatically the other blueprints will get under 100mb aswell? (including PC, equipment handler and so on)
Thank you
This is where the connection is between PC and handler
Soft refs are good, but there is something to be aware of
-
You have to load everything manually
-
If you replace casts with soft refs and then load everything, you’re back where you started, because it’s all loaded
I prefer no refs. Interface breaks the references.
You can also break refs by becoming aware of when it’s happening and coding differently.
How big is the project? I could take a quick look if you want to put it in google docs ( or something ), and give me a link ( PM if you do that ). But not if it’s 100s of Gigs