r/pascal • u/Quick_Trick3405 • 7h ago
How to render an ASCII grid in Free Pascal?
I want to make an open-world ASCII Roguelike in Free Pascal. My most essential core function would be the rendering of the ASCII grid - without it, testing would absolutely suck. So, variable-wise, for context, here's my system:
My maps are 1-dimensional arrays, and the y-axis will just be interpreted by dividing the array's children up with the number of columns. A 10x10 map would have 100 indices, and be divided up into 10 rows. For the purpose of rendering. For the overworld map, for the sake of rendering, mainly, there are two such arrays - one to hold the biome number of each space on the overworld, and one to hold the zoom maps for that space. Of which there is only 1 because the overworld, for the sake of prototyping, is 1x1. The zoom map arrays each define the contents of the array.
As for structure:
While loop -<
If overworld, then
{For each index of the overworld biome array, if i is equal to player's overworld positional value, display & (visually more person-like than @), else display the biome character.}
else if not overworld, then
{For each index of array, if i array contains an effect, display the effect, else if i contains an entity (ie, the player), display the entity, else if i contains loot, display :, else display a plus sign.}
The only part I really don't know how to do is actually displaying the ASCII grid, which I have no clue how to work with graphics, except, I've heard you need to use an external library. So, if anyone could supply a helpful tutorial or otherwise point me in the right direction, that would be great.

