Hi all!
I’m new in developing games and i want to develop a car game for iphone that the track is build at runtime. Before i start i would like to clarify some doubt’s:
Is it possible to do it using only javascript?
In terms of performance should the track be destroyed after the car passes by, to reduce the resources allocated?
Or the fact that unity doesnt render this part of the track is enough compared to the weight of releasing the resources.
I watched an example (youtube link) which is written in C #, however I do not know if it is working properly since the maps the example provides are similar (not a partition of the map
that is allocated as the camera moves). The only thing i noticed was that rendering of the map is only ocurrers at a certain distance (normal behavior of unity). I wonder if this current example is of any use in this version of unity or what am I doing is wrong.
Is there an example or tutorial that can help me?
I build a speedmeter that is update with the function “Update()”. This function run’s every single frame and i don’t think i need to update the meter that many time(the human eye dosesn’t need that much). How can i just update him from x frame to x frame. And do i gain any performance with that or the cost is superficial comparing with for example timeout’s ou doing a costum event? Or unit is just prepared for that.
Welcome to Unity, and game dev in general. To address your questions:
You can definitely do this in javascript.
It’s easy to destroy the track pieces using Destroy(), but I believe the render engine and custom occlusion culling will sufficiently optimize performance on a “persistent” track. You can also simply use a 3D track model if you’re okay with a static, unchangeable track.
Could you elaborate more on what tool you’re using/what the problem is? If you’re asking about Unity’s cameras, you can change the Near and Far Clip Planes of a Camera component to set the rendering distances.
Not sure about the difference in performance, but I anticipate that it’s negligible. If you store game objects and components in a variable in the Start() function, you can access them un the Update() function more efficiently. I would think that a timer to reduce the frequency of a speedometer calculation would only help performance if you had to do a lot of calculations/call a lot of functions/access a lot of other components or game objects.
Anyone else have feedback on optimization for #2 or #5?
Do you mean it’s a randomly generated track? Or that the player builds it using an editor? Or that it’s streamed in/out as necessary?
In any case;
Yes, almost certainly.
If the track is one large object, don’t delete it - just let the culling handle the rendering cost. If the track is made of many GameObjects (e.g., it’s random or modular), then you will probably have to delete objects as you go or you’ll accumulate too many.
I’m not sure what your question is here =]
Need more detail on what you’re trying to do
First of all, you could put it in FixedUpdate(). Otherwise just make a simple timer, something like:
First of all sorry about my later answer, second I would like to thank you all for your prompt response. Design3.com:
Thanks
The idea is to build a no static track at runtime. The car will only pass one time only. So maybe it will be a good idea to use de Destroy() method, right?!
Ok I will certainly check it out, and I will give a feedback!
Ok I get it thank’s
Gribbly:
Yes I want to randomly generated the track, I was planning to have some pieces of the track and at run time I would streamed those pieces and alter them randomly.
Thanks
Ok as I suspected, so as the actor rides the track I will delete the pieces that he passes on and load the new ones.
I was try to check an example on dynamically load and destroy maps, since I am new in unity.
ok I will check that. The main idea is to have different updaters that will run at a certain period of time, because I don’t think I will need to refresh that many times. That’s why I was trying to now about the gain in the performance.
All:
3. Maybe I explain my self-wrong, i was on the impression that the example the actor as he is moving through the map the different pieces of the map would be loaded in runtime. But I didn’t find anything similar in the example.
New Question:
6. Is there a framework or library that can analyze music has is being played a long, like a music equalizer?! Can it be done in JavaScritp?
Once more thank you about your prompt response and sorry about my bad English.
First of all sorry about my later answer, second I would like to thank you all for your prompt response. Design3.com:
Thanks
The idea is to build a no static track at runtime. The car will only pass one time only. So maybe it will be a good idea to use de Destroy() method, right?!
Ok I will certainly check it out, and I will give a feedback!
Ok I get it thank’s
Gribbly:
Yes I want to randomly generated the track, I was planning to have some pieces of the track and at run time I would streamed those pieces and alter them randomly.
Thanks
Ok as I suspected, so as the actor rides the track I will delete the pieces that he passes on and load the new ones.
I was try to check an example on dynamically load and destroy maps, since I am new in unity.
ok I will check that. The main idea is to have different updaters that will run at a certain period of time, because I don’t think I will need to refresh that many times. That’s why I was trying to now about the gain in the performance.
All:
3. Maybe I explain my self-wrong, i was on the impression that the example the actor as he is moving through the map the different pieces of the map would be loaded in runtime. But I didn’t find anything similar in the example.
New Question:
6. Is there a framework or library that can analyze music has is being played a long, like a music equalizer?! Can it be done in JavaScritp?
Once more thank you about your prompt response and sorry about my bad English.
If you want to bump your question, the way to do it is not to post a complete duplicate of an earlier post!
If you want to bump your question, the way to do it is not to post a complete duplicate of an earlier post!
– syclamoth