DEV Community

Graham Long
Graham Long

Posted on

Gamedevlog: TilMap Part 3b

Building on Part 3a

This main purpose of this update is to expand upon the previous work to generate a level by adding the following features:

  • Create an empty tile which indicates the edge of a scene.
  • Prevent the player from entering the empty tiles.

The Empty Tile

For this I generated a simple tile model in blender and exported it as obj and mtl files:
empty tile model

Then created an empty tile file which can be reference by all tiles at the edge of the scene.
empty tile file

VTF File changes

The eagle eyed among you may have notice the new TF line in the vtf file.
I added this to set the fluidity of a tile i.e. how easily the player can move through the tile, this value will be multiplied by the distance the player wishes to move to determine how far they actually move.
Most tiles will have a value of 1.0 for this, but tiles which the player can't enter will have a value of 0.0 to prevent any movement within the tile, going forward this will also allow tiles which slow the player down e.g. quicksand or mud or even tiles which speed up the players movement.

Other changes

So far, as part of the process of using the fluidity value I have decided to revert back to using my Vector3Float classes along with a new Position3Float class rather than using Triples whenever this makes for more readable code, e.g. if the 3 values are simply related then I will leave them as a Triple but if the 3 values represent either a 3D Vector or position in 3D space, I think it makes the code more readable to use the custom classes, it also allows me to add operator overloads to make subtracting one position from another possible among other things.

The Plan for development

From here I need to brush up on my math skills to determine where the player should move in the TileMap based on the fluidity values.

Then I shall generate a simple level which I can use for testing, and develop more of a sense of where the gameplay is heading, my current thinking is a VR world building game where you can place trees, plants, fences etc to build up your own environment, to do this I foresee the following advancements in the design:

  • A HUD style menu, to select the objects which the player can place into the world.
  • Enabling transparency so the player can see where the object would be before they place it.
  • Updating the .vtf files when changes to the tile are made.
  • Some sort of collision detection so objects are not placed on top of each other and so the player can't walk through the objects they have placed.

Until next time, Stay safe and happy coding.
Graham

Top comments (0)