[SOLVED] minecraft clone question (python programming)

i am trying to create a 3 dimensional grid of cells which are on or off (think minecraft clone). in c i would have a 3 dimensional array of bools (essentially) to denote if the cell was on or off and draw() would draw a cube if the cell was ‘on’ and would do nothing if the cell was ‘off’.

in panda3d (python) i have written this code:

block = loader.loadModel("media/cube")
block_scale = 0.5
block.setScale(block_scale, block_scale, block_scale)
block.setPos(0, 0, 0)

essentially, i guess my question is, how would one go about making a 64x64x64 grid of ‘blocks’ without calling loader.loadModel() 64x64x64 times?

so for example, i want to setPos() on each block as a factor of the index for that block in my 3 dimensional array analogy. so block[2][17][31] might be drawn centered at position (2.0, 17.0, 31.0). however i only need to setScale() once because each block is drawn identically. thanks in advance to any help.

albhertglasz created something like what you are looking for: [mInicraft (work in progress))

I think he does it using Geoms rather then loading a model.

Also another person has created this smaller snippet:
[Minecraft-like chunk generator)

Again, using geoms. Not sure if its better performance rather then loading a model.

Anyway - maybe you could use copyTo to copy your initial node around, but that sounds a bit intensive. [need clarifications on how to propely copy a node and parent)

This thread might also be useful, in particular since its mentioned calling loadModel isn’t too bad since Panda caches it:
[block world)

thanks for your reply and also found this helpful:

i would say that rendering geoms has many advantages and ultimately i intend to generate geometry in largest chunks/fewest polygons possible (again just as minecraft does). this way i can render huge voxel scenes with good framerate.