Here is a quick example I just knocked together of how you could look to handle such a large grid of objects.
#constant TRUE 1
#constant FALSE 0
#constant MEDIACONTROL_MAX_OBJECT = 65535
#constant MEDIACONTROL_MAX_IMAGE = 200
disable escapeKey
autoCam off
set normalization on
set display mode 1024, 768, 32
set window on
set window title "Dungeon Keeper"
sync on
sync rate 0
sync
center text 512, 384, "LOADING..."
sync
type type_floatXYZ
x as float
y as float
z as float
endType
type type_camera
angle as type_floatXYZ
position as type_floatXYZ
endType
type type_gridTile
exist as boolean
position as type_floatXYZ
objectID as integer
visible as boolean
endType
type type_mediaControl
freeImageID as integer
freeObjectID as integer
endType
global mediaControl as type_mediaControl
global camera as type_camera
camera.angle.x = 50
camera.angle.y = 0
camera.angle.z = 0
camera.position.x = 0
camera.position.y = 50
camera.position.z = 0
global firstGridObjectID as integer
global lastGridObjectID as integer
global maxRealGridObjects as integer
maxRealGridObjects = 200
isFirst = TRUE
for o = 1 to maxRealGridObjects
tObject = mediaControl_freeObjectID()
if (isFirst = FALSE)
clone object tObject, 1
lastGridObjectID = tObject
else
make object box tObject, 8, 8, 8
firstGridObjectID = tObject
isFirst = FALSE
endIf
next o
global dim grid(100, 100) as type_gridTile
for x = 0 to 99
for z = 0 to 99
grid(x, z).exist = TRUE
grid(x, z).position.x = (x * 10) + 5
grid(x, z).position.y = 0
grid(x, z).position.z = (z * 10) + 5
next z
next x
repeat
camera_update()
grid_update()
text 0, 0, str$(screen fps())
sync
until (escapeKey() = TRUE)
end
function camera_update()
inc camera.position.x, mouseMoveX()
dec camera.position.z, mouseMoveY()
if (camera.position.x < -20)
camera.position.x = -20
endIf
if (camera.position.x > 1020)
camera.position.x = 1020
endIf
if (camera.position.z < -20)
camera.position.z = -20
endIf
if (camera.position.z > 1020)
camera.position.z = 1020
endIf
position camera camera.position.x, camera.position.y, camera.position.z
rotate camera camera.angle.x, camera.angle.y, camera.angle.z
endFunction
function grid_update()
local lowX as integer
local lowZ as integer
local highX as integer
local highZ as integer
lowX = (camera.position.x / 10) - 6
if (lowX < 0)
lowX = 0
endIf
lowZ = (camera.position.z / 10)
if (lowZ < 0)
lowZ = 0
endIf
highX = (camera.position.x / 10) + 6
if (highX > 99)
highX = 99
endIf
highZ = (camera.position.z / 10) + 13
if (highZ > 99)
highZ = 99
endIf
local currentObjectID as integer
currentObjectID = firstGridObjectID
for x = 0 to 99
for z = 0 to 99
if (grid(x, z).exist = TRUE)
if (x >= lowX)
if (z >= lowZ)
if (x <= highX)
if (z <= highZ)
position object currentObjectID, grid(x, z).position.x, grid(x, z).position.y, grid(x, z).position.z
inc currentObjectID
if (currentObjectID > lastGridObjectID)
exitFunction
endIf
endIf
endIf
endIf
endIf
endIf
next z
next x
endFunction
function mediaControl_freeImageID()
local i as integer
repeat
inc mediaControl.freeImageID
if (mediaControl.freeImageID > MEDIACONTROL_MAX_IMAGE)
mediaControl.freeImageID = 1
endIf
inc i
if (i > MEDIACONTROL_MAX_IMAGE)
exit prompt "Media Control > Ran out of images", "Error"
end
endIf
until (object exist(mediaControl.freeImageID) = FALSE)
endFunction mediaControl.freeImageID
function mediaControl_freeObjectID()
local i as integer
repeat
inc mediaControl.freeObjectID
if (mediaControl.freeObjectID > MEDIACONTROL_MAX_OBJECT)
mediaControl.freeObjectID = 1
endIf
inc i
if (i > MEDIACONTROL_MAX_OBJECT)
exit prompt "Media Control > Ran out of objects", "Error"
end
endIf
until (object exist(mediaControl.freeObjectID) = FALSE)
endFunction mediaControl.freeObjectID
It will obviously need some work. In this example you have a fixed number of real objects which are repositioned as required to look like a much larger grid. Because of how much the camera is zoomed out in this example you can see the blocks jump around but this is intentional so you can see it working.
Whilst this would need a bit of work to get it to match your needs entirely, this example runs at 1600 fps for me rather than the 15 fps you mentioned. Let me know if you need any more info.
Thanks.
[Edit]P.S. Move the mouse to move the camera about![/Edit]