Jump to content

How may boxes can you collide on your gear?


shadmar
 Share

Recommended Posts

coll.jpg

 

 

Create a project and replace App.lua using this :

 

When I reach about 150 it starts degrading fps when they collide.

 

--This function will be called once when the program starts
function App:Start()

   --Set the application title
   self.title="$PROJECT_TITLE"

   --Create a window
   self.window=Window:Create(self.title)
   self.window:HideMouse()

   --Create the graphics context
   self.context=Context:Create(self.window,0)
   if self.context==nil then return false end

   --Create a world
   self.world=World:Create()

   plane = Model:Box(30,1,30)
    shape = Shape:Box(0,0,0, 0,0,0, 30,1,30)
    plane:SetShape(shape)

   camera = Camera:Create()
   camera:SetPosition(9,3,0)
   camera:SetRotation(0,-90,0)

    self.light = DirectionalLight:Create()
    self.light:SetRotation(25,25,25)

   self.count=1

    --Create a box
	 self.box = Model:Box(1,1,1)
	 self.box:SetPosition(Math:Random(-2,2),Math:Random(5,25),Math:Random(-2,2))
	 self.box:SetColor(Math:Random(0,1),Math:Random(0,1),Math:Random(0,1))
	 self.box:SetMass(1)
    self.box:SetFriction(1,1)
    self.box:SetCollisionType(Collision.Prop)
	 --Create a shape
	 self.shape = Shape:Box(0,0,0, 0,0,0, 1,1,1)
	 self.box:SetShape(self.shape)
	 self.shape:Release()

   return true
end

--This is our main program loop and will be called continuously until the program ends
function App:Loop()

   --If window has been closed, end the program
   if self.window:Closed() or self.window:KeyDown(Key.Escape) then return false end

   if self.window:MouseDown(1) then
       -- instance boxes
       local box=self.box:Instance()
       box:SetPosition(Math:Random(-2,2),Math:Random(5,25),Math:Random(-2,2))
       box:SetColor(Math:Random(0,1),Math:Random(0,1),Math:Random(0,1))
       self.count=self.count+1
   end

   --Update the app timing
   Time:Update()

   --Update the world
   self.world:Update()

   --Render the world
   self.world:Render()


   --text
    self.context:SetBlendMode(Blend.Alpha)
    self.context:DrawText("FPS: "..Time:UPS(),2,2)
   self.context:DrawText("Boxes created : "..self.count,2,22)
   self.context:DrawText("Hold down left mouse button to instance boxes..",2,62)


   --Refresh the screen
   self.context:Sync()

   --Returning true tells the main program to keep looping
   return true
end

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

Reply will it be possible to be as goood as this one ?

Of course it will be as good as that one!

The fact that newton runs on the CPU and the demo you show runs on the GPU doesn't affect speed at all!

Get a brain...or stop trolling...

 

@ Shadmar

Can't try that demo, as i don't have LE3 installed, sorry.

(Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI)

Link to comment
Share on other sites

150 boxes in a pile with stable collision is quite good. Leadwerks 2 couldn't do that.

 

GPU physics tend to treat everything as a fluid, so they tend to get more unstable results, though they can simulate many more particles.

 

I thought by now people had grown tired of the thousands-of-oildrums demos that never make it into actual games.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I talked to the PhysX project director last year and at that time, they could still only support about 50,000 full rigid bodies in a scene, and they didn't have any kind of memory-efficient bodies for large volumes of vegetation. So it would have made large outdoors scenes impossible.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • 2 months later...

I don;t wan;t to look like a troll but 150 boxes are a bit low. I think I would need arround 2-3000. For now i go with physics disabled.

 

for 110 000 boxes demo have a look here

 

On a side note is it possible to easily integrate another physics engine ?

 

 

Late edit: just saw that 1000 boxes are doable in other thread,( which is better)

http://www.leadwerks.com/werkspace/topic/7317-physics-has-me-stuck/page__hl__newton__st__40

Link to comment
Share on other sites

I just don't see how 110,000 boxes falling is particularly useful for making a game. I'm much more interested in features like our motorized joints, which have tons of practical uses.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

well it would not hurt either to have the engine being able to handle a big number of collision boxes.

For example in eve there are fights of 1000vs1000 +5*2000 fight drones +misles. I know the network will become a problem at this point but still is good to know that your game engine can handle this (and people have more bandwitch those day, peer2peer transfer etc)

Bottom-line, if engine is not fast enough it will be disqualified from start when an engine is chose for a project.

 

Maybe add a second physics engine with opencl acceleration (bullet). I understood of forum that other people integrated other engines relatively easy in their projects so i imagine would be doable.

Link to comment
Share on other sites

The Leadwerks physics system is written in such a way that the underlying physics library can be swapped out with something else. I do not have any plans to replace Newton since it provides large-scale maps we can't get with other physics lbiraries, and there is no big reason to move backwards.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

For example in eve there are fights of 1000vs1000 +5*2000 fight drones +misles.

 

1. Leadwerks is not Carbon.

