Original Post
Does anyone here have opinions on whether prototype-based object orientation has advantages for game scripting? Prototype-based: Objects don't belong to predefined categories, but gain certain functionality at run time. (more exotic, used in javascript and io) <!--STARTSCRIPT--><!--source lang="cpp"--><div class="source"><pre> someobj = Object.clone() someobj.f(x) = { <span class="cpp-keyword">return</span> x+<span class="cpp-number">1</span> } </pre></div><!--ENDSCRIPT--> Class-based: This is the more familiar type of OO, used in Java, C++, etc. Objects have certain functionality determined by which class they belong to. <!--STARTSCRIPT--><!--source lang="cpp"--><div class="source"><pre> <span class="cpp-keyword">class</span> SomeClass { f(x) { <span class="cpp-keyword">return</span> x + <span class="cpp-number">1</span> } } someobj = <span class="cpp-keyword">new</span> SomeClass </pre></div><!--ENDSCRIPT--> I don't have much experience with prototype-based coding and it seems very unnatural to me. But I'm thinking that maybe the lack of structure might be somehow beneficial for game scripting (where you might want to add capabilites to an NPC at an arbitrary point in the game) Any ideas? -Alex