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).