Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

Last on Land: Devlog #2 - Problems with Gridmaps

A topic by DawnsCrow created May 03, 2020 Views: 348
Viewing posts 1 to 1
(1 edit)

Last on Land: Devlog #2 - Problems with Gridmaps

Player Controller:

Implemented player controller for the player character, made First and Third person player characters for testing and after playing around with each felt that the game feels much better in First Person and this perspective fits with the gameplay the most. By using First Person perspective and a very fast playstyle it increases the risk of falling into water as the player has a much more limited angle of vision into pits and the speed of the player movement gives players very little chance to react. The player movement is currently basic and will most likely have further work done but is intended to feel very Quake esque with fluidity of movement playing a major role in the gameplay.

The player's camera is controlled with mouse input with the left and right controlling the rotation of the whole character model but the up and down controlling only the camera and the weapon. Player now has a simple testing weapon that fires a large rocket like round in the direction the player is looking.

Tile Deletion:

I have implemented a basic start to the map destruction with player weaponry, with the new player weapon system in place I began to work on detecting the collision of the bullet with the Gridmap and removing the tile that was collided with, this feature was set to be the primary concept of the game with an increasingly diminishing map until there is a single player left on the map. This feature is mostly working and in place and the player does have the ability to shoot and remove individual tiles however the system felt very inconsistent and there were many occasions where collision did not seem to be detected and the bullet would simply pass through the map either entirely or through  some tiles and would eventually collide with and remove a tile in the distance. Unfortunately after spending days attempting many different methods to reduce the inconsistency of the detection and attempting to find a solution, I finally found the actual cause to the problem. The problem with Godot Gridmaps:

The main issue with gridmaps in godot at the moment is their very limited ability to detect which cell in the gridmap the collision happened in. I discovered that there was actually no issue with the detection itself but a collision can only detect whether it has collided with the gridmap itself as a whole and the current best method of identifying the cell is to use the world_to_map method gridmaps have which in short takes a world position in the map and then compares it with the gridmap to identify which cell occupies the the same position. This sounds perfect right? All I have to do is pass in the colliding bullets world position and problem solved, I thought so and thus the reason why I questioned the collision detection and not the gridmap cell detection. Well after some further investigating I realised that the key issue is with the world_to_map, as you pass in the bullets position in the world as soon as the collision is detected the bullets current position in the world is technically still the adjacent tile, and as I am ignoring cells that are blank and removing cells that contain a mesh I am often passing through the object as the bullets position was not within the desired tile I hit when it attempts to remove the cell. I discovered this by reversing what I was doing and instead of setting a cell to be blank I was setting the cell to be a dirt block and I noticed how often when a tile is hit at an angle the block is placed on top rather than replacing the tile.


I intend to have more of a play around with this detection system and see if I can come up with some kind of work around and improve the system but I am not certain that gridmaps in their current state are the optimal system for me to use for this project and I may need to reevaluate my map generation method.

Here you can see the player controller and the map destruction in its current state with the inconsistent tile detection.