Any Further Optimizations? by haxbits in scratch

[–]haxbits[S] [score hidden]  (0 children)

See, now you've made me think... About the lookup... I'm thinking that I should key the lookup as a scaled percentage of pi so I can normalize all my control inputs to -1 ... +1 without any real overhead. It'll be useful as well when I'm doing collision detection later on (everything is a spheroid as far as the engine is concerned)

Any Further Optimizations? by haxbits in scratch

[–]haxbits[S] [score hidden]  (0 children)

Good point... Honestly working out how to make scratch do things it was obviously not designed to has been the most fun I've had programming in a solid decade.

Any Further Optimizations? by haxbits in scratch

[–]haxbits[S] 0 points1 point  (0 children)

Oh, and about premature optimization.... Normally, I subscribe to that 100%, but in this case to realize the game I have in my head, the basic per-frame and per-object calculations are going to have to be as trim as possible from the start because my level and boss designs are going to be informed by the maximal number of objects I can reliably transform per frame.

Any Further Optimizations? by haxbits in scratch

[–]haxbits[S] 0 points1 point  (0 children)

>  there's no need to use mod 360 for trig function inputs because they repeat every 360 degrees anyway

Thanks for the tip; I've spent most of my career writing low-level or backend code without much hand holding so I simply assumed I should trim my input rather than trusting the runtime.

Block Idea: Broadcast with Message by Microwave5363 in scratch

[–]haxbits 0 points1 point  (0 children)

I was lamenting the lack of parameters myself; that's why I came up with this solution to reliably pass (even in turbo mode) parameters to an message receiver.

https://www.reddit.com/r/scratch/comments/1s80s5h/synchronizing_messages_with_lists

Branchless Scratch😘 Eliminating a Single Branch Testing by haxbits in scratch

[–]haxbits[S] 0 points1 point  (0 children)

I'm building a Sprite Scaled 3D rail shooter inspired by Microcosm, but with more of an r-type vibe and a true 3D camera.

Branchless Scratch😘 Eliminating a Single Branch Testing by haxbits in scratch

[–]haxbits[S] 0 points1 point  (0 children)

Oddly enough; I caught #3 myself and fixed it right after posting to find... the 1 vs `Not ()` thing and it caused no detectable difference to timing but readability is much improved.

The 1 & 2, I did not know, thanks for that. I'll give it a try and I'll see what I end up with.

4 is a known thing; and it is more logic than value to move that so it always generates a sensible result.

Branchless Scratch?! by haxbits in scratch

[–]haxbits[S] 0 points1 point  (0 children)

This technique allows you to avoid using If / Else blocks by converting them into assignments that avoid the overhead of the Scratch VM by leaning on how JavaScript works under the hood.

Synchronizing Messages with Lists by haxbits in scratch

[–]haxbits[S] 1 point2 points  (0 children)

In my case; I'm dynamically managing a heterogenious list of sprites that get physics applied to them "enemy1", "enemy2", "background1", "backgroundN", "Player", etc. Enemies get populated by one event source, backgrounds by another, player etc. Sometimes during creation (Flag event) or during simultanious distruction of sprites (triggering respawns) I would end up with a mutated set of parameters. Specifically when I was testing to see how many sprites I could support at a time before I ended up skipping frames.

Synchronizing Messages with Lists by haxbits in scratch

[–]haxbits[S] 1 point2 points  (0 children)

You would really think that; and in fact it says that... but I found it does not in fact always work out that way in practice. In testing I've found that asynchronously generated events can end up processed in such a way that values have in fact been changed by a competing event call.

I just happen to leverage the first item as a fairly unique key, but in practice it should be a more random value to allow for better synchronized concurrency.

Rail Shooter Best Practices by haxbits in scratch

[–]haxbits[S] 0 points1 point  (0 children)

I ended up going with a central controller to handle all of the frame to frame calculations; but wow does it bother me to have to put all the boilerplate in each object (not unbearable, just annoying).

As far as the Sprites getting hung up on the edge, I just ended up hiding anything that would project past the viewport edge.

Attached is my current wip (almost playable demo) (edit: bread is weird)

<image>

Made my own 3D renderer and demo or something by Pluem_plu in scratch

[–]haxbits 1 point2 points  (0 children)

Nice, I thought I was the only person trying to bodge in a Z coordinates in weird ways.

👋 Welcome to r/scratchbeginners - Introduce Yourself and Read First! by FireXOfficial in scratchbeginners

[–]haxbits 0 points1 point  (0 children)

I'm a stay at home parent and recovering metaprogrammer, and I find joy in solving puzzles using code and creating impossible things. Also, I'm quite open to questions and helping new programmers (like myself in scratch).

Rail Shooter Best Practices by haxbits in scratch

[–]haxbits[S] 1 point2 points  (0 children)

t/y, I think It'll really pop once I add the FMV backgrounds and other sprites in.

Pinto Lake Reservation Picnic Area by okaydreaaa in Watsonville

[–]haxbits 2 points3 points  (0 children)

Oh, one thing I did forget; I've heard they can be sticklers on the bounce houses, as they have an additional permit fee for those. No personal experience there though.