Fertility Greybox

šŸ“… 2023-04-23

Today, since I streamed and then collapsed onto the bed and died for a few hours, there isnā€™t a lot of time to make a big difference here. I also took an hour or two to implement firebase into our site with the help of ChatGPT so thereā€™s a little like button and a viewcount for each page, feel free to bang the heart. These should either help me feel better or worse about these development blogs, I guess time will tell. I ran out of messages with GPT till 9:18PM though, so I guess they're gonna look like that for a little while.


But back into Unity, I want to extend the greybox loop, so first, letā€™s change the altarā€™s so that the segments stop spinning once theyā€™re ready for the next stage of existence, aka ā€œalterBuilt = trueā€. Thatā€™s a simple change, we just run the bool through the update so it can stop once its built. Also donā€™t @ me about how I keep changing from Altar to Alter spelling, itā€™s a greybox, okay? I donā€™t know why Iā€™m like this.



I also felt pretty quickly during testing, that moving the altars around via a base draggable is just not how I want the game to feel - that would work better maybe for a game where youā€™re running around with ingredients to throw into a cooking pot or something? And since ā€˜Mirrorsā€™ focuses around the use of chalk to leave signs and symbols for the other sisters as you pass through the halls, I figured lets make creating an altar, slightly more witchy, by getting the player to create an altar in a specific spot by drawing a little chalk circle. Iā€™ll reuse the door sigil for now but use your imagination. Letā€™s use a simple script on the camera to accomplish the spawning via a raycast.



Basically, we press a button and create a raycast from the cameras transform out to its forward position, and if it hits the spawnableLayerMask, and if the angle is correct (basically parallel to the floor) than we spawn an altar. We also have to change the altar to no longer be a draggable rigidbody so we ripped out some of the code that allowed that and removed the draggable scripts from the prefab. I also changed the lighting a little and threw a point light on our player so we can vibe a little.



Much nicer. Of course, this means that from a design perspective because of how we designed our end gate, the player would rush to the end gate and draw chalk marks around the gate and then begin to fill them. This isnā€™t really the intended behavior, so we need to change how we handle the altar checks for the gate. I didnā€™t really like the system we made yesterday and suggested switching over to trigger boxes, and so thatā€™s what weā€™ll do. That way I can generate these randomly and then signpost the player to where they should create altars to trigger the gate.


So weā€™re going to create trigger boxes with an ā€œAltarZoneā€ script on them, and they will be called by the Altar upon being completed. All it will do is check if the call point (the altar) is inside the bounds of the collider.



We then change our completion code to include a boxcheck, basically a square spherecast as I understand it, to read the colliders in the local area. This says 20,20,20 but I changed it to 10,10,10 since that is much more reasonable. If it finds our AlterZone script it calls the gate and tells it ā€œyo, we built an altarā€.



Now the Gate code becomes way more simple, we just have a list of altars that have been called, and then when we have the desired amount, we spawn the door. We throw three of these zones in the level, one in each room for the greybox, and once all three boxes have a completed alter in them, the gate powers up in the final room.




We do have a few issues - right now the player can spawn altars in an unlimited fashion, but we can stop that from occurring in the actual loop by making it linked to having the chalk, and then giving a use amount to the chalk. This chalk will also be used to create doors into hidden rooms, so that the player can actually find altar zones, and then power up the ā€œgateā€ which in the case of the actual loop, puts the loop into the next state of waiting. Which is what we should work on next.


We do need a few things for the next part of the loop, not sure if Iā€™ll get them all in tonight, especially since BuddyGPT is napping, but letā€™s see what we can do. First things first, we need a new kind of item, this one in the actual loop wonā€™t be a draggable, but since we donā€™t have an inventory in this version of the greybox, lets make it a new draggable and just call it, AltarItem.


Oh! Actually, our GreyboxItem script already has an ā€œAltarā€ bool that we no longer use because the Altars themselves donā€™t have these scripts anymore, so letā€™s reuse that, and modify the Altar itself to take a fourth item if it has health, and is complete. So we just add a new GreyboxItem slot in our Altar, ā€œpublic GreyboxItem altarObject;ā€ then change our trigger enter to accept a fourth item.



Now we adjust the AttachObject method to accept the fourth object and we also need to create the altar item. Maybe we wonā€™t make it a cube for those who donā€™t vibe with the greybox look. Letā€™s make it a fertility statue, because those are cool as fuck. And we played that cool Gobekli Tepe game today and Iā€™m feeling it.




Now, will it work?



Lmao, thatā€™s sick. Listen, I try not to blog things like lmao rofl omg rawr but when something turns out that cool on the first try I get one, okay? One thing we need to do is prevent the player from adding the fourth item until the gate it open, soā€¦ Uh, lets grab the gate, and check if its ready for fourth items. Weā€™ll add a bool to it and a new int to count how many altars we have topped (UWU).



And we should probably change our CheckPlacementZones method to store the gate, so that we can call it to check if we can place a fourth item. Letā€™s store both the altar placement zone and the gate when we find them once the altar has been built. Actually, thatā€™s weird, I already have a definition and findobject for our greybox gate in the altar scripts, we just never use it, how silly. Let me fix that.



Okay, so we should have to build all three altars before the gate can power up. Then once its powered up, we have to add all three fertility statues to get it to power up to the next state. I guess letā€™s try it, Iā€™ll also quickly add another door object on the gate so we can tell if itā€™s worked. Iā€™ll just have it go from blue to red. Or actually, lets go red to purple. Red is usually a color signifying incompletion so. Wish me luck.



Aww, we forgot to increment the fucking fourth item int in the gate, booo. Letā€™s fix that quickly.




Yos! Working great! And with time to spare, 8:45PM, letā€™s go! I think thatā€™s where weā€™ll leave it for the night, Iā€™m pretty happy with that progress. Itā€™s been a long day, and long covid got me feeling like Iā€™m constantly about to die so, letā€™s binge some youtube and wait for GPT4 to come back online. Where are youuuuu? Come backkkk! Also, I realize that we could totally re-purpose our altar code to build a snowman (it doesnā€™t have to be a snowmannn).