Writing a 2d side scroller and thinking about the drawing aspect and collision aspect. Its not classic tile based, but instead in the map editor you can place a node at any position in the map (not restricted to placing in a tile), with modifiable rotation/scale. There are multiple layers within a map and each layer can have multiple nodes. So there is a List of Layers, and a List of Nodes within each layer.
(For a better idea of the map editor I made, it is something along the lines of this:
Editor )
Just to give an idea of how the data is structured, this is what the layer lists and node lists could look like
Layer List { Layer 1, Layer 2 }
Layer 1 Node List{ Node@228x459, Node@105x322, Node@892x370} 3 nodes in this layer
Layer 2 Node List{ Node@500x250 } 1 node in this layer
Question: Drawing the nodes
When drawing the nodes I don't want to draw each node within each layer since some of the nodes may be off the screen. Unfortunately since I am not using the classic tile implementation I can't just iterate through the tiles that are currently within the retangular view of the camera and draw only those tiles in each layer. So my idea is to create a grid of the entire map that associates each of the grid squares with the nodes that are contained within the square. The data structure would be an Array of Node Arrays. Each element in the array is associated with a specific grid square (maybe 128x128 pixels) and there could be multiple nodes that are part of that grid square.
For example:
Consider a map that is 256x256 and were using 128x128 grid squares. this means the data structure will be 4 elements (the map is split in a 2x2 grid)
A[0] = {N0, N1} upper left square, node 0 and node 1 are in this square
A[1] = {N0} upper right square
A[2] = {} lower left square, empty
A[3] = {N1} lower right square
Lets say the camera's viewport was set up to only view 256x128 pixels. If it was currently viewing the bottom part of the map (grid square 2, and grid square 3), we would look at the nodes in A[2] and A[3] , meaning we would only draw N1.
This also speeds up collision detection as I will only do collision detection on entities that are part of the same grid squares.
Let me know if this makes sense, if I need to explain it more, or if there is a much better way to accomplish this task.