Jump to content

Canardia

Developers
  • Posts

    4,127
  • Joined

  • Last visited

Everything posted by Canardia

  1. You should make your own improments in different files than the original files. For example the PointLight2 I made.
  2. You can also press the number keys to select the index before creating the link.
  3. Basically you can "customize" 3DWS by adding your own custom entity keys to objects. Then you just make your code to recognize those custom entity keys, but there's no way to make 3DWS recognize them (other than just having them as keys and/or as entities with those keys prepopulated). Instead of always manually adding all custom entity keys, you can also add your custom entities to the entities.def file at the end, for example if you want to add a weapon to 3DWS, you could add this: @pointclass Weapon : "sprites\weapon" [ firepower : 100 range : 200 delay : 10 ]
  4. I started to work on gamelib 0.0.16.0. This is getting interesting... Framewerk C++ source has been removed, and LEO (which has Framework C++ classes) has been added I think it will be ready today, as it's not too much to change, when done this way. Actually there shouldn't be anything to change, if LEO's Framework works the same way as the Framewerk C++ did, which is again a good thing, because then GameLib keeps it promise that customers don't need to change their code when the engine changes and they use GameLib. That's the idea of ROI.
  5. You can't do that, since it needs the integrated framework. But I'm looking today how to get the integrated framework to work with gamelib 0.0.16.0.
  6. I'm not sure, at least it was still there when I didn't delete the old entity created with Sandbox. I guess there are still many people who have old entities in their Editor maps, since they didn't recreate all entities with Editor, so I have to make sure that gamelib supports both Sandbox and Editor sbx, even if they are mixed in the same sbx file (which is obviously quite common).
  7. The missing classname for directional light is indeed the reason: Model { path="light_directional.gmf" position=-20.9827633,131.497437,2.42692709 rotation=55.0000496,0.000000000,0.000000000 scale=0.999997675,0.999998093,0.999998093 id=76090920 "class"="Model" "intensity"="0.5" "name"="directional_4" } But I can fix that in gamelib, to make it look if the "name" key begins with "directional", as I've done for ambient light in 2.3 also. Line 1491 in gamelib.cpp would then look instead of: if(uselua!=2)if(cn=="light_directional") somehow like this (I need to test it first): if(uselua!=2)if((cn=="light_directional")||((en.compare(0,11,"directional")==0))
  8. It worked fine the last time I tried it (2009-12-30), but from what I understood there was some update over new year which apparently broke something. I need to check if I get the same problem, now that I'm back from the new year trip.
  9. Yes, that's exactly why I need to do for the gamelib versions of the LUA scripts. In additition I also need to add some missing light settings, like shadowsoftness, additional lightmap sizes, and a bigger lightrange slider. Those things should be in my opinion in the default engine, but they are not.
  10. Ok, I found the reason why Roland gets those warnings. He is using Framewerk directly, and not via gamelib. When I tried to make a new project which had the Framewerk files directly included as source, then I got those warnings too. I'll fix those warnings and send Josh the updated files. EDIT: Sent new renderer.cpp to Josh
  11. There's many other things which gamelib loads from the scene, and which can't be done in LUA. For example the loading of weapons into a C++ STL map. Or waypoints, ambient light triggers, playerstarts, etc...
  12. The missing classname key is a bit problematic in 2.3, since you have to take some random other key to identify the class. You could also set some custom entity key with Notepad++ in the sbx file, for example class_name="light_directional", but of course it would be nicer to have that functionality in Editor. It could be also fixed with a complete new LUA script set for all default entities of LE, so that each LUA script provides a classname field where the user can enter the class name. Maybe I will do that for gamelib, and include modified versions of all lights and other default entities with gamelib.
  13. I don't disable type conversion warnings, but make the code so that it has no type conversions.
  14. I don't know why you get warning messages, because I don't get any.
  15. The benefit is not exactly nothing, since BlitzMax users also need sometimes to use other languages. Most commercial games are using several 3rd party libraries, and you don't find them for BlitzMax. For example Far Cry 2 had a huge list of 3rd party libraries. If any of such 3rd party libraries then need to access LE, Lua or framework, you will need to use engine.dll. Also the upcoming DLL version of GameLib will have the same need.
  16. BlitzMax users had always the possibility to use framework with lua.
  17. You don't need to import any framewerk if you use the engine.dll. I don't know why BlitzMax is such a mess
  18. Because it's part of the engine now, not a seperate product. You don't put the company "logo" more than once into a product, so Leadwerks Engine covers already that It's also less visible now, since all framework commands appear like plain commands and not using any visible reference to framework (except for a few, and in Lua).
  19. You should use code tags and not quote tags when pasting code. It's horrible to read code which is not indented.
  20. Putting additional game core related entities to a Editor scene is also not the optimal solution. Then all those additional entities would be needed to be present in all scenes. That's redundant and allows unique information to be corrupted (as the same information should be present in all scenes). Of course this problem is raised by Editor itself, since it doesn't utilize a "common scene" and the "actual scene" concept. The "common scene" would contain all entities which are common in all scenes (for a specific project). However, there is a indirect solution for this problem: You could have a "common scene reference" entity, which would then load the common scene, and all its contained entities. Another solution would be to rewrite Editor to use sqlite databases instead of sbx files
  21. Each component of Vec3 seperately.
  22. Let's start improving this with the options like screen resolution and which map to load. The first thing which comes to my mind would be reading a fpscontroller2.ini file from disk with LUA. Then there could be a fpscontroller2config.lua which would launch an UI where the user can select the options. It could be also part of fpscontroller2.lua, but then there would need to be a title screen where you can choose to play the game or to configure the settings. I'm not sure how your GAME_MODE idea works, because then it should support all kind of game types. I think it's easier to make a seperate lua file for each game type (at least in the beginning).
  23. Yeah, I though also of making fpscontroller using some classes, but this is just the first working version with Engine.exe. I noticed that emitters don't work, and that the skybox is loaded although it should not. Must be a bug in Engine.exe
  24. You can use this fpscontroller2.lua from Editor or by dragging it over Engine.exe. --stuff which should be part of LE --the best working round function, works also for negative idp (written by Robert Jay Gould) function round(num, idp) return tonumber(string.format("%." .. (idp or 0) .. "f", num)) end BLEND_NONE=0 BLEND_ALPHA=1 --end of stuff which should be part of LE if fw==nil then --we are not in Editor RegisterAbstractPath("") Graphics(800,600) fw=CreateFramework() scene=LoadScene("abstract::tunnels.sbx") scene:SetCollisionType(COLLISION_SCENE) TFilter(1) AFilter(4) standalone=1 end require("Scripts/constants/collision_const") require("Scripts/constants/engine_const") require("Scripts/LinkedList") require("Scripts/filesystem") require("Scripts/math/math") require("scripts/classes/bullet") --Variables dx=0.0 dy=0.0 camerapitch=0.0 camerayaw=0.0 move=0.0 strafe=0.0 --Create a player controller controller=CreateController(1.8,0.45,0.25,45) controller:SetCollisionType(COLLISION_CHARACTER,0) controller:SetMass(10) if standalone==1 then controller:SetPosition(Vec3(38.8,5.7,7)) else controller:SetPosition(fw.main.camera.position) end camerapitch=fw.main.camera.rotation.x camerayaw=fw.main.camera.rotation.y+180 local gunscale=0.6 local vwep = LoadMesh("abstract::vwep_hands.gmf") LoadMesh("abstract::vwep_gun.gmf",vwep) vwep:SetParent(fw.main.camera,0) vwep:SetPosition(Vec3(-0.18*gunscale,-0.03*gunscale,0.37*gunscale),0) vwep:SetScale(Vec3(0.04*gunscale,0.04*gunscale,0.04*gunscale)) local gundisplayposition = vwep:GetPosition() sound_gunshot = LoadSound("abstract::gunshot.ogg") source_gunshot = CreateSource(sound_gunshot) source_gunshot:SetVolume(0.5) vwep :SetShadowMode(0,1) local displayposition=Vec3(-0.26/2.0,-0.03,0.19) local muzzleflash = CreatePointLight(3) muzzleflash:SetParent( vwep ) muzzleflash:SetColor(Vec4(1,0.6,0.0,1.0)) muzzleflash:SetPosition( displayposition ) muzzleflash:SetShadowMode(0) HideMouse() MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2) FlushKeys() FlushMouse() local pick local camera = fw.main.camera local remainingtime local starttime=AppTime() local gameduration=2--length of game in minutes local gamemode=0 gunpos = vwep.position:Copy() local smoothedgunswayamplitude=0.0 local smoothedgunswayspeed =0.0 local guntime = 0.0 local recoil = 0.0 local lastfiretime=0.0 local smoothrecoil=0.0 local swaydamping=0.0 local smoothswaydamping=0.0 local lightsmoothing =0.0 local gunlight = 0.0 --Flashlight flashlight = {} flashlight.light = CreateSpotLight(8) flashlight.light:Hide() flashlight.sound_switch = LoadSound("abstract::switch.wav") flashlight.state=0 flashlight.light:SetConeAngles(30,35) flashlight.light:SetRotation(Vec3(5,0,0)) flashlight.light:SetShadowmapSize(512) flashlight.light:Paint(LoadMaterial("abstract::flashlight.mat")) function flashlight:SetState( state ) if state~=self.state then self.state=state if state==0 then self.light:Hide() else self.light:Show() end if self.sound_switch~=nil then self.sound_switch:Play() end end end function ShootBullet( position, direction ) -- local speed=100.0 -- local pick = LinePick( position, Vec3(position.x+direction.x * speed) ) end function DrawHUD(contr) SetBlend(BLEND_ALPHA) DrawText("pos: "..round(contr.position.x,3)..","..round(contr.position.y,3)..","..round(contr.position.z,3),1,FontHeight()*5) DrawText("rot: "..round(contr.rotation.x,3)..","..round(contr.rotation.y,3)..","..round(contr.rotation.z,3),1,FontHeight()*6) SetBlend(BLEND_NONE) end --main function while KeyHit(KEY_ESCAPE)==0 do jump=KeyHit(KEY_SPACE)*6.0 if controller:IsAirborne()==1 then jump=0 end local time = AppTime()/3200.0 local frame = time*(179.0-96.0)+96.0 frame=Clamp( frame, 96, 179 ) vwep:Animate(96,1,0,1) --Camera look gx=Round(GraphicsWidth()/2) gy=Round(GraphicsHeight()/2) dx=Curve((MouseX()-gx)/4.0,dx,3.0/AppSpeed()) dy=Curve((MouseY()-gy)/4.0,dy,3.0/AppSpeed()) MoveMouse(gx,gy) camerapitch=camerapitch+dy camerayaw=camerayaw-dx camerapitch=math.min(camerapitch,90) camerapitch=math.max(camerapitch,-90) fw.main.camera:SetRotationf(camerapitch,camerayaw,0,1) movespeed=6 movesmoothing=10 if controller:IsAirborne()==1 then movesmoothing=200 end --Player movement move=Curve( (KeyDown(KEY_W)-KeyDown(KEY_S))*movespeed,move,movesmoothing) strafe=Curve( (KeyDown(KEY_D)-KeyDown(KEY_A))*movespeed,strafe,movesmoothing) --Use objects if KeyHit(KEY_E)==1 then pick=CameraPick(camera,Vec3(GraphicsWidth()/2,GraphicsHeight()/2,2.0),0,0) if pick~=nil then repeat if pick.entity:GetClass()==ENTITY_MODEL then break end pick.entity=pick.entity.parent until pick.entity==nil if pick.entity~=nil then pick.entity:SendMessage("use",controller,0) end end end --Update controller controller:Update(camerayaw,move,strafe,jump,40,10) fw:Update() if KeyHit(KEY_F)==1 then flashlight:SetState(1-flashlight.state) end --Position camera camera:SetPositionf(controller.position.x,controller.position.y+0.8,controller.position.z,1) time=AppTime() gunfirefrequency=80 gunswayspeed=0.001*20.0 gunoffset = gunpos:Copy() gunswayamplitude = 0.02 if KeyDown(KEY_W)==1 or KeyDown(KEY_D)==1 or KeyDown(KEY_A)==1 or KeyDown(KEY_S)==1 then gunswayamplitude = 0.03 gunswayspeed=0.005*20.0 end smoothedgunswayamplitude = Curve( gunswayamplitude, smoothedgunswayamplitude,8.0 ) smoothedgunswayspeed = Curve( gunswayspeed, smoothedgunswayspeed,8.0 ) if smoothrecoil<0.001 then guntime = guntime + AppSpeed() * smoothedgunswayspeed * math.max(0.0,1.0 - smoothswaydamping) end gunoffset.z = gunoffset.z - smoothrecoil * 0.05 --smoothedgunswayamplitude = smoothedgunswayamplitude * (1.0 - smoothswaydamping) gunoffset.x = gunoffset.x + math.sin( guntime ) * smoothedgunswayamplitude * gunscale gunoffset.y = gunoffset.y + (1.0-math.cos( guntime*2.0 )) * 0.005 * gunscale-- * math.min(1.0,1.0 - smoothswaydamping)) vwep:SetPosition( gunoffset ) recoil = recoil-0.1 swaydamping = math.max( swaydamping - 0.05, 0.0 ) recoil = math.max(recoil,0.0) smoothrecoil=Curve(recoil,smoothrecoil,3.0) smoothswaydamping = Inc( swaydamping ,smoothswaydamping,0.01 ) gunlight = math.max( gunlight- 0.2, 0.0 ) lightsmoothing =gunlight-- Curve(gunlight,lightsmoothing,8.0) muzzleflash:SetColor(Vec4(1.0*lightsmoothing,0.6*lightsmoothing,0.0,1.0)) if lightsmoothing <0.01 then muzzleflash:Hide() end if MouseDown(1)==1 then if AppTime()-lastfiretime>gunfirefrequency then recoil = 1.0 lastfiretime=AppTime()+math.random(0,20) gunswayspeed=0.0 gunlight = 1.0 source_gunshot:Play() source_gunshot:SetPitch(1.0 + (math.random()-0.5)*0.05 ) swaydamping = 1.0 muzzleflash:Show() CreateBullet(vwep:GetPosition(1) , fw.main.camera.mat:K():Scale(300)) end end UpdateBullets() flashlight.light:SetPosition(fw.main.camera:GetPosition(1)) flashlight.light:SetRotationf( CurveAngle( fw.main.camera.rotation.x, flashlight.light.rotation.x, 3.0/AppSpeed() ), CurveAngle( fw.main.camera.rotation.y, flashlight.light.rotation.y, 3.0/AppSpeed() ) ) flashlight.light:Movef(-0.07,-0.04,0.02) fw:Render() DrawHUD(controller) Flip(0) end controller:Free() vwep:Free() ShowMouse()
×
×
  • Create New...