I want to try Unity

Started by
13 comments, last by phil_t 7 years ago

What I want is an SDK or library to use in making games. What I downloaded seems to be only an environment that lets me place objects in a predefined scene. Granted, I have only looked at it for a short time, but I thought I would be able to use it in VS C++. Did I get the wrong thing?

Advertisement

You can script your game using Visual Studio, this is also now what it opens when you open a script in Unity.
So basically you place your game object in the scene or you spawn them in script and each game object can have a script.
The script is basically the life of the game object, so for example you script the input of your game, the movement of an object, the AI...
If you don't want to spend time on the rendering code and directly want to work on a game then Unity or Unreal is the way to go.

Unity uses C#. If you're familiar with C++ then it's not hard to pick up.

Watch some of the tutorial videos to see how to assemble components in order to create various entities, including script components which - yes - can be edited in VS, though you may need to set VS as your chose IDE in the Unity preferences.

If you're interested in sticking with C++ then look at UE4 instead. UE4 entity behaviors are based on a visual scripting system called blueprints. You can write C++ classes and functions that will compile into blueprint nodes to allow you to use your own code relatively seamlessly.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

Or simply write the actor using C++ with Unreal Engine to avoid to use Blueprint.
Blueprint is good for little script like "open a door", basically scene script, but for a big script it's better to go to C++ and write the actor.
You can see the difference of both (unreal and unity) here : https://docs.unrealengine.com/latest/INT/GettingStarted/FromUnity/

It is however worth pointing out that engines like Unity or Unreal explicitly don't work like an "SDK".

These aren't the sort of thing that you import into your existing IDE and use as if they are libraries. These are complete standalone systems, with their own startup sequence, main loops, and development paradigms.

You can however continue to use Visual Studio as the code editor for your Unity scripts or Unreal classes.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

I'm wanting to make a huge space game without transitions. In order to do that, I need to have control of the render loop. I have never done scripting before, so I don't know how I could use Unity with scripting to accomplish this...... I also don't know about UE4. What I don't want is an environment that I create "scenes" and script the objects. I need an engine that will give me pointers to the various functions like shaders and render objects.

I already have a mostly working engine, but I thought I would try an engine that already had all the functionality. Is there any hope for me?

Looks like you need level streaming, Unreal Engine can do that, you can see all infos there :
https://docs.unrealengine.com/latest/INT/Engine/LevelStreaming/
Unity also can do async level loading, here the script function reference :
https://docs.unity3d.com/ScriptReference/Application.LoadLevelAsync.html

So, basically, you can have the world divided by zone and level streaming the zone (also can preload if you are near of one zone).
How unreal works is like that : you have one level which loads all other levels.
I guess, Unity works the same.

I won't have "levels". Imagine a small section of the galaxy (about 30,000 stars). Each star can be reached by the player (in a ship). Each star system can have several planets and moons. Each planet/moon can be landed on and explored (the entire planet not just small sections). That amount of data would make a level editor shoot himself in the face just thinking about it! It all needs to be procedurally generated. Also, rendering a complex system of a main planet and its moons with the potential of having planet rings with asteroids (think Saturn) would cause z-fighting like crazy if you don't render in stages by distance or do some scaling trickery. All of this will be done without a load screen or pausing while it generates. Like I said, I have a good portion of it done already, just without some of the cool shaders.

I wouldn't even know where to start if I had to script that kind of complex system.

I won't have "levels". Imagine a small section of the galaxy (about 30,000 stars). Each star can be reached by the player (in a ship). Each star system can have several planets and moons.

That is level streaming, don't let the name fool you. Think of the levels as zones, once you leave a zone and move to a new one, it's streamed into the engine while the other zone is streamed out, this way you have only what you need around you; because there is no computer cable of rendering a whole universe at once.

I am going to recommend Unreal over Unity for this type of game, because the amount of objects it can render at once exceeds Unity by a huge amount.

Also Unity's batching can cause weird pops, for example if all the trees on a planet is batched and the player moves the camera to the side, the forest could disappear when the origin point moves out of the screen. Unreal's instancing allows each object it's own origin point, making only objects outside of the view clip. Unreal's hierarchical instancing is also great for space games because there is a lot of duplicate objects you want to render.

this shows how hierarchical instancing can be used for a space game. A note hierarchical instancing works with identical meshes, if you plan on mixing meshes to create new objects then regular instancing will be better.

Now before Unity users attack me, you can achieve your goal in Unity. The trick would be to make small levels for streaming, and employing some visual illusions to cover any strange loading or popping. Thick mist for example would hide a lot if used well, also preventing people on a planet from seeing outside the atmosphere would work.

All of this will be done without a load screen or pausing while it generates.

Buy every player a supper computer, that will work. ^_^

The problem is that loading time is linked to the PC the player is using. Level streaming is one of the best global solutions.

Things to remember is that larger objects take longer to load, so things like texture atlases -needed for batching- will improve performance, at the cost of increase loading times.

Streaming doesn't pause the game while loading however a object is only placed into the scene once loaded. Meshes can be placed if a low mip-map is loaded and the mesh is loaded. Level streaming often attempts to load in some kind of representative of a object before moving to the next representative and only after all objects have a representation does it load the details.

The problem with streaming is that if the player pops into the middle of a streaming level, there would be nothing, the streaming will be forced to allocate more resources to loading and this "freezes" the game.

There is two ways to prevent freezing, extend the borders of levels over other levels, this way the level wall start streaming in before the other starts streaming out. The downside is that there will be points in the Universe where the player could have six levels loaded at once.

If you ever played Fallout 4 and reached a point where frame rates dip, even with no visual indication why, you have stepped into such a zone.

The other solution is to feed smaller things while streaming or to use small zones for streaming. For your game I would recommend using 1024*1024 as your largest texture size.

Preventing players from jumping into a level and forcing them to travel slowly into it, could also help with loading. You could even limit the speed by checking the frame rates.

Unity and atlasing: Because material atlasing is a large part of how Unity's batch manager works, you will need to use material LODs to manage it. When the object is on it's lowest LOD it could share a material and texture with objects of the same LOD level.

When the player is near then it uses a material with only a texture for this one object, that way it won't batch with objects in the distance and won't disappear when the player tilts the camera. The other advantage would be the details the object has.

Using material LODs like this will both help and hinder loading times. Many objects that are far can all fit on one texture, as the texture loads, meaning objects will appear faster. The downside is that mip-maps will be made for these objects that will never be used and if they are left on will decrease quality, you can fix this by manipulate the mip-maps and testing what you need.

In other words, you can do this if you aren't lazy and willing to make textures for most LODs by hand.

How about looking at how NMS wrote their procedural generators? If you want a MASSIVE seamless expierience, procedural generation most probably will be your only option unless you got thousands of devs to create the content in countless years, and your players have a massive Peta-byte disk in their PC to store the huge amount of the data needed for that content.

You will quickly find though that while this can be done in about all engines out there, no engine will have out-of-the-box components for that level of procedural generation. You will have to get hands on a lot. That is why your "I never scripted before" comment concerns me a little bit.

Best bet would be to have a look at outerra engine

This engine at least does the seamless transition. Seems to be the main selling point of it. No idea how expensive the licensing is, and if the engine comes with procedural generation code out of the box.

This topic is closed to new replies.

Advertisement