I am working on a tile based game that renders the playing surface in a viewport. I am struggling with getting my head around the mechanics and best practices of rendering a viewport, specifically a scrollable viewport.
Typically the entire playing surface is made up of many adjoining tiles, and will display a portion of the surface to the user. The user will be able to scroll around the viewport by dragging or scrolling (North, east, South, west directions)
What would be considered best practice, for example.
- would one render and update every tile in the playing surface whether visible or not (I could see this using potentially a lot of processing time on larger maps with processing and needing to update every tile), or;
- should one only render what is visible to the user (and a few additional tiles around the edges to ensure that it looks like everything is rendered and avoid holes in the map)
I am quite new to game programming and would appreciate any thoughts and guidance of best practice in this area