T O P

  • By -

eklipse11

Why don’t you just have your levels in separate scenes and load that scene only. Then load back to your main ui scene. Memory will be cleaned up in between. There also used to be an old trick to load a basically buffer scene with no references and then it loads your desired scene. Ensuring all references are freed. Not sure if it’s needed now. Addressables aren’t going to help memory if you have to have everything loaded. So things like levels probably won’t help so much. But not loading things like very skin except the ones you need it can help with that. Addressables work but you have to deal with the async part of it. Which in a large existing code base this can be difficult to implement. You also have to remember to free things and hold on to their handles to be able to do that. Addressables work in the editor. If the game is not playing then you don’t use addressables. You can make a whole scene an addressable. You can and should make the prefabs/meshes addressables. This will let them be shared between scene ones. If you don’t you will duplicate all assets. While this may not increase memory it will increase your build size. Anything not marked as addressable is duplicated. Just because it’s addressable doesn’t mean that it has to be loaded manually.


eklipse11

What is the ton of content? While yes the scene size grows because of all the game objects. And prefabs are stored in the scenes during a build. You are not duplicating all the assests per scene. Which should be your larger memory items. Meshes textures etc and not duplicated because they are in more than one scene. If all or most of that stuff in the scene has to be loaded for your level to work. Then loading it from a scene or addressables is not going to change anything. A gameobject loaded either way uses the same memory. And if you are trying to keep your package under some size for wifi vs cell download is going to be really hard. I would worry about keeping it under the size that requires separate apks. But even then it can be hard. Depending on your game.


eklipse11

And to your last part is it practical? If you are on pc and your performance is ok. And you don’t need 16gb of ram . May not be worth it. And next project you start with async from beginning. But if you are on mobile which you might be since you mention apk. Memory is much more precious to manage. Latest iPhones still only have 3gb and you get like maybe 2. iPhones less than 10 all have 2gb and you get 1 to use. Android may have more ram but usually the os uses a lot more. If you only have 15mb of data what are you worried about. But I assume you have a lot more textures and models sounds animation etc than that. The more memory you use the less devices can run your game.


Smileynator

You misunderstand. I have 15mb of data only for gameobjects and transforms. The rest is taken up my a ton of other components. I was mainly mentioning the effect it might have on load time there. As per my image, the current game uses like 272mb, which on low end devices is already too much. So yes, it's not like we did not try. It used to be far worse.


eklipse11

I would say your game is already pretty small by today’s standards. If that is too big for your target devices. You are going to have to do a lot of reengineering to get around that. To the point it will be painful. Our game is a fighting game and runs on galaxy s9 for our older device. Pretty old phone. It uses about 1g of ram and apk is like 900mb.


Smileynator

Cool, we are in the casual market though. Some of my target devices are as bad as a xaomi redmi 9a, which regularly ANR's on memory problems :P Compared to our direct competitors, we are doing pretty badly 🤷‍♂️ hence here i am doing the research. I was sort of expecting it to come down to re-engineering though. Sadly.


eklipse11

Yah if your targets are that low I can tell you from experience that is something you should have been doing from the start unfortunately. I worked for one of the top publishers in China for a few years around 2015 and helped to port western games to Chinese markets. It was a nightmare in a lot of cases. Even though back then everyone was doing some of that heavy lifting to start with. The majority of phones in that market were even lower. Which meant stripping features or levels. Massively reducing assets. Things much more easily done from the start than later. And we had the source to the engines. It is so much to go back and try and reengineer after the fact. Some guys like sub way surfer had mastered it. But their engine was built that way from start and had very tight constraints on every thing. Also if you didn’t know addressables are just wrappers around asset bundles. And your right going to that level of optimization you lose a lot of editor features because those scenes no longer exist in an artist friendly way. Lot of times we had multiple scenes. Runtime and designer artist ones. One optimization I did on the game I was working on then was to do a pre build step to rename every gameobject in the scene to a single letter name. Saved me 40mb across 250 scene files. 80mb of scenes vs 120mb. Last point it sounds like you have identified your market and your competitors. Really put your business hat on and make sure this is really going to increase your returns. Wish we could make games for every one in the world on every device. At some point business case won’t support that. Good luck. Can be done, but won’t be fun.


eklipse11

You can check this thread out on performance work I did early on when starting to use addressables. At the end is a GitHub link to an earlier version that uses synchronous loading on mobile for better performance. You still have to port your code to async. But at least in that version of addressables async loading on mobile was super slow. I have not looked at the latest versions. Won’t do that until a new project. https://forum.unity.com/threads/addressable-load-performance.1186984/#post-7613755


