actionscript3 isometric library (v1/v2)
February 13, 2009Posted by on
As I am working on making the demo application, I have encountered an issue with the DefaultSceneRenderer. Check out these screen shots:
The issue arises not from the comparison algorithm used in Array.sort(compareFunc) but rather in the fact that the built-in Array sort method does not iterate between the two objects that should be swapped in the 2nd image. I am investigating other options however implementation of manual sorting methods (e.g. Insertion Sort, Merge Sort, Bubble Sort) does not yield any better results.
The ideal scenario would be to have a sort method that compares all possible obj pairs. Though not ideal in terms of performance, this would be mitigated in the idea that maps containing variable elevations/terrain could be separated into unique scenes such that it uses a different ISceneLayoutRenderer.
The other approach is that I might have to implement some sort of parenting of animated objects to static objects and pass them over to adjacent tiles. This is the current method that the Open Space Engine utilizes. I also have my suspecions that the engine used in Dofus and Wakfu might utilize this method as well.
All commentary is welcome.
I ventured down the object-parenting-to-tile scenario and had success. Though this works, it is restrictive in the sense that everything seems to be handled by the prototype ISceneLayoutRenderer. One good thing about my findings is that I was able to do this without modifying the API at all. But this was achieved at a significant cost. I can already see class-coupling and poor OOP further down the road. There is much manual checking against parenting tiles and bounds collisions.
In practice I think the idea of the whole object-parenting-to-tile scenario is poor OOP but I will continue to investigate this further.