Nihal Singh

I like to know things

GSoC Week 8: The Revival stone and the Password Door

Week 8 has come to an end and quite a few of the proposal targets have been met. The last two months have been phenomenal, to say the least. Since I had started work around 1 month in advance, I would be completing two months by the time the first evaluation completes in a few days.

What have I been upto?

This week saw more work on traps, two items in particular- the Revival Stone (to be named the Altar of Resurrection) and a Password locked door .

Revival Stone


With all the previous traps created (swinging blade, wipe out over lava, fireball launcher) being dangerous in nature, there was a definite need for a checkpoint that allows the player to respawn just before the trap. The revival stone does exactly this. A statue of an angel serves as a checkpoint that can be activated by the player. Upon activation, the angel statue lights up and the orb held by the angel starts glowing. At a time, a player can have only one checkpoint activated. Upon death, the player respawns at the last and only activated checkpoint.


The idea for the design of the model was very intricate. Unable to catch quaternius online, I went forward with a placeholder model for the time being, which looked like this-


Soon after, quaternius was back and ready to do some Blender magic. This was also probably the most elegant and beautiful work of his that has been added to the game.


The initial model he made was a flat one (left), but it was soon changed to a smooth version (right) which looked better.


The model is completely static and has no built-in animations. The same model is intelligently used for both the active and inactive states of the angel statue using just a texture change.

+ How does the texture change happen?
Every model is added to the game by first exporting the model to a .obj file and then creating an associated prefab for it. The associated prefab needs to have a MeshComponent that describes the mesh and the material. The mesh points to the .obj file exported using Blender. The material, on the other hand, is the texture (png image) that is UV mapped to the model.
The two states of the revival stone model only differ in texture. This is implemented using a simple material (texture) switch when the player interacts with the statue to activate it. As far as I know, this is the first usage of such a material switch in the game and it can definitely be used for more models to depict a change in state.

The two different textures being used only differ slightly- the texture for the active state has a brighter color for the angel’s statue and an orange color for the orb to make it appear lit.


Respawn mechanism

After a player dies a Death Screen is displayed. Upon clicking the “Respawn” button a RespawnRequestEvent is sent and the spawn location is found using the World Generator information and the player respawn happens. This whole process was broken down using this Engine PR allowing other systems to alter a player’s respawn location.

+ How is the respawn mechanism implemented?
The RespawnRequestEvent that is sent when the "Respawn" button is clicked on the Death Screen was being used to modify the LocationComponent of the player entity and line it up for respawn.
This process has now been broken into multiple parts. A method receives the RespawnRequestEvent with a "CRITICAL" priority and sets the respawn location as per the World Generator information. Another method in the PlayerSystem receives the RespawnRequestEvent with a "TRIVIAL" priority and initiates the whole respawn process for the player entity.
Any other system present in any module can receive the RespawnRequestEvent with a priority between TRIVIAL and CRITICAL (both exclusive) and make a change to the LocationComponent of the player entity to allow for a custom respawn location.

Particle Effects

This was the first time I fiddled around with any particle effects of my own. The particle effects consisted of a bunch of blue mystical particles that rise from the base of the statue towards the top, upon activation. I also reused the smoke explosion particle effect from the core module along with it, to give an added effect. The whole thing in action looks like this-


+ How to create such particle effects?
To create the above kind of particle effects I had to create a prefab for the particle effects and then build and spawn this as an entity. The linked gist has a lot of parameters as components that allow me precise and specific control over the particles.
For instance- the positionRangeGenerator allows me to ensure that all particles spawn at the bottom of the statue and the velocityRangeGenerator allows me to make all the particles ascend upwards.

Upon deactivation, only the smoke effect is played.


In addition to the texture change, there was a need to add lighting for the orb to appear as glowing. This is done by creating a simple orb entity which spawns near the location of the orb and has a LightComponent attached. Using the light component the two states of the revival stone appear as such at night-


The PR for the revival stone is not complete yet, as some fixes are still required to make it multiplayer compatible. This PR contains all the progress so far. A working video with the placeholder model completely functioning in Single Player follows-

Password Locked Door

There already existed a door in the Core module that allows for simple opening and closing with player interactions. It has a nice system that takes care of placing the two blocks long door in the world, with a nice texture and cool sound effects. I decided to reuse all of this to create a door that would require a password to unlock.

The password door essentially extends the door from the core module. It uses the existing systems in Core for the basic features and simply overrides over the functionality that needs to change by receiving the respective events with a higher priority. For instance, the ActivateEvent handler in the PasswordDoorSystem receives (and consumes) the ActivateEvent with a higher priority than Core’s DoorSystem. This allows the display of a UI Screen that lets the player enter the password to unlock the door.


Note: A password door can be made indestructible in an area, for the purpose of being used in traps and puzzles.

Here’s a full video showing the Password Door in action:

What’s next?

For next week, I would spend most of my time working on trying to make most of the created traps compatible in Multiplayer mode so that they can be tested out in the Multiplayer play-test scheduled to happen this Saturday- the first of July.