Emil Forslund

550 posts

Emil Forslund banner
Emil Forslund

Emil Forslund

@emifors

Math, Graphics and Game Programming

Skövde, Sweden Katılım Aralık 2014
314 Takip Edilen185 Takipçiler
Emil Forslund
Emil Forslund@emifors·
@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
0
0
2
408
Freya Holmér
Freya Holmér@FreyaHolmer·
are interfaces usually considered polymorphism, inheritance, or composition? (in the context of C#)
English
23
3
88
35.6K
Emil Forslund
Emil Forslund@emifors·
@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
0
0
0
24
Lisa Forte
Lisa Forte@LisaForteUK·
Your org has a breach. You have to reset 30k customer accounts. How do you do it? (Wrong answers only)
English
422
16
177
98.7K
Emil Forslund
Emil Forslund@emifors·
@festivevector If you run the game on a slower CPU, will it be possible to move through obstacles?
English
0
0
0
257
festive vector
festive vector@festivevector·
been working on an improved method for detecting navigation obstacles, think I'm onto something now! this costs 1 raycast per frame and maintains a 'radar' around the boat that I can use to adjust steering on the fly
English
76
245
3K
160.8K
Emil Forslund
Emil Forslund@emifors·
@OskSta Teach them programming, 3D art and painting, then you can hire them to work on your games!
English
0
0
1
0
Oskar Stålberg
Oskar Stålberg@OskSta·
I've got great hopes for my 40s though, when they will be able to put themselves to bed and maybe even occasionally do the dishes
English
6
1
99
0
Oskar Stålberg
Oskar Stålberg@OskSta·
I sure am glad I had a lucrative career in my 20s cause with these kids around my 30s are not looking very productive
English
15
1
219
0
Emil Forslund
Emil Forslund@emifors·
@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
1
0
3
0
Oskar Stålberg
Oskar Stålberg@OskSta·
In Unity, what's a good convenient way to run long procedural generation procedures that should mostly run on a secondary thread, but has to go back to the main thread occasionally to touch some Unity object?
English
18
4
114
0
Emil Forslund
Emil Forslund@emifors·
@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
1
0
0
0
Tobias Johansson
Tobias Johansson@Mockarutan·
@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
1
0
1
0
Emil Forslund
Emil Forslund@emifors·
@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
2
0
2
0
Oskar Stålberg
Oskar Stålberg@OskSta·
@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
1
0
0
0
Emil Forslund
Emil Forslund@emifors·
@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
1
0
1
0
Oskar Stålberg
Oskar Stålberg@OskSta·
@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
1
0
1
0
Emil Forslund
Emil Forslund@emifors·
@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
0
0
0
0
Emil Forslund
Emil Forslund@emifors·
@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
1
0
0
0
Emil Forslund
Emil Forslund@emifors·
@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.
Emil Forslund tweet media
English
0
0
3
0
Emil Forslund
Emil Forslund@emifors·
@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
2
0
1
0
Emil Forslund
Emil Forslund@emifors·
@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
0
0
0
0
Emil Forslund
Emil Forslund@emifors·
@OskSta I meant the TryDequeue... Wrote some Java this morning. Takes some time for the brain to readjust.
English
1
0
1
0
Emil Forslund
Emil Forslund@emifors·
@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
2
0
1
0
Emil Forslund
Emil Forslund@emifors·
@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
1
0
2
0
Oskar Stålberg
Oskar Stålberg@OskSta·
It's for my island generation. So I'm not gonna run that many procedures, but they are quite long. So it should be optimized for ease of writing and running fast, but a little garbage or overhead when setting up is fine.
English
1
0
4
0
Emil Forslund
Emil Forslund@emifors·
The surface of the triangle is mapped into a warped 3D space so that the edges fold onto themselves and form seamless transitions. It works with any 3D texture and ensures that tiles tile seamlessly both with copies of themselves and with their symmetric counterparts.
Emil Forslund tweet media
English
0
0
0
0
Emil Forslund
Emil Forslund@emifors·
Making a 3D texture tileable in a triangular domain was harder than I thought. The pattern tiles both CW and CCW, but only along 2 of 3 edges.
GIF
English
0
0
0
0