nameouschangey / Stormworks_VSCodeExtension

VSCode Extension providing some better build processing for Stormworks
29 stars 8 forks source link

adjust for awkward SW draws #90

Open Krolon0697 opened 2 years ago

Krolon0697 commented 2 years ago

idea is rather simple in the simulations, use the raw x y w h etc values to draw over the pixels

however, when building the minified version, add in the awkward -0.5 offsets where necessary to keep the draws the same across AMD and Nvidia GPUs, together with staying on the same pixels as in the simulation

while idea itself is simple, the implementation could be hard so sorry for requesting that, especially since it could require some trial and error testing

on a side note - in simulation I noticed that drawShapeF is a bit... off, when compared to the regular drawShape, for example drawRect hits all the pixels I wanted, (2,2,4,4) starts at 2,2, and is exactly 4 wide and tall, very nice drawRectF however, (2,2,4,4), also starts at 2,2 which is very nice, but is only 3 wide and 3 tall, that's a bit off? it's not an "inside" of drawRect because it hits the upper and leftmost sides, but not a full shape either since it doesn't reach the lower and rightmost side drawTriangle also spans ideally from every vertice exactly at it's position, to every other, again exactly at the desired position drawTriangleF is even worse

does the simulator also suffer from fill rule, by any chance? if it can't be resolved, could it at least match SW 1:1?

nameouschangey commented 2 years ago

Mm, I'm not sure on the first one. I see the benefit, but I'm not sure how much people would like me meddling with their code in that way. But maybe could do it as an option, that's turned off by default.

For anything, except drawCircle, that behaves differently from in-game. Just give me screenshots of the simulator vs game and I'll see if I can fix it. Always happy to try and increase the accuracy

Krolon0697 commented 2 years ago

oh man that's gonna be some pretty big sweet project, give me some time and I'll gather a heck ton of data for ya. well, as much as a heckton can be for just one person, but I do have both old gtx650 and and integrated AMD (r3200g) so I should be able to create quite some comparisons, and, if needed, find the correction values

nameouschangey commented 2 years ago

Don't worry about the correction values between AMD/Nvidia

The bit I'm more wanting to know is; are there any shapes that draw differently (on the same machine) between the Extension and the game?

So if you're drawing a rectangle, and it appears differently in-game than when you simulate it (on the same PC); that's one I'll try and fix.

Krolon0697 commented 2 years ago

draw differences.zip

all on nvidia gpu adjusted every shape to fit exactly in the 4x4 test area then copy pasted it directly to VSCode without any changes to visualize differences

integer values appear to work fine and as you said, I didn't test for correction offsets, tho holy fuck it's so all over the place, shifting up down left right by pixel across pretty much every draw type, holy damn stormworks displays really suck

how probable is that off by default option for auto corrections? if it's not gonna happen then at least I want to know so that I create my own framework to do that

nameouschangey commented 2 years ago

thanks for making that.

I wouldn't hold your breath waiting for me to add auto-corrections, it's probably better to do so yourself :)

Krolon0697 commented 2 years ago

well then, thanks for letting me know, I'll get to testing of possible options straight away maybe along the way I'll ask if some optimizations are possible, can I ask those questions on discord however? 😅 like in DMs?

nameouschangey commented 2 years ago

Sure :)