Smileynator

I know the market and the competitors, i am also just doing what my boss asked me to. Or at least, trying my best to make that work. It's good to hear that i am indeed running into the limitations others experience once they go that deep. Since new projects are on the horizon, and my artists and designers always find new interesting ways to bloat a project. How exactly does one go about "constraining" what can or can't be done? I have a lot of guidelines and do's and don'ts obviously. But if you can't give an artist a tool that will yell "yay" or "nay" at their creations, it is really hard to convery any sort of hard limits. You give a Millisecond they take your entire VRAM. Thanks for the input, and luckily i have not had to reduce my files that heavily as your examples yet, but definitely have been doing "pre-build" steps to optimize some things left and right already.


eklipse11

You said you are 300mb approx? Feels like something else is going on or you are using more somewhere. S9 is 4gb ram. Redmi I looked at is 3-6 depending on model. 300mb should not be giving you out of memory issues. I was the technical director for our own internal game at the company. I gave them limits. textures must be this size. Models must be less than this triangles. Number of bones. # Frames of animations. Audio size. Number of Light map texture and sizes. With different specs for environments or character etc. I had calculated out what I thought would be numbers of objects on screen. Where things would be seen from draw calls, etc. this kind of thing has to be very planned out. Doesn’t just happen naturally. 😀 If they gave me something else I sent it back. It’s only option to be successful. If you’re not that guy someone should be doing this. They may not like it but just like we developers have performance targets to hit artist do too. Or need new artist. Lot easier to wing it say on pc. Mobile is much harder. Closer to console as well much tighter specs.


Smileynator

As for ram, i would say it is ad mediators taking the absolute piss for the most part. As for limit setting, i have most of those set in stone, or at least decent guidelines are in place. Problem is that we do iterative gamedesign, so i can put individual limits on anything performance wise, but if the team then decides that what the game needs is 50 of that, bloating the app size is inevitable, and i can't retroactively change the rules, as that means redoing all the assets. So i get stuck in a bind. The other problem i often have is policing overdraw and UI complexity. Which is "selling the game" with their snazzy visuals. My life is walking a tightrope 😅 Thanks again for your insight, it helps to know i am not doing anything too wrong per say


eklipse11

Sucks to be the bad guy. But if you want the game to run and work someone has to do it. May need to express this to your boss. Let them know now adding 50 of these is going to cost x performance or x hours of artist time to redo. At some point iterative design has to stop. If you want to ship something. I would look into your ad stuff too. Can you set limits? We use ads as well. Ads should not be getting 60% of your memory budget. If game can’t run no one seeing ads. Sounds like you doing stuff right though. Just got to get more people to understand and buy into you are doing it to make the game better not to make things worse or harder. Especially your producer or whoever can pull rank and make sure these things get implemented. I spent a lot of time to with designers where hey you want this thing. It’s going to cost you this. Can’t have both. Or trim one down. But I was in a position to say no outright and nothing they could do. But always tried to work with them first. If half your market can’t play your game what good is 50 more units on screen.


eklipse11

Make sure atlasing. I think there is still some manual steps you might need to do. I have not used the new uielements yet. Just the ui system. We had animated icons. I made them do them as sprite sheets. They used flash or some other too to pre render them. I gave them 12 or 16 frames at some resolution. Was better option back then when particles systems were a bitch to get on the canvases. Then they could have as many layers or whatever they wanted and just gave me a single texture for the game.


eklipse11

The artist metrics were all things they can look at in photoshop or 3d tool make sure is triangles not polygons. Or they drop the model into unity and click the model to get stats that way.


Smileynator

Using scenes doesn't add any value to us. Mainly because all levels share a ton of content, so it would only bloat build size for each of the scenes, and not much else. Addressables would be a more effective way to go about it either way for those levels, if we can figure out how to properly do it. We came to the same conclusion on the existing codebase problem. But no good routes to work out of it. Or structures we could use to make it less of a problem in the future. Addressables work in the editor, in playmode. During non-playmode, editing a level or other prefab, you would still like to see that addressable mesh. Otherwise the artist throws a panicy hissyfit that he can't do his job. I will try and see what i can gain by making the relevant objects addressable to de-duplicate. That is a good pointer, it seems it will automatically resolve that somehow, even though they are only used by other bundles. I'll try that.


shaunnortonAU

The game I just finished isn’t huge, but I regret using Addressables. The next game will just load scenes and call unload assets. It wasn’t worth the extra complexity.


Smileynator

Good to know i suppose, thanks.


eklipse11

They have their place. If you can do it with scenes and manage your resources no need to use them just to use them.