I am new to using SDL and have been put with a dilemma.
What I do in my code is that I have SDL make a map grid of 64x64 tiles in which a character then moves from tile to tile. To smoothen out the movement of the character I use a classic for loop to change x/y-position by 1 until 64 pixel-moves have been made (makes him slide across tiles instead of jumping).
The problem with this is that I currently re-render the texture every time the character moves (each pixel) again for the smoothness, but I want to add an artificially intelligent monster moving independently to the character. Imagine “Tibia” game mechanic in where a monster moves as it wishes without affecting the player movement.
Using the same game loop with the same rendering function doesn’t do the trick due to that it cancels either the player movement or the monster movement temporarily (probably because of the for loop). I tried with using a secondary thread to process movement of the monster but I face the dilemma that both the character and the said monster uses the same renderer.
Any tips on how I can proceed?