Cristianwolf712 Posted January 3, 2014 Posted January 3, 2014 Hi guys, first of all, Happy new year to all of you. As I described in another post I've tried to migrate my "old" game code to the new framework. In my old world-scripts I created my NPCs on the fly during the intif()-function. There is no need of manually place them in the world and load them from the framework. So where is the best way to implement that functionality? For now I started to created them during the "onInit"-function with the following lines: forloop(int i = 0; 36; 1) { NodeReference newRef = new NodeReference("games/HoL/nodes/humanbox_green.node"); Node newNode = newRef.getNode(); Soldier newSoldier = new Soldier(); newSoldier.init("Soldier" + i,this,newRef); PlayerActor newActor = class_cast("PlayerActor",newNode); ControlsDummy newController = new ControlsDummy(); newActor.setControls(newController); if (newActor == NULL) log.message("Downcasting node to PlayerActor have not worked!"); //log.message("Controller set for %s",newSoldier.getName()); //node_remove(newActor); //newSoldier.SetPhysicalPawn(newActor); //newSoldier.setPosition(vec3(rand(-20.0f,20.0f),rand(-20.0f,20.0f),0)); } I want to create 36 Soldiers at the same time and position them randomly for some testing purpose. What have worked in past doesn't seem to work now. If I create my NPCs without the ControlsDummy all seem to be working fine. If I used the code as above I get the following error: 14:40:47 HeapChunk::deallocate(): memory corruption detected 14:40:47 begin: 0x0f6a3d80 0x131c3c1f 14:40:47 end: 0x01f0f1cd 0x01f0f1cd 14:40:47 size: 0 256 It seems it is pretty much the same error as in that topic: (https://developer.unigine.com/forum/topic/1595-solved-unigine-script-call-stack-overflow/?hl=memory+corruption#entry8453) If I uncommenting the last to lines unigine stopped working without any notification after three or four steps. The built is the last one from 28 December. Best regards
silent Posted January 10, 2014 Posted January 10, 2014 Hi Christian, This issue was successfully reproduced and all information was sent to the developers. Thank you! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
silent Posted January 10, 2014 Posted January 10, 2014 Hi Chrisitian, I'm afraid, type of humanbox_green.node should be exactly PlayerActor. Please, change node type of this node and try again. Also, if you want to create new Entity (for example, Soldier) the best way to do it by using the GameFramework's built-in functions (Level::createEntity() in this case). Good example how to spawn units you can find in framework/samples/tests/path_finding sample. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Recommended Posts