Hi Varen
Interesting questions. Let's start with the ones that are easy to answer:
2) yes you can mix and match
3) there should be no problems there, we do something similar for our own games. Our game server sends a mesage to the client who then calls wade.iso.createObject, wade.iso.setTile or any appropriate wade function.
Now about your first question, that's a bit more complicated :)
First of all, in terms of memory, I don't think that 8k x 8x is a problem if you have mostly the same type of tiles.
The scene file generated by WADE may be quite big, but if you don't fill all the map with all the details to start with, it will be very easy to compress. Meaning that despite its size, it will not use much bandwidth if your server enables gzip compression.
You may use your image approach if you like, and I think that the logic for handling that wouldn't be too difficult. It will make the file smaller, but remember it's usually the g-zipped size that counts, so I'm not sure it would be worth the effort.
Either way I wouldn't worry about memory. However in terms of performance there are some things to consider.
WADE uses a quadtree system (optional but it's active unless you disable it) to keep track of the objects in the game world. This means it can very quickly know what objects are currently in a given area, without having to iterate over all the objects in the world.
It uses this quadtree system to determine what needs to be drawn onto the screen for each frame of the game. So in that respect, having a 100x100 map or a 8k x 8k map will make little difference, assuming that you are only looking at a small portion of the map it will take approximately the same time to draw.
However WADE currently does not use this system to decide what objects need to update their status. For example if they are moving WADE needs to caclulate their new positions, taking in to account collisions, etc. If they have active animations WADE will keep track of which frame is supposed to be playing. If they have onUpdate functions, WADE will execute them. And so on.
Right now this logic is applied to all the objects in the world. We do have a plan for WADE 3.8 to change that and give you more options rather than just updating all the objects in the world. You'll be able to decide if you want to restrict updates to objects in an a specific area, or an area around the camera. But we are currently on version 3.6, so that's a few months away.
With the current system, you'd have to handle that logic yourself. Updating a single animation may take a fraction of a millisecond, but if you have thousands of them it quickly adds up. Custom onUpdate funcitons (depending on how you write them) can be slow - if a single one takes a millisecond to run, you don't want to have more than a dozen active at anyone time.
To answer your more specific question:
> Even better, if tiles outside of the screen are not being drawn is there a function I can hook into for loading data when certain tiles enter the visible area?
Yes you can do that, but I wouldn't recommend it :)
Each tile is associated with a Sprite, which is ultimately the entity that gets drawn onto the screen
var sprite = wade.iso.getTileSprite(x, z);
You could use a custom draw function of the sprite that is triggered when the sprite is drawn, like this:
sprite.originalDrawFunction = sprite.getDrawFunction();
sprite.setDrawFunction(function(context)
{
// add code to execute when the sprite is drawn
// then call the original draw function
this.originalDrawFunction(context);
});
While this may work, it breaks the separation between drawing and simulating your objects, and that is rarely a good idea. But if you understand the implications you can go ahead with this approach.
Alternatively you could create a main loop (which is executed once for each simulation step, as opposed to each drawing step) to monitor which tiles are on the screen:
wade.setMainLoop(function()
{
var halfWidth = wade.getScreenWidth() / 2;
var halfHeight = wade.getScreenHeight() / 2;
var visibleArea = {minX: -halfWidth, minY: -halfHeight, maxX: halfWidth, maxY: halfHeight};
// Do this to get all the objects in the visible area
var visibleObjects = wade.getSpritesInScreenArea(visibleArea);
// Do this to get all the tiles in the visible area (only objects on the terrain layer)
// We first need to transform the screen coordinates into the terrain's world coordinate system
var terrainLayer = wade.iso.getTerrainLayerId();
var terrainArea = wade.screenBoxToWorld(terrainLayer, visibleArea);
var visibleTileSprites = wade.getSpritesInArea(terrainArea, terrainLayer);
},'check visible objects');