Emil Forslund
550 posts

Emil Forslund
@emifors
Math, Graphics and Game Programming
Skövde, Sweden Katılım Aralık 2014
314 Takip Edilen185 Takipçiler

@FreyaHolmer If you pass a value to a function that takes an argument of interface type, then that's polymorphism. When you implement an interface as a concrete type, then that might count as inheritance by some, but I would argue that it's neither since no logic is inherited, only obligation
English

@LisaForteUK Ask everyone to come by your office during business hours next week to personally ID themselves to get a new password. Let the new password be an incrementing number.
English

@festivevector If you run the game on a slower CPU, will it be possible to move through obstacles?
English

@OskSta Teach them programming, 3D art and painting, then you can hire them to work on your games!
English

@Mockarutan @OskSta Experiment time! I created a short editor script that uses the Job system to compute the average position of all selected game objects. It compiles to SIMD-instructions nicely, even in edit mode!
English

@Mockarutan @OskSta That is true. You don't need to use the rest of the DOTS package though, just enable Burst in the project settings. It also don't help much with editor applications since they run on Mono.
English

@emifors @OskSta Not 100% sure of this, but I think Unity.Mathematics code only get properly vectorized if you actually burst compile the code. Otherwise it uses a reference implementation in traditional c#, like this one: github.com/Unity-Technolo…
English

@OskSta @Mockarutan Modern processors (not just GPUs!) can do vector algebra in parallell. For code where vector algebra makes up a significant part of the runtime, you can therefore achieve a x4 speed-up by switching library. It also has some nice functionality for procgen, like noise functions.
English

@emifors @Mockarutan Aha. Yeah. I tried that some time ago but got frustrated because the library didn't feel as extensive as the vanilla stuff. And also because all other Unity stuff uses the vanilla vectors. Might be worth another go.
English

@OskSta @Mockarutan A small step towards Burst is just to switch to Unity.Mathematics instead of the "vanilla" vectors, matrices etc. The standard math classes/structs are not implemented for speed at all. Works regardless of which compiler you use.
English

@Mockarutan Yeah that's good improvement. I'm not really instantiating many things, and don't think I will. I'm mostly manipulating lists of structs, though occasionally there are objects with other lists inside of them. I think maybe I'll hold off on jobs for now.
English

@delaneykingrox The quirk is that the amount of rotation is not stored directly as an angle, but as the cosine of half the angle. The axis is also scaled so that its length is the sine of half the angle. It can be nice to know that you can get the axis of rotation by normalizing the first 3.
English

@delaneykingrox An easier way to imagine quaternions is that three coordinates represent an axis of rotation and the forth the amount of rotation. That's why there are four values.
English

@OskSta Here is an example of a routine that will try to process as many messages as it can on the main thread for up to 10 ms. It is non-blocking, so it will be performant even if the queue is mostly empty.

English

@OskSta That is not built in, but rather something you have to implement yourself using TryDequeue(). Either call it inside a loop that terminates after a few iterations or measure the time spent using something like Stopwatch and stop taking items if too much time has been spent.
English

@OskSta If you are spawning game objects for an example, you perhaps don't want them to pop into view across several frames. What you can do then is to spawn them disabled and then enable them using a special message type once all have been spawned.
English

@OskSta I meant the TryDequeue... Wrote some Java this morning. Takes some time for the brain to readjust.
English

@OskSta It is built into .NET. You can use a custom struct as the message type to pass information between the threads. The TryPoll(out T) method is nice since it returns a bool so that you don't need to block the main thread.
English

@OskSta If the task doesn't need to be run immediately, then you can use a ConcurrentQueue. Main thread polls the queue when it is ready, only needing to take as many items as it has time for. The fewer synchronization points you have, the better.
English

Hey @Coffee_Stain , when do we get a Goat Simulator set in Middle Earth?
English



