Jump to content

Einlander

Members
  • Posts

    778
  • Joined

  • Last visited

Posts posted by Einlander

  1. There is always the option to make a wikibook for leadwerks. We can always use the same game idea and book structure as unity or a similar engine. This way when it needs to be updated someone can and new sections can always be added.

  2. I wouldn't go that far about ATI. I only have problems with exactly 1 piece of software when it comes to ATI cards. That and any software that thinks using hardware Physx is a good idea. How is it that my 8 core 4Ghz processor and 2 R9 270x gfx cards struggling to run Borderlands 2 on max settings and max Physx? Because NVIDIA made the tools and basically told and users to f off. If you can't tell I'm bitter against NVIDIA. (got a nvidia motherboard, with NVIDIA chipsets and built in NVIDIA gfx card? Installed an ATI gfx card? Gonna have to disable hardware Physx)

  3.  

     

    Thanks and holy ****! I was expecting more from bullet physics. In the thread I posted in the OP, a chunk with about 1500 triangles takes about 6ms to generate a mesh collider for. Mesh generation is always under 1ms, usually like 300 microseconds.

     

    Are you using RigidBodys or static colliders? Make sure you did it with static colliders as those should be faster.

     

    I don't think my CPU is that amazing either; Intel Core i7-2670QM @ 2.20GHz 4 cores (8 threads).

     

    This does not bode well because I'm thinking about integrating Bullet physics into Unity.

     

     

     

    Interesting, but without the exact number of triangles there's little one can do with that information.

     

    Leadwerks only deals with triangles so the exact number would be 400^2

     

    Also Leadwerks uses Newton physics.

  4. You can create tiles with prebuilt waypoints. The road waypoint has a key saying its a road, the sidewalk has a waypoint saying its a sidewalk. Cars only look for car waypoints and people look for sidewalks. The complicated part is getting the car to plot a path from a location to another exclusively using waypoints.

  5. That worked beautifully. I was trying to apply the texture coordinates for every single triangle individually. I also added a scaling feature.

     

    The new function for all thoe intrested.

     

    
    

    function Script:MakeTerrain(TerrainSize,texscale)

    --texscale must be => 1

    if ( (texscale == nil) == true or (texscale <= 0) == true) then texscale = TerrainSize end

    local terrain = nil

    terrain = Model:Create()

    terrain:SetColor(0.5,0.5,0.5)

    local surface = terrain:AddSurface()

    -- add vertexes and uv's

    System:Print("Generating Vertices")

    for TerrainWidth=0 , TerrainSize do

    for TerrainDepth=0 , TerrainSize do

    surface:AddVertex(Vec3(TerrainWidth*self.TerrainSquareSize,0,TerrainDepth*self.TerrainSquareSize), Vec3(0,1,0),Vec2((TerrainWidth / TerrainSize)*texscale, ((TerrainDepth / TerrainSize)*texscale)*-1))

    end

    end

    -- add triangles

    System:Print("Generating faces")

    trianglestrip = 0

    System:Print(tostring(surface:CountVertices()))

    for triangle = 0 , (TerrainSize*TerrainSize)+(TerrainSize-2) do --(surface:CountVertices())/2 do

    point1 =trianglestrip

    point2 =trianglestrip+(TerrainSize+1)

    point3 =trianglestrip+(TerrainSize)-(TerrainSize-1)

    point4 = point3+(TerrainSize+1)

    --System:Print("Bottom:"..tostring(point1+1).."|"..tostring(point2+1).."|"..tostring(point3+1).."["..tostring(point4+1).."]")

    --System:Print("Top:"..tostring(point2+1).."|"..tostring(point3+1).."|"..tostring(point4+1))

    surface:AddTriangle(point1,point3,point2)

    surface:AddTriangle(point2,point3,point4)

    trianglestrip =point3

    end

    surface:Update(true)

    System:Print("")

    return terrain

    end

     

    This isn't quite ready for prime time. I need to swap the direction of the triangles every other row as described here: http://dan.lecocq.us/wordpress/2009/12/25/triangle-strip-for-grids-a-construction/ and that should be easy enough.

     

    A last question, Is it possible to change the material for a single polygon as if it were a multi-material mesh?

  6. I'm trying to make a terrain generator, I have the mesh plane generated, but I'm at a total loss at how to generate the uv's for all the triangles.

     

     

    This is the code that I currently have. How would I go about programmaticly adding uv's?

     

    function Script:MakeTerrain(TerrainSize)

     

    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

     

     

    System:Print("Generating faces")

    trianglestrip = 0

    System:Print(tostring(surface:CountVertices()))

     

    for triangle = 0 , (TerrainSize*TerrainSize)+(TerrainSize-2) do --(surface:CountVertices())/2 do

    point1 =trianglestrip

    point2 =trianglestrip+(TerrainSize+1)

    point3 =trianglestrip+(TerrainSize)-(TerrainSize-1)

    point4 = point3+(TerrainSize+1)

    System:Print("Bottom:"..tostring(point1+1).."|"..tostring(point2+1).."|"..tostring(point3+1).."["..tostring(point4+1).."]")

    System:Print("Top:"..tostring(point2+1).."|"..tostring(point3+1).."|"..tostring(point4+1))

    surface:AddTriangle(point1,point3,point2)

    surface:AddTriangle(point2,point3,point4)

    trianglestrip =point3

    end

     

     

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

    System:Print("Adding UV's")

     

    surface:Update(true)

    System:Print("")

    return terrain

    end

  7. If you look at this trigger setup it has an OnEnter which is only fired once so you can use that to have any size and avoid having the collision keep getting called.

     

    http://leadwerks.wikidot.com/wiki:collision-enter-exit

     

    I have ran across that, but in my case I needed it to fire for every entity that enters it. Using the wikidot script, I can push an entity into it and then I have a free pass to go through without dying. It gets worse if they make it so it just hurts people and not kill them. For example I wade into acid and then people chase after me. I would get all the damage and no one else would.

     

    I do have a collision trigger script that is capable of tracking multiple entities entrances, exits and if they are just idling in the trigger. It is complicated due to me coding it to be network multiplayer friendly.

    • Upvote 1
  8. While making my game I ran into a situation where I needed to kill the player reliably and not depend on fall damage. The solution was to create a trigger that when the player touches it, they die.

     

    Kill_trigger.lua

    
    

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

    if entity.script then

    if entity.script.health>0 then

    if type(entity.script.Hurt)=="function" then

    entity.script:Hurt(entity.script.health+1,"WORLD")

    end

    end

    end

    end

     

    WARNING:

    If the player is to FALL ON TOP of the trigger, the kill trigger MUST be almost paper Thin. Otherwise your dead body will keep bouncing as if were on a trampoline.

     

    I used it for when the player falls in the water. When they fall in the river they die/drown.

    • Upvote 3
  9. When using the glass material, I assume Leadwerks continues to cull the objects behind the object. This leads to views where most of your level is simply missing. This does not happen in the editor.

     

    I have a map uploaded to demonstrate the bug. When you load the map in the editor you will see there are 3 colored boxes at the end of a path. When you start the map BEFORE you start to move, you will only see the blue box. Walk backwards and all the boxes appear. Walk back up to the glass. Strafe left or right. As you get to the edge of the glass the box in that direction appears. You can also make it happen by standing close to the glass and looking left or right.

     

     

    Also is there way in lua to simply disable culling totally in the game? I have other issues with the way Leadwerks culls objects. If not, can I designate an object as something that should not be put in the culling list?

    trasnparency_bug.zip

×
×
  • Create New...