I thought I should link this thread to this trac ticket http://trac.wildfire...com/ticket/865 My main concern is about the code in UnitAI.js which will grow steadily throughout the development process. If its not clean now, It will become a real mess over time. So, I've got a few questions concerning simulation: 1/ Is there any requirement of maintaining C++ source as small as possible ? should I create new C++ functions when I need them or try to uses a javascript wrapper instead ? e.g. if a C++ function take entity's position as parameter but that it's easier for me to call it with entity's id, can I overdefine it and expose it ? 2/ If I need to compute the distance between two entities, should I do it in CCmpPosition.cpp (+++), UnitAI.js (-) or in any helper.js (+?) file ? 3/ Is it possible to see how much time takes UnitAI to run ? (benchmarking purpose) Theses questions will probably seems stupid, but.. need answers (I will take them as a guideline) in order to code remorseless and enjoying it