2. You don't see anything at all in that mess!

3. EVE is space. No terrain or anything.

4. That happens under 10% TiDi...

5. Unless you have carriers on field, there won't be anywhere near that much drones..

LINUX: Viagra for the PC.

 

running Slackware GNU/Linux since 1996

Linux Developer

 

Windows is a 32 bit shell for a 16 bit extension to an 8 bit Operating System designed for a 4 bit microchip by a 2 bit company which can't stand one bit of competition

 

You can protect yourself from the 12/21/12 thing by not using the US short hand date format :lol:

 

21/12/12 ... Nope, that doesn't work

12/12/21 ... Doesn't work either

 

 

Crisis averted...

 

EVE-Online exclusive 21-day trial

Link to comment
Share on other sites

I just don't see how 110,000 boxes falling is particularly useful for making a game. I'm much more interested in features like our motorized joints, which have tons of practical uses.

Having a bunch of boxes fall and interact with each other is practical for making games. It is a test. You see some people want to make games that have destructible objects in them. And what better way to see how many objects or small pieces the engine and hardware can handle. To me, being able to have destructible environment is much more game play than opening a door ;)
Link to comment
Share on other sites

Let's see what the situation is with the next patch. My goal is not to win the falling box wars, but there should be support for a good amount of fast stacking objects.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

1. Leadwerks is not Carbon.

2. You don't see anything at all in that mess!

3. EVE is space. No terrain or anything.

4. That happens under 10% TiDi...

5. Unless you have carriers on field, there won't be anywhere near that much drones..

a bit offtopic but i will answer

1. no idea what carbon is, if is eve engine , that is a big pile of ....mostly because made in python(interpreted language etc)

2. irelevant, the objects needs to move and physics(collisions) needs to be calculated

3. never said anything about terrain, but about collisions

4. still happens and need to work

5. almost any ship in eve have 5 drones

Link to comment
Share on other sites

Yeah I was sort of disappointed by this test :

 

http://www.youtube.com/watch?v=YmFJ_QAz07A

 

was 5000 cubes ...comp started lagging badly...

Threadripper 2920X Gen2 CPU(AMD 12-core 24 thread) | 32Gigs DDR4 RAM | MSI Nvidia GeForce RTX 2070 Stock OCed | ASRock X399 Professional Gaming Motherboard | Triple M.2 500Gig SSD's in Raid0

Windows 10 Pro | Blender | Paint.NetWorld Machine | Shader Map 4 | Substance Designer | Substance Painter | Inkscape | Universal Sound FX | ProBuilder | 3D World Studio | Spacescape | OpenSky | CubeMapGen | Ecrett Music | Godot Engine | Krita | Kumoworks | GDScript | Lua | Python | C# | Leadworks Engine | Unity Engine

 

Link to comment
Share on other sites

If you really want so many boxes to collide then implement your own physics engine, or write openCL code to send your calcs to you GPU, but your GPU does floating point calculations so then you mights start to see inaccurate results. Like everything else in the technology industry, there is a tradeoff. more accurate, but a little slower results, or faster results that are less accurate. It is possible to interchange the physics engine if you really want to support more bodies at once. I think you should try to come up with some alternatives when talking about a completely interactive/destructive environment. you should think about how you would implement that, would things break and bodies made on collisions. will the body dimensions be determined by the characteristics of the impact. I feel as though everyone keeps asking josh to make a collision object that stores your model, and upon collision, will automatically break the model and do all the thinking for the programmer. That may or may not be the case but that is how i see it coming across as.

bool Life()
{
 while(death=false)
 {
   if(death==true)
   return death;
 }
}

 

I have found the secret to infinite life

 

Did I help you out? Like my post!

Link to comment
Share on other sites

a bit offtopic but i will answer

1. no idea what carbon is, if is eve engine , that is a big pile of ....mostly because made in python(interpreted language etc)

2. irelevant, the objects needs to move and physics(collisions) needs to be calculated

3. never said anything about terrain, but about collisions

4. still happens and need to work

5. almost any ship in eve have 5 drones

 

I really shouldn't drag this conversation on, but I'd like to point out that EVE is run by pure targeting, which means no actual collision detection/rigid body physics is used.

 

when it comes to moving, it's just a matter of calculating the distance between nearby objects and your ship, and deceleration/changing course if it comes to near. you can't actually collide with objects in the game from my experience, therefore you don't need any physics collision calculations at all.

 

when it comes to firing, as long as your within the weapon's required distance, you will always hit, no collision calculations are ever done, especially since you can't dodge with your ships in the game.

 

this makes EVE an invalid example to use for comparison. A better idea would be to look at games like battlefield, or gta, or just cause 2, and try to get an idea of how many rigid bodies are falling about on your average playthrough.

 

unless you have a very specific reason for many thousands of rigid bodies, 100-1000 is a good amount, especially if you handle it smartly. (eg. disabling rigid bodies when at rest, only enabling them when an object is destroyed, finding the right balance of accuracy/speed, etc.)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...