Jump to content

Shambler

Members
  • Posts

    21
  • Joined

  • Last visited

Posts posted by Shambler

  1. Hi Robin,

     

    I just zipped up the project folder, if it doesn't work then I'm unsure.png ?

     

    Here's a modification to the jump so you you can only jump when one the ground...

     

    function Script:Start()
    camera=Camera:Create()
    camera:SetParent(self.entity)
    camera:SetPosition(0,1.5,0)
    camera:SetRotation(0,0,0)
    self.camerarotation=Vec3(0)
    self.rot=0.0
    self.move=0.0
    self.strafe=0.0
    self.jump=0.0
    self.crouch=false
    self.mouseposition=Vec2(0,0)
    self.movement=Vec3(0,0,0)
    self.movespeed=5
    self.lookhspeed=0.5
    self.lookvspeed=0.75
    self.movesmoothing=8
    self.looksmoothing=5
    self.moveforce=Vec3()
    self.mouseposition=Vec2()
    self.mousespeed=Vec2()
    self.mouseinvert=-1
    
    end
    
    --[[
    function Script:UpdateMatrix()
    
    end
    ]]--
    --[[
    function Script:UpdateWorld()
    
    end
    ]]--
    
    function Script:UpdatePhysics()
    local window = Window:GetCurrent()
    local cx=window:GetClientWidth()/2
    local cy=window:GetClientHeight()/2
    local camerarotation = camera:GetRotation()
    local mousepos=window:GetMousePosition()
    
    window:SetMousePosition(cx,cy)
    
    
    self.mousespeed.x = Math:Curve(mousepos.x-cx,self.mousespeed.x,self.looksmoothing)*Time:GetSpeed()
    self.mousespeed.y = Math:Curve(mousepos.y-cy,self.mousespeed.y,self.looksmoothing)*Time:GetSpeed()
    camerarotation.x = camerarotation.x+(self.mouseinvert*self.mousespeed.y)*self.lookvspeed
    if camerarotation.x>80 then camerarotation.x=80 end
    if camerarotation.x<-80 then camerarotation.x=-80 end
    camera:SetRotation(camerarotation)
    self.rot=self.rot+self.mousespeed.x*self.lookhspeed
    if (window:KeyDown(Key.W)) then self.move=self.movespeed*Time:GetSpeed() end
    if (window:KeyDown(Key.S)) then self.move=-(self.movespeed/2)*Time:GetSpeed() end
    if (window:KeyDown(Key.D)) then self.strafe=-self.movespeed*Time:GetSpeed() end
    if (window:KeyDown(Key.A)) then self.strafe=self.movespeed*Time:GetSpeed() end
    if (window:KeyHit(Key.Space)) then
    if not self.entity:GetAirborne() then
    self.jump=10.0
    end
    end
    self.entity:SetInput(self.rot,self.move,self.strafe,self.jump)
    self.move=self.move*0.9
    self.strafe=self.strafe*0.9
    self.jump=0.0
    
    end
    
    --[[
    function Script:Collision(entity, position, normal, speed)
    
    end
    ]]--
    --[[
    function Script:Draw()
    
    end
    ]]--
    --[[
    function Script:DrawEach(camera)
    
    end
    ]]--
    --[[
    function Script:Release()
    
    end
    ]]--
    --[[
    function Script:Cleanup()
    
    end
    ]]--
    

  2. Ok peeps,

     

    here is some sample code for an FPS camera...think of it at as a work in progress since there are a couple of things not quite right but it should give people some idea of where to start.

     

    Things that work

     

    movement back and forwards,mouselook including limiting up/down angle, collision and jumping.

     

    Things that aren't great

     

    1) Strafe does not work as expected...does not rotate with the controller...I think someone else has this issue.

    2) Crouch would not work so I took it out.

    3) Camera moves around wildly for the first second until it stabilises...probably an easy fix but I've got to go out! =)

     

    At least the code below should give us a foundation with which to get an fps controller up and running with input from everyone for bug fixes.

  3. I prefer the 3DWS way in that it just goes ahead and creates the primitive as soon as you let go of the left mouse button.

     

    Every click or keypress saved adds to the fluidity of creation.

     

    I must say that I am loving the much tighter integration of LE3 over LE2.

  4. Just upgraded to a new PC after my last one decided to blow the mainboard >.<

     

    Now enjoying Skyrim on an i7.

     

    Amazingly I took the hard drives out of the old PC, put them in the new PC, and it booted then changed all of its drivers to suit the new setup.

     

    Saved hours of reinstalling everything.

  5. I'm with you Puki.

     

    It does feel epic, very open-ended and maybe too much so, I think in future games there won't be a main quest just a world to explore.

     

    Most of the time I completely forget about the main quest and just go exploring.

     

    New found respect for trolls...I certainly got beat up there, the game isn't linear, one minute you are coping well and the next overwhelmed.

     

    NPC's are more realistic and believable, people are doing stuff, not just standing around waiting for you to talk to them.

  6. Thanks all, I didn't want to go ahead with modelling it if there was a more efficient way to do it with some sort of mapping.

     

    On the same subject then, what would get me the highest frames per second?

     

    1) Making each level of my dungeon as one large mesh.

     

    2) Making the dungeon out of small pieces e.g. straight corridoor, corner, doorway etc. and then use multiple instances of these pieces in Leadwerks editor to build the level.

  7. I suppose it depends on the type of game.

     

    If the player has attributes which are carried through each level, e.g. fps or rpg, then you might want to preserve the player entity,controller and other stats in a single object and delete everything else.

     

    If the player starts from scratch each level, e.g. magic carpet, then you could just delete everything and start afresh each level by loading a new scene/terrain etc. and creating a new player.

     

    If the new level uses a different terrain than the last then ditch the terrain otherwise keep it in memory to save loading it again.

     

    This could also involve all assets for maximum speed of level loading.

     

    i.e.

     

    Tag all assets to be deleted...

     

    Parse through all of the assets needed by the new level ( or the save game you want to load )...

     

    If you find a currently loaded asset you need in the new level then reposition it and unmark it for deletion...

     

    If you don't find the asset then load it from disk...

     

    Once you have completed building the new level delete all assets which are still marked for deletion.

×
×
  • Create New...