Jump to content

Einlander

Members
  • Posts

    778
  • Joined

  • Last visited

Posts posted by Einlander

  1. Could be related to this bug http://www.leadwerks.com/werkspace/topic/9580-memory-allocation-error/ . If i run my game in the editor it's fine, If it's run from command line it crashes. I had to lower the resolution of EVERY single texture to make this go away. That's not really the solution I really wanted to do. Hopefully there is a way to fix both the out of video memory and mem alloc issues.

  2. I haven't looked at nor do I know how it's done with the steam API, but please do your steam checks exhaustively. I have many games on steam that simply will not run because the steam network went down or the steamworks API is undergoing maintenance. 7 Days to Die is one such game. You can have steam running, be online, but the game will not run because steam was having problems.

  3. Some questions about your project:

     

    Is it lua based or c++?

    Single player or multiplayer?

    Will level design be done in Leadwerks using prefabs and csf/brushes, or will it need to be done in a 3d modeler?

    You say it's modern but not futuristic, will it be real life gritty, or real life cartoony like team fortress 2.

    Is there a time of completion goal date?

     

    I have more questions but i can't think of the rest of them currently.

    • Upvote 1
  4. He said that he made his level smaller so he could use 1 spotlight to light his level. He can get the Sam effect on a larger level with 1 directional light instead. I didn't say spotlights were useless. In his usage case there was a simpler more efficient method to accomplish the same thin. Spotlights are good for small areas, but not to light your entire level.

    • Upvote 1
  5. Couldn't you use a directional light to light up your scene with shadows, instead of one spotlight? Or changing the color of the scene roots ambient light? I too want to see the return of selective light mapping and some more optimizations in engine performance, but sometimes its a good idea to start from the beginning optimizing your level.

    • Upvote 1
  6. I wrote this exact thing last week in lua, I needed to generate some mesh terrains that I could modify in real time. To make the faces/triangles, I did some linear calculations I use to use on my graphics calculator to turn a 1*X matrix into a simulated 3d matrix

     

    
    

    Script.null = 0 -- choice "Terrain Generator" "By Einlander"

     

    -- The size of the terrain in squares, so an extra vertex will be added in both directions, so a 10x10 square will have 11x11 vertices

    Script.TerrainSize = 10 -- int "Terrain Size"

    -- 100 is the sweet spot

     

     

    -- 1 is the size the leadwerks edior measurment

    Script.TerrainSquareSize = 10 -- int "Terrain Square Size"

     

     

    function Script:Start()

     

    -- measure performance

    local timer= Time:Millisecs()

    local timer2= Time:Millisecs()

    -- terrain size squared

     

    System:Print("Starting ")

     

    timer2 = Time:Millisecs()

    System:Print("Generating terrain ")

    self.terrain = self:MakeTerrain(self.TerrainSize)

    System:Print("Done "..(Time:Millisecs()-timer2)/1000)

     

    timer2 = Time:Millisecs()

    System:Print("Modify terrain ")

    self.terrain = self:ModifyTerrainVertex(self.terrain, 2,2,15)

    self.terrain = self:ModifyTerrainVertex(self.terrain, 2,3,15)

    System:Print("Done "..(Time:Millisecs()-timer2)/1000)

     

     

    timer2 = Time:Millisecs()

    System:Print("Generating Collision Mesh ") -- this is where all the time goes

    local shape = Shape:PolyMesh(self.terrain:GetSurface(0)) -- has to be a poly mesh, unless it's perfectly flat.

    System:Print("Done "..(Time:Millisecs()-timer2)/1000)

     

     

    self.terrain:SetShape(shape)

    self.terrain:SetCollisionType(Collision.Scene)

    self.terrain:SetPosition(0,0,0)

    System:Print("Loading Complete "..(Time:Millisecs()-timer)/1000)

    end

     

     

     

    function Script:UpdateWorld()

     

    end

     

     

    function Script:MakeTerrain(TerrainSize) -- capable of creating non square terrain with slight modification

     

    local terrain = nil

    terrain = Model:Create()

    terrain:SetColor(0.5,0.5,0.5)

    local surface = terrain:AddSurface()

     

    -- add vertexes

    System:Print("Generating Vertices")

    for TerrainWidth=0 , TerrainSize do

    for TerrainDepth=0 , TerrainSize do

    surface:AddVertex(TerrainWidth*self.TerrainSquareSize,0,TerrainDepth*self.TerrainSquareSize, 0,1,0)

    end

    end

    -- add triangles

    local currentrow = 0

    System:Print("Generating faces")

    for trinaglestrip=0 , ((TerrainSize)^2)+(TerrainSize-1) do

    surface:AddTriangle(trinaglestrip,trinaglestrip+1,trinaglestrip+TerrainSize+1)

    surface:AddTriangle(trinaglestrip,trinaglestrip+TerrainSize+1,trinaglestrip+TerrainSize)

    end

    -- This is where you would add the uv's

    System:Print("")

    return terrain

    end

     

    function Script:ModifyTerrainVertex(terrain, X,Y,Elevation) -- Raises individual vertices remeber there is one extra vertex in both directions.

    local tempterrain = terrain

    local tempsurface=tempterrain:GetSurface(0)

    --!!!GET THE VERTEX POSITION FIRST, THEN MODIFY THE VALUES!!!

    --(X*(self.TerrainSize+1))+(Y)) the linear index

    tempvertexposition = tempsurface:GetVertexPosition((X*(self.TerrainSize+1))+(Y))

    tempsurface:SetVertexPosition((X*(self.TerrainSize+1))+(Y),tempvertexposition[0],Elevation,tempvertexposition[2])

    return tempterrain

    end

     

    Attach it to a pivot and run. It generates a collision polymesh, that's where the slowdown is. Otherwise, if you don't need to generate a collision mesh, it goes so much faster. It even has a method to manipulate the vertex elevation.

  7. I am trying to implement a molotov cocktail ala Left 4 Dead in lua for Leadwerks. I think I have most of it figured out, but i'm having some issues with the collisions. I would like to be able to throw one at my feet and not have the particles interact with the player.

     

    Pardon my spaghetti code:

     

    function Script:Start()

    self.enabled = true

    self.exploded=false

    self.particlelist={}

    self.particalspawntime=.03

    self.collisonpoint = Vec3()

    self.particlecount=15

    self.particlecounter=0

    self.particlecounter2=0

    self.timer=0

    self.settle = true

    self.settletimer = 0

    self.settletime = .05

    self.burn=false

    self.burntime=10

    self.burntimer=0

    self.burnout=false

    self.burnouttime=.1

    self.burnouttimer=0

    --self.burnaoutparticlecounter=self.particlecount

    end

     

     

     

    function Script:UpdateWorld()

     

    end

     

     

     

    function Script:UpdatePhysics()

    if (self.exploded==true) and (self.enabled==true) and (self.particlecounter < self.particlecount) then

    local timer2 = Time:Millisecs()

    if ((timer2 -self.timer)/1000)>self.particalspawntime then

    --Debug:Error("Times Up")

    -- create box

    local model = Model:Box()

    -- add to particle list

    table.insert(self.particlelist,model)

    --model:SetPosition(self.entity:GetPosition())

    model:SetPosition(self.collisonpoint.x,self.collisonpoint.y,self.collisonpoint.z)

    model:SetColor(0.0,0.0,1.0)

    model:SetScale(.5,.1,.5)

    model:SetFriction(0,.3)

    -- create collision

    local shape = Shape:ConvexHull(model:GetSurface(0))

    --local shape = Shape:PolyMesh(model:GetSurface(0))

    model:SetShape(shape)

    model:SetCollisionType(Collision.Prop)

     

     

    --set mass

     

    model:SetMass(5)

    model:AddForce(math.random(300,500),0,math.random(300,500),false)

     

    --model:PhysicsSetPosition(self.collisonpoint.x,self.collisonpoint.y+1,self.collisonpoint.z,.2)

    self.particlecounter = self.particlecounter + 1

    if self.particlecounter == self.particlecount then

    self.settle = true

    self.settletimer = Time:Millisecs()

    self.particlecounter2=#self.particlelist

    --self.enabled = false

    end

     

    self.timer = Time:Millisecs()

    end

     

    end

    if (self.enabled == true) and (self.burnout == true) then

    --Debug:Error("burnout begin")

    end

    if (self.enabled == true) and (self.exploded==true) and (self.settle == true) and (self.particlecounter2 > 0) then

    local timer2 = Time:Millisecs()

    if ((timer2 -self.settletimer)/1000)>self.settletime then

    --Debug:Error(((timer2-self.settletimer)/1000))

    local mdl= self.particlelist[self.particlecounter2]

    --mdl:SetCollisionType(Collision.Prop)

    --mdl:SetRotation(0,mdl:GetRotation().y,0)

    --mdl:AddForce(math.random(1,1),math.random(1,1),math.random(1,1),false)

    mdl:PhysicsSetPosition(mdl:GetPosition().x,mdl:GetPosition().y+.5,mdl:GetPosition().z,.1)

    mdl:SetCollisionType(Collision.Debris)

     

     

    --mdl:Release()

    --table.remove(self.particlelist,self.particlecounter2)

    self.settletimer = Time:Millisecs()

    self.particlecounter2 = self.particlecounter2-1

    end

    end

     

    if (self.enabled == true) and (self.exploded==true) and (self.burn == true) and (#self.particlelist > 0) then

    local timer2 = Time:Millisecs()

    if ((timer2 -self.burntimer)/1000)>self.burntime then

    --local mdl= self.particlelist[#self.particlelist]

    --table.remove(self.particlelist,#self.particlelist)

    --mdl:Release()

    --self.burntimer = Time:Millisecs()

    self.burnout=true

    self.burn=false

    self.burnouttimer = Time:Millisecs()

    end

    end

     

    if (self.enabled == true) and (self.burnout == true) and (self.exploded==true) and (self.burn == false) and (#self.particlelist > 0) then

    local timer2 = Time:Millisecs()

    if ((timer2 -self.burnouttimer)/1000)>self.burnouttime then

    local mdl= self.particlelist[#self.particlelist]

    table.remove(self.particlelist,#self.particlelist)

    mdl:Release()

    self.burnouttimer = Time:Millisecs()

    end

    end

     

    if (self.enabled == true) and (self.burnout == true) and (self.exploded==true) and (self.burn == false) and (#self.particlelist <= 0) then

    self.enabled=false

    collectgarbage()

    self.entity:Release()

    end

     

    if (self.enabled == true) and (self.exploded==true) and (self.settle == true) and (self.particlecounter2 <1) and (self.burn==false)then

    self.settle =false

    self.burn=true

    self.burntimer = Time:Millisecs()

    end

    end

     

     

     

    function Script:Collision(entity, position, normal, speed)

     

    if (self.exploded==false) and (self.enabled == true) and (speed > 8) then

    --Debug:Error("break "..tostring(speed))

    self.collisonpoint = self.entity:GetPosition()

    self.entity:SetCollisionType(Collision.Debris)

    self:Detonate()

    end

    end

     

    function Script:Detonate() --in

    if self.exploded==false and (self.enabled == true) then

    self.exploded=true

    self.timer = Time:Millisecs()

    self.entity:Hide()

    end

    end

     

     

     

     

    --This function will be called when the entity is deleted.

    function Script:Delete()

    collectgarbage()

    end

     

     

     

    --This function will be called when the last instance of this script is deleted.

    function Script:Cleanup()

    collectgarbage()

    end

     

    This was designed to be used with the fpsplayer.

    Instructions:

    • Attach the script to an object with a collision type of prop.
    • Set the mass to something between 1 and 5 so you can pick it up.
    • The object needs to hit an object at a speed greater than 8

    The object on impact will on impact dissapear and blocks will explode out of it.

    It will "burn" for 10 seconds, then it will clean up, removing the particles oldest to newest.

    When there are no more molotovs in the scene it will clean up after itself.

    It also attempts to flow down slopes for a little distance to simulate liquids.

     

    THE REQUEST:

    Got to bold it for the TL;DR crowd.

     

    Is there a way to make it interact with the world but not interact with the character controller?

     

    ToDo: Replace blocks with Emitters to similate fire, create trigger areas to hurt player when inside.

  8. Just don't initialize steam in the init of the game and remove the steam.dll. Tada: steam independance..

     

    Not possible in the lua version. The game doesn't even attempt to run. In windows, the console version immediately terminates.

  9. I have modular rooms repeated throughout my map, I would like to move some sub rooms in the prefab and then run through the level, experiment with the placement of destructible walls and see how it changes the flow of my game. It does help when you can see the change in the prefab within the context of the level instead of in a map by itself, then having to load your level then making sure its set correctly.

×
×
  • Create New...