donderdag 27 april 2017

Weather System, Instantiation and Skyboxes

So, an elemental obstacle course has to really stand out.




To do this I had to modify the teleportation system I used to a big extend. I had to add to following functionality :

  • De-instance the levels that are not being played.
    • And to compensate the telporter has to instantiate the level loaded. This is also very important for performance.
    • And thus create a small script that de-instances all the levels beside the lobby on game start.
  • Change skybox depending on the level loaded.

But the code  of the teleporter is still very clean and compact. The fact that a lot of code is pre-written in Unity helps a lot.

I also made a weather system using particles that:
  • Trails the player as the player progresses in the level. Floating above the player, making a rain system that covers the entire level is too taxing for performance.
  • Displays the correct particles and properties depending on the loaded level.


zondag 23 april 2017

Spawnpoints and Colliders.

For the past day I have been working on a spawnpoint system. I was inspired by games like Roblox, where you would respawn on a checkpoint you touched, I wanted to recreate this within Unity.

Here is a very early example of what would be called an obstacle course. Every blue Platform counts as a checkpoint and makes the player respawn there if they lose. (Touching Killzones)


As you can see here, the code isn't quite complicated. It simply puts the player towards the spawnpoint position if the player touches a killzone and it moves the spawnzone if the player toches a safezone.

In practice this is a very early example of toying around with losing and respawning.


Update 1: I managed to add teleporters as well, I further adjusted the frequency and appearance of the spawners whilest keeping the style simple.



As you can see I've added a lobby to spawn in, whilest also having the white squares counting as a spawn point. The blue square in the lobby teleports you to the first course, which you can see in the background.
The code I used on the teleporters, is again, very simple, and uses the tag system that Unity uses. while having a gameobject from within the scene attached to it.



Update 2:
I added another level where I made blocks that fade away when you walk on them and reappear after a given time.


This was quite a challenge to set up at itself, but I used a switch-state machine to have it work flawlessly and sequential.




This way none of the states mess with each other and it automatically loops itself back to the default position (0) if you're not standing on it.