Posted March 10, 2024 by Nat Quayle Nelson
In episode 3, Flyman & Miguel will meet with Jennifer, a kooky Christian butterfly collector. Here are some super chaotic GIFs which showcase my game engine and the scene in progress:
In my Hollywoo engine, your debug build *is* the editor. You type a keyboard shortcut like "d+p" (define position) and choose a position which has a string key, like "Jesus painting hanging up"-- then the screen zooms out and you click to reposition that thing. The scene then updates live. You can use "d+s" (define scale) to re-scale a prop, like the Jesus painting which started out too big. I'm always doing this, because I pull random images from various sources and have to scale them up/down to fit into my scenes -- like this Jesus Christ image, which came from openclipart.org. In that gif you see me reposition the Jesus image, then scale it down, then reposition it again. But I'm noticing that it's black and white with transparency, and ends up looking pretty grainy when scaled down to the right size, so I might go searching for a better image. There's gotta be a good public domain painting of Fake White Jesus out there, right?
Lots of other things in this scene can be redefined at runtime, like Flyman's position (currently, floating in midair when I actually want him to be perching on Miguel's head), the top-left corner of Flyman's flywriting text--and then there are miscInts and miscFloats.
When scripting a scene, I can call a function miscInt("newIntKey", 5) to define a new miscellaneous integer and give it a default value of 5. That value gets written out into a json file, and after the first time I run that part of the script, I can type "d+m+i" (define misc int) to give it a new value at runtime (which will be written out to the Json and become permanent).
So when scripting all the butterflies flying around here, I chose to place them in a grid with some random variance up/down and side-to-side. The number of rows and columns are both adjustable misc ints. Their product is the number of butterflies that will be flying around at any given moment. The butterflies wrap around when they fly offscreen to the left or right. They all also have a horizontal speed which is defined by a misc float speed + or - a variance value within a range that is also a misc float. And they have a waveLength and waveHeight, because they're moving up and down in sinusoidal patterns (which you can't tell because I didn't choose very good default values).
So here I go fiddling with those miscInts and miscFloats, then reloading the scene to watch how the tiny changes in butterfly variables cause a hurricane of visual changes:
I have to reload and restart the scene to get the new misc int/misc float values to take effect. That's because with position and scale, I've had to write specific logic to rearrange the scene at runtime without a reload. For misc ints and floats, which are *misc* for a reason, there isn't special handling to hot-reload and adapt. But maybe I will expand the miscInt() and miscFloat() functions to accept optional callbacks that can do such fixing! I cut the loading screen out of that gif, but it's an embarrassingly long loading screen (something I want to optimize eventually) that had to play once for changing the butterfly speed and once for changing their wavelength.
I didn't intend for the butterflies to keep moving in the background when the pause menu is open, but I think that happens to be kind of charming so I might not fix it.
I also didn't intend for Jennifer to look like Regina George--I was trying to model her after a specific kind of religious conservative woman I encountered a lot as a kid forced to go to church on Sundays. But with limited talent, just palette-swapping with the sprite packs I bought, I couldn't get the effect right. She still looks like Regina George.