• 9
• 9
• 11
• 12
• 9
• ### Similar Content

• Hi!
We're currently two programmers and a game designer working on a turn-based tactics fantasy board game. For reference you can search for images of "Tactics Arena Online", a fairly dated game that used to have a lot of depth and complexity.
Our goal is to use the same combat concepts, but giving it a much needed modern touch as well as a whole new set of heroes to choose from with additional abilities. The game is a mix of isometric and 3D and we plan to release the game on Steam and hopefully Android & iOS as well.
We are looking for someone to work with us pro-bono (just like we're doing) as a 3D character artist. The skills needed are creativity, a hard working attitude and an ability to make minor animations (things like idle, walk, block and very rudimentary attack animations). A perk to have would be the ability to make some VFX. If the game makes it on steam and money starts coming in, you'd obviously be compensated for your hard work, but as it stands this is a hobby project to garnish your portfolio.
A bit more about the game:
This game will be an online multiplayer game where each user gets to pick up to 10 characters to place on his half of the board (this would be done before even entering matchmaking. Think runes in League of Legends for example). The user can place his 10 units of choice anywhere he likes on his half board. Some units can be used more than once. So if you want 4 knights and 2 mages or even if you want 10 clerics, you can do as you please. You can then save your setups for future use. The goal of the game is to wipe out the enemy team.
Each character or Hero (except premium and abyss characters) start with 1 ability and they can ascend (either by playing a certain amount of matches with the character or by forcing the ascension with real money) to gain a new ability or passive. Acquiring a new character can be done by using in-game currency that you earn from playing matches or using real money with the exception of Abyss characters which can only be acquired by winning certain rare matches. The goal is to offer a freemium game with lots of customizable elements while making sure that no user can "buy power" with real money. We want everything that a paying user can get to be available to non-paying users who play the game a lot.
Ultimately we want this to become a competitive game that people can enjoy and really get invested in. Each character is designed with options for counterplay in mind and synergy with other heroes.

We sincerely believe in what this game can become and we home to find someone just as passionate as we are to get involved in this project!

•    Hello , i would like to showcase my first game project, a simple endless casual arcade game called Apples Mania : Apple Catcher. The game has simple goal , scoring as high as possible by collecting falling apples while the difficulty gradually increases. Different apples are worth different amount of points and there are also 2 power-ups to help you in your challenge.
The game took me about 2 months to complete and polish and i made everything except for the music tracks and some of the sound files. Made in unity and blender3d.
Would appreciate any kind of feedback.

A trailer showing basic game-play:

• By Paszq
Troglodytes are a playable races in Arpago - they usually don't talk much and most of them lives near water sources.
• By Paszq
a Fox in a dungeon :)
• By Paszq
Fox Folk is one of 3 playable races in Arpago.

# Unity Should I leave Unity?

This topic is 644 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I've been making a game with Unity for quite some time. All code has been made with C# and I'm starting to get the game at a point where the basic elements work... but not smoothly. My problem is with Unity itself. The garbage collector is killing me because of the amount of objects my game has (I generate chunks, and in a planet there can be 20,000 chunks). I've been fighting the garbage collector for so long I'm wondering if I should look into another engine, or create my own. Would I be able to make an engine that uses C# as a scripting language and C++ as a main language, so I can manage my memory more efficiently? It seems that Unity isn't upgrading Mono for awhile, and until then, I'm not sure how I'm going to overcome this garbage (no pun intended). I have a lot of free time, and I'm young enough to learn C++ pretty easily, so I'm wondering if I should split off of Unity soon, before it's too late, and all my code becomes a trashy mess (once again, no pun intended).

Thanks!

##### Share on other sites

Seeing as you're talking about the garbage collector a lot, it seems like this is more of a problem of learning how to deal with large amounts of objects in a managed environment rather than a problem with Unity.

Object pooling will alleviate a lot of situations where you're dealing with lots of objects of the same type being created. In your case if you're dealing with chunks, it might be easier to pre-allocate a large batch of chunks off of which you can allocate and recycle chunks. In games I've shipped with Unity we had to apply this type of strategy a lot, for example for projectiles, effects and even pathfinding nodes if I remember correctly (I didn't write the pathfinding system).

Proper object management is not a problem that's unique to Unity, C# or even managed languages in general. In C++ you're going to have to reason about data flow and usage just as much if not even more, so rolling your own engine is not going to fix this problem.

Plenty of programmers like to blame garbage collection schemes for many of their problems, but there's often good solutions to avoid garbage collection issues which will eventually also benefit your code in terms of efficiency and cleanliness.

I'm already object-pooling the chunks. The problem is when I pass data to meshes, it seems to always create garbage.

##### Share on other sites

You'll have to provide some more details then.

What does "it seems to always create garbage" mean specifically? It's invoking the garbage collector? It's allocating a large amount of memory? Do you have any profiling data or other statistics to show what's happening?

Also, if you really suspect the garbage collector, are you sure your pooling strategy is correct and not doing any hidden redundant allocations? Is the step where you're passing along data to your meshes doing any redundant copies?

##### Share on other sites

The garbage collector is killing me because of the amount of objects my game has

Having a lot of objects should not a problem for a generational garbage collector anyway; deleting a lot of objects is a problem.

