« first day (3914 days earlier)      last day (55 days later) » 

7:05 PM
G'afternoon everybody!
 
Howdy.
 
7:25 PM
How are you doing today Pikalek?
 
Relatively okay. Trying to pick up an older game dev project & port it. Running into some language annoyances.
And yourself?
 
Would the Span<T> type (introduced after that answer was written) be useful here?
8
Q: Span and two dimensional Arrays

MickIs it possible to use the new System.Memory Span struct with two dimensional arrays of data? double[,] testMulti = { { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 9, 9.5f, 10, 11 }, { 12, 13, 14.3f, 15 } }; double[] testArray = { 1, 2, 3, 4 }; string testString = "H...

 
Unfamiliar with that, so I'm not sure.
The sitch is I have a 2d array that I was double buffering as a 3d array.
In Java I could just toggle one of the indices to get the current or back buffer as needed.
In C# it looks like that's only available w/ jagged arrays.
Which I could use.
Or I could just keep two 2d arrays & juggle the references.
Which is the path I've started down.
Not a huge difficulty, just a little more work than an out of the box thing.
 
7:45 PM
Oooh, via Span documentation I happened across the stackalloc expression, which I had not heard of before!
 
looks neato
 
8:02 PM
Wasn't familiar with the stackalloc either.
 
Could be handy for some polynomial solver utility functions, where I don't know in advance if the polynomial has 0, 1, or more solutions. Till now I've had to allocate a short-lived list or array or keep a persistent scratch pad.
 
Must be a day for things I didn't know. Earlier I ran across this tutorial where they use a combo of IEnumerator<int>, IEnumerable<int> & yield to make a state machine.
 
Though it does mention it enables buffer overrun checks - I wonder if the performance win is worth that overhead.
Ah yeah, that's a common idiom in Unity for writing coroutines.
 
Good to know. When I first saw it, it seemed like an abuse of sugar.
 
I mean... not no? But it works, so...
The downside is that it does allocate, but usually you're only starting/finishing a few coroutines per frame so it's never been a problem in my work so far. Maybe on mobile you'd have to be a bit more picky about it.
 
8:13 PM
Fair enough. There was also some Linq usage somewhere in that tut series that also seemed, unnecessary. But again, maybe the performance isn't that big of a deal.
 
I haven't profiled much Linq. I'd like to hope the compiler can boil a lot of it down to what I've have written without it, at least for trivial transformations.
Compiler transformations reminded me of this tweet - that thread also has some nifty C# techniques I didn't know about previously.
 
I'm w/ the reply tweet of "lol i hate both of these"
Though 'hate' is a pretty strong word.
 
is anyone here familiar with generating bitmap images from svg on web workers?
 
No, sorry Jose, I haven't done anything like that. What's your current issue?
 
@Jose Ironically, I was looking up how to convert bitmaps to svg (well, technically polygons) this morning. But no, I can't say I'm familiar w/ your topic.
@Jose What's your end goal?
 
8:27 PM
I am working on a tool that takes a very large svg and renders.
the reason svg was used is to have the ability to zoom in and out and not loose sharpness...
the image rendering doesn't have to be in real time, but I don't like that it stops the main thread from doing anything as it is rendered...
I was hoping to move the rendering of the svg to an offscreen canvas and use createImageBitmap on a web worker, but the problem is that the function fails on svg... Here is a similar question posted a year ago:
4
Q: SVG Image not loaded in web-worker

Fritjof BerggrenI'm trying to run this typescript code in a web-worker: async BuildImage(): Promise<void> { let data1 = `<svg xmlns='http://www.w3.org/2000/svg' width='50' height='50'> <foreignObject width='100%' height='100%' style="background:blue"> <div xmlns...

So I was hoping maybe some game designers have a work around in some other way...
@Pikalek
 
@Pikalek Sorry for not responding sooner, just was really busy at the moment with school. I really need to work on my game some more too.
 
No offense taken. The protocol is relatively fluid here.
@Jose I see. I'm afraid I can't offer an alternatives. I think one or two of our regulars code in Javascript, so there's a chance they may reply upon scanning the backlog.
 
thanks
 
Sucks that the bug report for that goes back to 2016 :/
 
8:43 PM
Agreed...Seems like it should be an obvious thing to fix...
 

« first day (3914 days earlier)      last day (55 days later) »