I want to make world generation sort of like minecraft with destructable environment, but even one layer of blocks makes my game lag a lot, so i would like to know if there is anyway i can reduce or prevent the lag. Or any alternative ways to creating world gen that doesn't lag that much.
My level blueprint that makes the world gen looks like this:
(I couldn't fit it in one screenshot but the print string is the same in both pictures)
The cube actor which is spawning currently has no code but since i want a destrucable environment it will have code latter.
I have attepted to use voxel instead but it says im missing a .dll file, which im not sure what to do about. Where in the computer should i put that file?
The image here is in danish, but it says that the program could not be started, because VCRUNTIME140_1.dll is missing on the computer. Try to reinstall the program to fix the problem.
Thanks for the help
The game lags after you spawn or only while spawning the objects? consider using code instead of blueprints, usually you have better performances.
Use hierarchical instanced static meshes instead actors!
More details: YouTube
Related
I am trying to make a 3D jumping game where my character is standing still and the objects and background are moving towards him to make it seem like he is running. I have a bunch of models for buildings that I am instantiating using an empty game object that I use as a spawner. I want the buildings to spawn one after each other, so whenever one building has moved far enough and left enough space the next one should spawn. I first tried to do this with InvokeRepeating, but the buildings are different widths so it does not work well with a constant repeat rate. I then tried to put a collider on my spawner and spawn a building whenever the spawner collider is not colliding with anything, but it seems to just spawn buildings infinitely. Is there a way to fix this or a better way to do this?
There are many different ways of doing this.
The most straightforward is possibly to let each building spawn the next one, as I assume they each know how wide they are and thus when it's time for the next.
Well , first things first your problem is looking more like a design problem. I would recommend searching things like "procedural world building" , also object pooling. There is lots of examples of runner games that do what you describe.
You can check the palyer position to instantiate , you can create parts of the road as prefabs , make lots and lots of prefabs and instantiate them as you go etc. The question you asked is simply too wide to give an actual answer. So if you have any more spesific questions , it'll be nice to answer !
I'm trying to create a ship simulator within Unreal Engine (4.27) I tried to use Water plugin as also its content to start from and shorten the time to get it working.
I created an empty game project loaded Water/Maps/WaterTestMap then added an istance of Water/Blueprints/BP_BuoyancyExample to simulation (above sea level) and started the simulation... it just sink like anything else. I tried to modify some Buoyancy data parameters but it just seems that no forces are applied to the body.
I tried again on 4.26.2, using water plugin contents, and it seems to work but if I try to create a floating cube BP that mimics BP_BuoyancyExample (in the same level as above) it sinks all the times… the only way to make it work is to use EditorCube as static mesh.
I cannot understand where’s the fault but it really sounds like a wonderful bug…
Animation-Imgur
The animation looks great inside of Maya, but not in Unity.
I've fixed all of the exporting errors already.
There isn't enough information within your question to provide an absolute answer. It could be down to one of many problems...
Are you using expressions?
Are you using IK chains?
Are you animating rotate or scale pivots?
Have you tried baking the animation data first?
Are you sure the exporter works?
Is the character rig known to work within the game? (or is this your own?)
Typically exporters for games will bake the Maya joint model down to simple TRS animations. Sadly there are some combinations of scale/rotate pivots that are simply impossible to convert into TRS, and still maintain correct animation interpolation. Assuming the exporter works correctly, I'm going to guess that may be the cause?
Imagine a large free-roam game in Unity,
The yellow size indicates about the largest you can make a typical Terrain in Unity.
Art dept. will completely build, meter by meter, the entire scene.
Please note, this has absolutely no connection to repeating scenery (as in runners) or procedural scenery (as in say some race games).
Really, what is the correct and good way to do this in Unity?
use say 50 or so terrains, each perhaps 100m x 100m ?
can you even have or use that many terrains?
or what?
For anyone googling here.
The correct solution is indeed
Terrain stitching
that's it.
In practice you must use one of the tools available to do this (eg, TerrainFormer) or, your team will write from scratch a terrain stitcher.
Yes, you just use "many terrains".
The best approach to the exact problem posed,
is in fact to just:
"use lots of Terrains".
It seems to be perfectly viable in Unity to have many (dozens) of Terrain units, basically "sitting next to each other".
In practice, you'll need TerrainFormer
https://assetstore.unity.com/packages/tools/terrain/terrain-former-20052
or one of the similar tools.
(Or, I suppose, from scratch write your own tool to stitch terrains, and allow you manipulate them all at once, join the edge-heights perfectly, etc etc.)
It's not realistically possible to just perfectly sit many Terrains together (by hand), matching all the edges, etc etc. So you're going to need a "stitcher" package for putting many Terrain squares together.
So, this huge area ..
has about 12 Terrain.
So that's the answer, you can indeed have "many, many" Terrain in a Unity project, you do indeed essentially just "sit them next to each other". In practice it's not achievable unless you use one of the editor tools such as TerrainFormer.
The proper way to do this would have been with procedural mesh generation with MeshFilter and Mesh API but you mentioned that this not at all random or generative so that one is eliminated.
It's just simply a very long, thin, hand-made environment
The best way in this case would be a Modular Level Design. You need to create Modular Assets. With this you can have a long road in pieces which can be tileable. A good modeling artist should be able to create and texture modular assets with 3D modeling packages like Blender, Maya or 3ds Max.
All the programmer has to do is make each asset a prefab then use the Instantiate function to instantiate them to create any distance of environment. You can also create a static environment in the scene from the Editor. Almost anything can be made into a modular Asset especially buildings and roads.
After assembling them in Unity, you can do static batch on all the instantiated modular parts with Unity's StaticBatchingUtility.Combine to improve performance of the game since they are not being moved.
Below is an example of a modular road asset that can be used to create almost any amount of road:
You already answered your question
in this case would it be better to not bother with Unity's otherwise excellent Terrain, and the modellers would just outright build the long course/scenery? (Obviously you'd have to chunk it so it all occludes fine)
I think it's the way to go. If the performance is an issue, try putting each chunk in different scenes and then have a master scene to load them async and additively. And of course you want to unload each scene as it becomes invisible in the camera.
I personally go with your own solution which is letting the Unity Occlusion Culling system to take care of the hiding and showing chunks. I only go with the separate scenes approach if I'm not getting enough performance this way.
I recently had the same problem. We build a tilebased infinite runner with road crossings. The camera was positioned behind and over the car looking down on the street and the player car. So the setup is quite comparable.
We used Curvy from the Asset store to create paths for moving the player and also for creating the geometry of the streets and the surroundings among the streets.
https://assetstore.unity.com/packages/tools/level-design/curvy-splines-7038
It is also easy to spawn tiles with curvy paths and combine them at runtime. So you can separate long distances into smaller segments and spawn them randomly.
We also used QuickBrush from ProCore to quickly paint environment detail to the geometry like trees, bushes or stones. I think procore tools are now implemented in the new Unity 2018 version.
Worked quite well.
I am making an open world game and i want to know if there is a way of doing terrain streaming ( loading the terrain into mamory only if the player is close to it ) without using the LoadLevelAdditiveAsync function . i am using free version so this function is not available to me .
Don't forget as long as your terrain patches together nicely, you can always Instantiate terrain prefabs at run time.
Depending on how proficient you are at it, you can also procedurally create terrain at run time as well.
You can do it, and there are different ways to do it. I figure the easiest way to do it (but definitely not the most memory friendly) would be to define your entire level in one scene with multiple small terrains, using the TerrainStitcher tool to deal with seams. Then you could parent all objects under each terrain to a single transform, and use Instantiate to create/destroy them at runtime (in another scene). There are tools that take this approach a bit further, like this one.
But remember that in general big terrains in Unity aren't memory friendly and will reduce your performance. When using an endless terrain, where you don't care about defining the terrain before runtime you can reuse a few terrain objects and simply reposition them, but if you're designing them first, there isn't too much you can do other than lowering terrain settings like Pixel Error, and limiting details and grass.