Hey hey people,
Basis: Map each tile in the grid to a pixel on a texture, slap it on a plane.
Manipulate texture memory to generate black, grey and white (transparent with my setup).
What for? Fog of war. Control which tiles are hiden, explored and visible.
Reference code that I’ve tested enough to know this is possible.
from bge import logic,texture
obj = logic.getCurrentController().owner
mat_id = texture.materialID(obj,texturename)
tex = texture.Texture(obj,mat_id)
tex.source = texture.ImageBuff()
size = 64*64*3 #texsize times three
buff = bytearray(size)
def main(cont):
buff[0] = 0 #R
buff[1] = 0 #G
buff[2] = 0 #B
# ^ color of first pixel
tex.source.load(buff,64,64)
tex.refresh(True)
The question is, how well could this work on a larger scale?
Am I good building a fog of war system around this or should I keep looking?
Any ideas?