But a quick google search says that Unity doesn't use a generational garbage collector :(
I've shipped a lot of games using Lua, which also has a pretty terrible (non-generational) garbage collector, where the cost grows with the number of live objects. There's always ways to work around it :(
Firstly, avoid ever generating any data (deleting objects), as this creates work for even the best garbage collector. Reuse old objects when you can. e.g. if you know that a gun can fire a stream of 10 bullets, then you make a pool of 10 bullet structures and keep them around permanently (instead of a making a new one for each shot). Make objects bigger when you can -- 1 object of size 10 is better than 10 objects of size 1. In C# use structs over classes where possible, and flat arrays instead of more advanced collections. e.g. if you make an array of 20000 chunk structures, that would hopefully be a single 'object' as far as the GC is concerned.

##### Share on other sites

Just switching to C++ isn't going to fix your issues, you basically are saying I am going to write my own garbage collection and poof your issues are over. I think you will find you will be fighting a lot more with performance then you think you will. Language isn't going to do magic for you. City Skylines is made with Unity and I have seen massive cities built. Cars moving, we are talking 10's of thousands of objects at once. The pooling itself might not truly be the problem. Consider system requirements, what are you running maybe you have reached the maximum amount of performance you can get out of your rig. Look at some of the good pooling packages on the asset store. I'm not saying you are a bad programmer but I can't assume you are the best either so something has to give. You can crash a decent rig with a few objects and bad programming (No offense).

I  hope I didn't offend you just give a little advice on thinking of switching languages. Also if you want to learn C++ I am all for people learning multiple languages, I encourage this behavior. If you are serous can you look at UE4 you write your game in C++. You can always simulate your minimum game and see if you can get that to perform better for you.

##### Share on other sites

Just switching to C++ isn't going to fix your issues, you basically are saying I am going to write my own garbage collection and poof your issues are over. I think you will find you will be fighting a lot more with performance then you think you will. Language isn't going to do magic for you. City Skylines is made with Unity and I have seen massive cities built. Cars moving, we are talking 10's of thousands of objects at once. The pooling itself might not truly be the problem. Consider system requirements, what are you running maybe you have reached the maximum amount of performance you can get out of your rig. Look at some of the good pooling packages on the asset store. I'm not saying you are a bad programmer but I can't assume you are the best either so something has to give. You can crash a decent rig with a few objects and bad programming (No offense)

Unity actually has some problems specifically with generating large numbers of meshes, as for a chunked voxel world.  One issue is that you need to pass in arrays of the correct size as vertices, indices, etc., so you end up creating and destroying a lot of arrays and can't* do pooling for them.  Also, I'm not sure, but I think Unity creates its own copies of those arrays when you assign them to meshes.

Cities: Skylines isn't really a fair comparison; Unity's approach to procedural meshes and garbage collection might actually be a serious problem for a voxel-based world, as compared to other options OP might investigate.

I'm definitely not a Unity expert, so there might be solutions to these issues that I'm not aware of.  If there are, I'd definitely love to hear about them!  I do see voxel engines on Unity's Asset Store, so it's possible some people have figured it out, or at least gotten good enough performance.

*you CAN create and pool vertex arrays of size MAX_VERTICES and pass them in with the unused regions filled with junk.  I don't know if those junk vertices get transferred to the GPU, though.  Also, as far as I know that approach doesn't work for the indexing arrays.

##### Share on other sites

Just switching to C++ isn't going to fix your issues, you basically are saying I am going to write my own garbage collection and poof your issues are over. I think you will find you will be fighting a lot more with performance then you think you will. Language isn't going to do magic for you. City Skylines is made with Unity and I have seen massive cities built. Cars moving, we are talking 10's of thousands of objects at once. The pooling itself might not truly be the problem. Consider system requirements, what are you running maybe you have reached the maximum amount of performance you can get out of your rig. Look at some of the good pooling packages on the asset store. I'm not saying you are a bad programmer but I can't assume you are the best either so something has to give. You can crash a decent rig with a few objects and bad programming (No offense)

Unity actually has some problems specifically with generating large numbers of meshes, as for a chunked voxel world.  One issue is that you need to pass in arrays of the correct size as vertices, indices, etc., so you end up creating and destroying a lot of arrays and can't* do pooling for them.  Also, I'm not sure, but I think Unity creates its own copies of those arrays when you assign them to meshes.

Cities: Skylines isn't really a fair comparison; Unity's approach to procedural meshes and garbage collection might actually be a serious problem for a voxel-based world, as compared to other options OP might investigate.

I'm definitely not a Unity expert, so there might be solutions to these issues that I'm not aware of.  If there are, I'd definitely love to hear about them!  I do see voxel engines on Unity's Asset Store, so it's possible some people have figured it out, or at least gotten good enough performance.

*you CAN create and pool vertex arrays of size MAX_VERTICES and pass them in with the unused regions filled with junk.  I don't know if those junk vertices get transferred to the GPU, though.  Also, as far as I know that approach doesn't work for the indexing arrays.

My problem is on this line of code:

public void Rebuild()
{
vertices = new List<Vector3>(vertcount);
triangles = new List<int>(tricount);
uv = new List<Vector2>(uvcount);
}



In my MeshData class, I make lists to the EXACT size needed, by counting what I need beforehand. But, for some reason, on the FIRST time I allocate these lists (as above) it generates garbage. Why would it create garbage on the first time? I'm not replacing anything, just creating a new instance.

EDIT: Profiler specifically says "List1.ctor" I know this means constructor, but why is this making garbage???

Edited by SpikeViper

##### Share on other sites
Unity's profiler shows allocations, not garbage.

##### Share on other sites

Unity's profiler shows allocations, not garbage.

In my case I can see where GC.Collect is being called from, and I can see the memory used - both where I mentioned above.