Jump to content

Chiblue

Members
  • Posts

    589
  • Joined

  • Last visited

Everything posted by Chiblue

  1. I understand why you say this, but in my experience with Dark AI it is pretty extensive and can be used to do many things.. I had the AI players responding to sounds the FPS player made like walking and firing.. you can set the AI to stay within areas, follow paths or free roam, or a combination of all 3... you can also trigger investigation to specific locations... or patrols etc... I have attached the Dark AI help file, this will assist in understand some of the capabilities... Dark AI.zip
  2. I have attached a couple of classes and some code I used within my project to use the dark AI engine with LE. You will need to add the usual AIStart and AIUpdate calls in your game loop.. sorry the code is not very clean I did this really as an experiment to see if it worked, you do have to play around with the settings for the AI to get the behaviour you wish to have... I used this with Gamelib this is why you see TSCene everywhere.... I have tried to document within the files what they do and that the functions do for you... I hope you can get this working... Dark AI for LE.zip
  3. Maybe we should start a LE community project to build a AI engine which is intergrated to LE. I would be interested in working with anyone who would like to build something, let me know and I will post my test code for dark ai, which uses open gl not LE but the concepts are the same.
  4. Can you explain what you mean by this, are you saying that you need to do a ray cast at all objects before you enter your game? If so I am confused, because your player is moving would the raycast origin continually change and make any pre-raycast worhtless, or is there something about the raycast engine that I am missing? Also on the Dark AI, I did get it working and it worked pretty well, I had some problems integrating it with LE but I got around that, the main thing I found was becuase the AI is not directly controlling your characters you have to ensure that the AI does not get to far ahead of the characters animated movement... also getting the AI obstacles registered was fun but again I got this once I understood the clockwise/anti clockwise BS, as usual the doc sucks and the forums are about as helpfull as a knife at a gun fight... Anyway, if you are interested I would be happy to put together some doc on how I integrated it for you?
  5. what macklebee said, infact the problem was specific to transitioning between hitting an object and then nothing or distant terrain... Also I am not talking simply path finding, although this is part of it... what I need is a single stateAL that will can be switching into differed behavours based on sounds, hits or other events... Dark AI provides much of this, but using it in LE is very messy... But this said I can work around this messy AI integration, if only, if only the raycast di not hang...
  6. I have now found myself back working with Dark GDK, which really is disappointing for me as I really like the LE tools especially the integration of the Editor and LUA. But I though it important that I post why I went back to comething that is for the most part less functional... There are primarily 2 issues I have with LE, the first is the lack of any AI functionality, yes there are several AI libraries you can get but the ones I have used really do not integrate very well and I find my AI functionality struggling mainly due to inconsistencies between LE and the AI engine... strange enough the one I have most success with was Dark AI, but the collision and movement mechanisms took a lot of effort to get working and still had glitches... Secondaly, I had significant problems with the raycasting which continually hung my game loop.. this was basically providing an ingame range finder which continually casted to find distance to objects and displayed them on the scope... I would ask that LE adopts an AI and provides some support for it, or develop thier own... I am not sure what to do about the raycast problem, and maybe the latest version fixed it, I will have to try... Anyway just wanted to post my thoughts... this is not intended as a criticism more a wish to use the engine..
  7. It's not actually Gamelib that has the circular reference issue, but due to the scene class referencing game class when you try to add additional classes unless you play games with the code you get circular references.... plus the gamelib does a lot of stuff I do not need or had to rewrite some of the code to work differently... sorry i am not criticising gamelib in anyway, it has some very useful code but I am moving away from it becuase I want to clean up my source to only use the functions I need...
  8. Now I have developed most of the technology I need for my project I am decided to build my project using LEO rather than Gamelib, for no other reason than sometimes Gamelib causes multiple circular references and building my own classes i can be more puristic for my game needs... anyway, I keep getting this message when I run the shell program, ERROR: unable to find DLL function: ControllerCrouched I am running 2.31, i was not getting this with Gamelib, any suggestions would be helpful..
  9. Why would you not just do a raycast for the distance of the projectile and then calculate a projection curve to hit that point... if you don't hit a target just us a pivot entity to move to the range distance from your weapon... check the raycast to that point and plot a path to there? Alternatively, You could simply create a projectile object, apply mass then apply a force in the relevant direction... so long as the mass and force are appropriate your projectile should travel accordingly using physics and gravity..
  10. Is it possible that the model is not a single entity? And it is the child entities that are returning the collision, I will have to check this thanks
  11. I am getting a strange problem when using raycast... I am using a callback, when I raycast at an object like a wall that is designated as an entity type 2... The raycast call back which does a GetEntityType on the pick entity returns an entity type of 0... Strange thing is... I have one static object to pass through... I get the following hits from the raycast... Player body - expected.. 0 - No idea what this is.. 0 - ditto 0 - ditto 0 - ditto 0 - ditto 0 - ditto 0 - ditto 0 - ditto 0 - ditto 0 - ditto 0 - ditto 1 = Terrain There is 1 wall model between the raycast and the terrain... this has entity type 2 but raycast pick is returning 0.. also I know it is set to 2 becuase the code that sets it when I debug sets it to 2... also it has collision with my player body which is set in the Lua collisions... Callback int _stdcall PickFilter(TEntity pickentity) { int EntType = GetEntityType(pickentity); Raycast int hit = EntityPick(&pickent,gun,weap->maximumrange,0,0,(BP)PickFilter); Setting the entity type, even though this uses a default even setting this default to "2" does not work... EntityType(e,atoi(GetEntityKey(e,"collisiontype",(str)strStream.str().c_str()))); I put a cout stream for each entity hit callbackk and this is what I get... 2020000000001 20 is my Playerbody... 1 is the terrain... I don't know were 0 is comming from I don't have any 0 entities For what it is worth I hve attached a screen shot... the wall as you can see is straight ahead, but my raycast is returning the terrain on the other side, and why all the 0s this is the only object between the player and the wall...
  12. That worked really well... thanks
  13. I am using the GetEntityAABB to get the outside bounding box dimensions of my ingame static objects, I am using this information to build AI avoidance data. I need to ensure that the GetEntityAABB data is written to the AI engine in a clockwise rotation, I am only using the first set of X/Z points... Can anyone tell me how the GetEntityAABB provides the X/Z, or is this random. I can check and use the lowest X and Y, then then lowest X with the other Y etc... this would work but if the GetEntityAABB has a consistent logic then this would save some additional logic..
  14. This evening while working on my project, I suddenly started getting an exception error... Unhandled exception at 0x10136e5b in fpsbase-Debug.exe: 0xC0000005: Access violation reading location 0x00000054. This is in the gamelib game.scene.render function call... The call stack shows the following... > engine.dll!10136e5b() [Frames below may be incorrect and/or missing, no symbols loaded for engine.dll] engine.dll!10136da0() engine.dll!1011cb7c() engine.dll!1011d842() engine.dll!10135b58() engine.dll!1013532f() engine.dll!10134ae5() engine.dll!101092d9() engine.dll!1014ed66() engine.dll!1014e17d() engine.dll!1014fd5b() engine.dll!1015036f() engine.dll!10184c98() fpsbase-Debug.exe!__crtLCMapStringA_stat(localeinfo_struct * plocinfo=0x00000000, unsigned long Locale=169668648, unsigned long dwMapFlags=52428, const char * lpSrcStr=0x000f000e, int cchSrc=65568, char * lpDestStr=0x0c310048, int cchDest=2, int code_page=168081568, int bError=204611560) Line 346 C++ the things I have changed are a couple of my lua scripts, and the AI animation controls... I know it it probably something stupid I have done, but what would cause this crash... maybe someone has seen this happen before?
  15. I understand the relationship of collision type with index in the pull down, that is why I built the if so that when I select a collision type I translate the index to the collision type I want. I have a setup the lua collision script to assign te apprioriate collisions because if I constants in my program for the entity type it al works, if I use the collision types from the scene it does not. I believe you are correct that the set and get for the value is my problem but I do not have 19 types but I have grouped them into divisions of 10 for each "class" ie. Player entities are 20-29, enemy are 30-39 although I currently only use 20 and 21. Due to the index I have to translate this index to my true collision type.
  16. I have built some changes into the LUA scripts for collisions becuase I wanted to have more control over the collision system... this is my new class.lua require("Scripts/core") require("Scripts/filesystem") require("Scripts/string") require("Scripts/math/vector") require("Scripts/constants/properties") --Creates a class from a model reference object function CreateClass(modelreference) local class={} local super={} class.instances={} classtable[modelreference]=class class.modelreference=modelreference class.name=string.lower(StripAll(modelreference.path)) classnametable[class.name]=class --Print("Creating class "..class.name) super.class=class class.super=super --Initialize the property editor dialog function class:InitDialog(grid) group=grid:AddGroup( "General" ) group:AddProperty( "Name", PROPERTY_STRING ) group:AddProperty( "Position", PROPERTY_VEC3 ) group:AddProperty( "Rotation", PROPERTY_VEC3) group:AddProperty( "Scale", PROPERTY_VEC3, "" ) group:AddProperty( "Active", PROPERTY_BOOL ) group:AddProperty( "Enabled", PROPERTY_BOOL ) group=grid:AddGroup( "Appearance" ) group:AddProperty( "Material", PROPERTY_FILE, "Material Files (*.mat):mat" ) group:AddProperty( "Color", PROPERTY_COLOR, "1" ) group:AddProperty( "Intensity", PROPERTY_FLOAT, "0,4,2" ) group:AddProperty( "Order", PROPERTY_INTEGER, "0|-16,16,0" ) group:AddProperty( "viewdistance",PROPERTY_VEC2,"","View distance" ) group:AddProperty( "castshadows", PROPERTY_CHOICE,"Disabled,Dynamic,Static", "Cast shadows" ) group:AddProperty( "Hidden", PROPERTY_BOOL) group:AddProperty( "occlusionculling", PROPERTY_BOOL, "", "Occlusion culling") group:AddProperty( "aligntoground", PROPERTY_BOOL,"", "Align to terrain" ) group=grid:AddGroup( "Physics" ) group:AddProperty( "Mass", PROPERTY_FLOAT ) group:AddProperty( "Friction", PROPERTY_VEC2 ) group:AddProperty( "collisiontype", PROPERTY_CHOICE, "None,Static,Grass,Trees,Prop,Zone,Player,Friendly,Enemy,Neuetral,Trigger,Lineofsight,FriendlyFF,EnemyFF,NeutralFF", "Collision" ) group:AddProperty( "Buoyancy", PROPERTY_BOOL ) group:AddProperty( "Gravity", PROPERTY_BOOL ) group:AddProperty( "sweptcollision", PROPERTY_BOOL,"","Swept collision") end --Remove the class from the global tables function class:Free() Print("Freeing class "..self.name) classtable[modelreference]=nil classnametable[self.name]=nil self.super.class=nil self.super=nil self.instances=nil end --Create a new instance of this class function class:CreateObject(model) local object={} local super={} object.model=model object.class=self objecttable[model]=object self.instances[model]=object super.object=object object.super=super object.keyslocked=0 object.active=1 object.enabled=1 ------------------------------------------- --Base object functions ------------------------------------------- function object:SetKey(key,value) local intensity,r,g,b,a,color,v if key=="color" then intensity=tonumber(self.model:GetKey("intensity","1.0")) if intensity==nil then intensity=1.0 end color=string.Explode(value,",") r=tonumber(color[1]) g=tonumber(color[2]) b=tonumber(color[3]) a=tonumber(color[4]) if r==nil then r=255 end if g==nil then g=255 end if b==nil then b=255 end if a==nil then a=255 end self.model:SetColor(Vec4(r/255.0*intensity,g/255.0*intensity,b/255.0*intensity,a/255.0),1) elseif key=="enabled" then self.enabled=tonumber(value) elseif key=="gravity" then model.usegravity=value elseif key=="active" then self.active=tonumber(value) elseif key=="viewdistance" then local t=StringToVec2(value) self.model:SetViewDistance(t.x,t.y,1) elseif key=="friction" then v=string.Explode(value,",") x=tonumber(v[1]) y=tonumber(v[2]) if x==nil then x=0 end if y==nil then y=0 end self.model:SetFriction(x,y) elseif key=="buoyancy" then self.model.buoyant=tonumber(value) elseif key=="sweptcollision" then self.model:SetSweptCollisionMode(value) elseif key=="collisiontype" then if(value == 0) then newvalue = 0 elseif(value == 1) then newvalue = 2 elseif(value == 2) then newvalue = 3 elseif(value == 3) then newvalue = 4 elseif(value == 4) then newvalue = 5 elseif(value == 5) then newvalue = 10 elseif(value == 6) then newvalue = 20 elseif(value == 7) then newvalue = 30 elseif(value == 8) then newvalue = 40 elseif(value == 9) then newvalue = 50 elseif(value == 10) then newvalue = 6 elseif(value == 11) then newvalue = 7 elseif(value == 12) then newvalue = 11 elseif(value == 13) then newvalue = 12 else newvalue = 1; end self.model:SetCollisionType(newvalue,1) elseif key=="mass" then self.model:SetMass(tonumber(value),0) elseif key=="intensity" then intensity = tonumber(value) if intensity==nil then intensity=0 end value=self.model:GetKey("color","255,255,255,255") color=string.Explode(value,",") r=tonumber(color[1]) g=tonumber(color[2]) b=tonumber(color[3]) a=tonumber(color[4]) if r==nil then r=255 end if g==nil then g=255 end if b==nil then b=255 end if a==nil then a=255 end self.model:SetColorf(r/255.0*intensity,g/255.0*intensity,b/255.0*intensity,a/255.0,1) elseif key=="position" then v=string.Explode(value,",") x=tonumber(v[1]) y=tonumber(v[2]) z=tonumber(v[3]) if x==nil then x=0 end if y==nil then y=0 end if z==nil then z=0 end self.model:Fix() self.model:SetPositionf( x,y,z, 0 ) return 0 elseif key=="occlusionculling" then EntityOcclusionMode(model,value,1) elseif key=="rotation" then v=string.Explode(value,",") x=tonumber(v[1]) y=tonumber(v[2]) z=tonumber(v[3]) if x==nil then x=0 end if y==nil then y=0 end if z==nil then z=0 end self.model:SetRotationf( x,y,z, 0 ) self.model:Fix() return 0 elseif key=="hidden" then if value=="0" then model:Show() else model:Hide() end elseif key=="scale" then v=string.Explode(value,",") x=tonumber(v[1]) y=tonumber(v[2]) z=tonumber(v[3]) if x==nil then x=1 end if y==nil then y=1 end if z==nil then z=1 end self.model:SetScalef( x,y,z ) return 0 elseif key=="material" then if value~="" then local material=LoadMaterial( "abstract::"..value ) self.model:Paint(material,1) end elseif key=="castshadows" then self.model:SetShadowMode(tonumber(value),1) end return 1 end function object:GetKey(key,value) local intensity,r,g,b,a if key=="position" then return self.model.position.x..","..self.model.position.y..","..self.model.position.z elseif key=="mass" then return self.model.mass elseif key=="sweptcollision" then return self.model:GetSweptCollisionMode() elseif key=="rotation" then return self.model.rotation.x..","..self.model.rotation.y..","..self.model.rotation.z elseif key=="buoyancy" then return self.model.buoyant elseif key=="scale" then return self.model.scale.x..","..self.model.scale.y..","..self.model.scale.z elseif key=="collisiontype" then if(value == 0) then newvalue = 0 elseif(self.model.value == 1) then newvalue = 2 elseif(self.model.value == 2) then newvalue = 3 elseif(self.model.value == 3) then newvalue = 4 elseif(self.model.value == 4) then newvalue = 5 elseif(self.model.value == 5) then newvalue = 10 elseif(self.model.value == 6) then newvalue = 20 elseif(self.model.value == 7) then newvalue = 30 elseif(self.model.value == 8) then newvalue = 40 elseif(self.model.value == 9) then newvalue = 50 elseif(self.model.value == 10) then newvalue = 6 elseif(self.model.value == 11) then newvalue = 7 elseif(self.model.value == 12) then newvalue = 11 elseif(self.model.value == 13) then newvalue = 12 else newvalue = 1; end return newvalue elseif key=="gravity" then return model.usegravity elseif key=="friction" then return model.staticfriction..","..model.kineticfriction elseif key=="color" then intensity=tonumber(self.model:GetKey("intensity","1")) return (self.model.color.x*255.0/intensity)..","..(self.model.color.y*255.0/intensity)..","..(self.model.color.z*255.0/intensity)..","..(self.model.color.w*255.0) elseif key=="castshadows" then return self.model:GetShadowMode() elseif key=="material" then if self.model.material~=nil then return self.model.material:GetName() end elseif key=="active" then if self.active==0 then return 0 else return 1 end elseif key=="enabled" then if self.enabled==0 then return 0 else return 1 end else return value end end function object:LockKeys() self.keyslocked=1 end function object:UnlockKeys() self.keyslocked=0 end function object:ReceiveMessage(message,extra) if message=="hide" then self.model:Hide() elseif message=="show" then self.model:Show() elseif message=="activate" then self.active=1 self.model:Show() elseif message=="deactivate" then self.active=0 end end function object:Free() self.class.instances[self.model]=nil self.class=nil objecttable[self.model]=nil self.super.object=nil self.super=nil self.model=nil end ------------------------------------------- --Hack so we can call self.super:function() ------------------------------------------- object.SetKey_=object.SetKey object.GetKey_=object.GetKey object.LockKeys_=object.LockKeys object.UnlockKeys_=object.UnlockKeys object.ReceiveMessage_=object.ReceiveMessage object.Free_=object.Free function super:SetKey(key,value) return self.object:SetKey_(key,value) end function super:GetKey(key,value) return self.object:GetKey_(key,value) end function super:LockKeys() self.object:LockKeys_() end function super:UnlockKeys() self.object:UnlockKeys_() end function super:ReceiveMessage() self.object:ReceiveMessage_() end function super:Free() self.object:Free_() end ------------------------------------------- --Set any default keys here. --You want to set them after the SetKey function is declared. object.model:SetKey("intensity","1.0") return object end ------------------------------------------- --Hack so we can call self.super:function() ------------------------------------------- class.InitDialog_=class.InitDialog class.Free_=class.Free class.CreateObject_=class.CreateObject function super:CreateObject(model) return self.class:CreateObject_(model) end function super:InitDialog(grid) self.class:InitDialog_(grid) end function super:Free() self.class:Free_() end ------------------------------------------- return class end These are my collision constants... COLLISION_NONE=0 COLLISION_TERRAIN=1 COLLISION_STATIC=2 COLLISION_GRASS=3 COLLISION_TREES=4 COLLISION_PROP=5 COLLISION_ZONE=10 COLLISION_FRIENDFIELD=11 COLLISION_ENEMYFIELD=12 COLLISION_NEUTRALFIELD=13 COLLISION_PLAYERBODY=20 COLLISION_PLAYERMESH=21 COLLISION_FRIENDBODY=30 COLLISION_FRIENDMESH=31 COLLISION_ENEMYBODY=40 COLLISION_ENEMYMESH=41 COLLISION_NEUTRALBODY=50 COLLISION_NEUTRALMESH=51 COLLISION_TRIGGER=6 COLLISION_AILINEOFSIGHT=7 The problem is when I use any collisions in my C++ program they always have an entity type of 5555 or 55555, terrain was 55555 and my props are 5555 even though I set the collisiontype in the class script. Obviously I have done something wrong and this is my first time with LUA so I it's all trial and error... sorry in advance if the reason is really stupid... oh and I am using gamelib to load the scene... thanks and sorry again if i am being stupid...
  17. Yes that is what I am using, downside is you have some overhead, becuase you have to have Dark GDK libs available to compile even though you are not referencing them... I have all functions working including getting the AI responses to control my AI Body controller entities... seems to be working pretty well...
  18. Yes that is what I am using, downside is you have some overhead, becuase you have to have Dark GDK libs available to compile even though you are not referencing them... I have all functions working including getting the AI responses to control my AI Body controller entities... seems to be working pretty well...
  19. It would be useful to be able to have a "default.lua" file, this would be a script that would be copied to any object used in Editor that does not have an associated LUA file.
  20. When I use models in Editor it creates a blank LUA file for the model, is there a way that I can use an existing script as the default, like the class.lua script? So that when any model is loaded by Editor and it does not have a lua script associated with it it will use the class.lua..
  21. I found the problem, Vista UAC maintains a cache copy of all "program files" in the appdata folder this is were LUA editor and Editor pull the scripts from here if they exist, if not then it pulls from from the program files proper... not sure how this cache is created and why, but once I deleted this folder everything worked fine....
  22. Vista, I hate it... anyway.. I have changed the class.lua collision list to use a different custom list... When I run Editor is running the old LUA, when I edit the class.lua in Scripteditor, I see the following line (What it was before my changes... group:AddProperty( "collisiontype", PROPERTY_CHOICE, "None,Prop,Scene,Character,Trigger", "Collision" ) If I edit the file using Textpad or notpad the same line says... group:AddProperty( "collisiontype", PROPERTY_CHOICE, "None,Static,Grass,Trees,Prop,Zone,Player,Friendly,Enemy,Nuetral,Trigger,Lineofsight,FriendlyFF,Enemy,FF,NeutralFF", "Collision" ) I have seen this before with vista using UAC when the editor uses the appdata path which contains a copy of the file edited... but I checked the appdata path contains no LE or LUA files... Anyone any thoughts on what this could be...
  23. Yes I have changed the collisino types which seem to be working, but there is the engine_const and these are not the same as he collision types... I see that these are used for rendering, but how do they get assigned to the entity? ENTITY_MESH=1 ENTITY_EMITTER=2 ENTITY_MODEL=4 ENTITY_BODY=8 ENTITY_TERRAIN=16 ENTITY_BONE=64 ENTITY_CAMERA=128 ENTITY_CORONA=256 ENTITY_LISTENER=1024 ENTITY_PIVOT=2048 ENTITY_MESHLAYER=4096 ENTITY_POINTLIGHT=8192 ENTITY_SPOTLIGHT=512 ENTITY_DIRECTIONALLIGHT=16384 ENTITY_VEGETATION=32768 ENTITY_ALL=ENTITY_MESH+ENTITY_EMITTER+ENTITY_MODEL+ENTITY_TERRAIN+ENTITY_BODY+ENTITY_BONE+ENTITY_CAMERA+ENTITY_CORONA+ENTITY_POINTLIGHT+ENTITY_SPOTLIGHT+ENTITY_DIRECTIONALLIGHT+ENTITY_LISTENER+ENTITY_PIVOT+ENTITY_MESHLAYER ENTITY_RENDERABLE=ENTITY_VEGETATION+ENTITY_MESH+ENTITY_TERRAIN+ENTITY_CORONA+ENTITY_EMITTER+ENTITY_SPOTLIGHT+ENTITY_POINTLIGHT+ENTITY_MESHLAYER
×
×
  • Create New...