Unity3D?

Community Forums/General Help/Unity3D?

Captain Wicker (crazy hillbilly)(Posted 2012) [#1]
Hi,

I have a lot of tree models in my game because it is based in a forest. It is freezy and renders very slow. Is Unity3D BASIC? Would rewriting my program in Unity run faster?


Bye!


*(Posted 2012) [#2]
To be honest having hundreds of models or just one the game will only be as good as the hardware your running on and the skills of the programmer.


Yasha(Posted 2012) [#3]
Is Unity3D BASIC?


No.

Unity is an engine, BASIC is a language family. Contrary to what you may have picked up from Blitz3D and DBP, languages and engines are actually completely different things and have no relationship to one another whatsoever (except insofar as the Blitz dialect of BASIC is only available pre-attached to a specific engine and vice-versa).

Of course that said Unity does come with its own scripting engine attached, powered by Mono, so it has C#, UnityScript and Boo built-in (none of which are BASIC, but all of them are dead-easy languages). At the code level, C# on Mono is probably a bit generally a lot faster than Blitz3D (not that I've tried it).

At the graphics level, Unity has the potential to be a lot faster, but not if you do a blind port and keep your game structure exactly the same. You need to tailor your scene setup to the strengths of the engine you're using.

Last edited 2012


Kryzon(Posted 2012) [#4]
You are underestimating your own ability to do research.

Is Unity3D BASIC?

http://unity3d.com/unity/engine/programming

As for the forest, the most likely issue is entity overhead. Try using 'batching' (research on google and on these forums).
You need to have all trees in the same B3D Surface, exactly the same one for all.

Last edited 2012


Captain Wicker (crazy hillbilly)(Posted 2012) [#5]
Are there any ways to make my program run faster in b3d by any chance?
I cannot post the code for the program though, I'm sure you can all understand that right?

I am using a FOR/NEXT statement to load up the trees. I originally had 100 trees total. My problem is simply that it freezes up horribly. The tree model is in .B3D file format. I do get the same results with .X or .3DS formats. Using different model formats doesn't seem to help at all. :(
Is it worth learning another language or engine to get this game going?

Thanks!


Captain Wicker (crazy hillbilly)(Posted 2012) [#6]
Here is an early screenshot of the project.



Yasha(Posted 2012) [#7]
Even Blitz3D should have no problem with a mere hundred trees (I remember seeing demos of tens of thousands of 'em...). So by itself this is not going to be a reason to change engine.

The first thing to note is that if you have two objects in the scene with identical mesh data, they should always be sharing the same surface object internally. If you are loading the same tree a hundred times, this is already a problem: Blitz3D doesn't like uploading large numbers of surfaces to DirectX, not to mention it's a great waste of memory. Instead, load the tree once and use CopyEntity to create new entities with the same surface data (if you load them as .B3D meshes, you can even make them animated boned meshes and change their height, banch positions, thickness etc. by animating them, thus sharing mesh data even between trees that aren't visually identical). For more B3D-specific help, I would suggest taking this to the B3D area and trying to make parts of your code safe to post. Also, look in the code archives for tree systems, of which there are many.

This is what I meant by tailoring scene to the engine's strengths: For Blitz3D, it's all about keeping surface counts low and sharing mesh data wherever possible. So you actually need to learn to use the engine (any engine) in more detail than you might think if you want your game (any game) to perform well.


Captain Wicker (crazy hillbilly)(Posted 2012) [#8]
:) Thanks!


RemiD(Posted 2012) [#9]

The first thing to note is that if you have two objects in the scene with identical mesh data, they should always be sharing the same surface object internally. If you are loading the same tree a hundred times, this is already a problem: Blitz3D doesn't like uploading large numbers of surfaces to DirectX, not to mention it's a great waste of memory. Instead, load the tree once and use CopyEntity to create new entities with the same surface data



This is called "instantiate" in Unity3d. See here : http://unity3d.com/support/documentation/ScriptReference/Object.Instantiate.html



It is also important that your mesh has the less surfaces possible :
For a tree, 1 or 2 surfaces is enough :
1 surface (material + texture) for the trunc + the branches
1 surface (material + texture) for the leaves
You can also use only 1 surface and a bigger texture.



Keep in mind that the default mode of a light when you create a new light in Unity3d, is per pixel lighting. Try to change the light to vertex lighting, it should be faster.

Last edited 2012