- Alot of my variables go into an unnecessary amount of floating point digits (i only really need it to 2 decimal places or maybe even 1) Is there a way to set variables to have a maximum amount of DPs?
This will have no impact on performance at all. The floats are always calculated to the same precision, but to display fewer decimal places, use the FormatDecimal system expression.
[quote:1gux5b5x]- Alot of For eachs.. In some events i have for each object "Ship" for each object "turret" in the same condition. I found this is the only way for it to work... Does this sound inefficient?
Yes - nested loops can be very CPU intensive. If you have 600 Ships and 600 Turrets and you do:
+ For Each Ship
+ For Each Turret
-> Actions
You are requiring that the actions are run 600 x 600 times, which is 360,000 times (over a third of a million). Repeat this a few times and you're asking the CPU to run millions of iterations!
Only do loops like that if it is absolutely necessary. What are you doing that requires that code? Often, there are much more efficient solutions.
[quote:1gux5b5x]- How do you use the profiler? Could that help me?
The profiler object can be used to time regions of events. All you need to do is call the Begin action, run some events, call End, then the Get Seconds expression returns the number of seconds spent on that code.