Does anybody know of a good resource for programming the behaviors of various materials interacting?
Game programming physics resources usually cover collision detection, momentum, intertia, etc., but they seem to deal with a sort of idealized "material". I'm interested in simulating behavior of, say a projectile striking metal, which would deform more plastically, vs. one striking wood, which would tend to splinter, or glass, which would shatter.
Is there a book or online resource that deals with this from a game/simulation perspective?
I believe this gamedev.net article on material deformation has a lot of what you're looking for.
If you're interested in things like simulating projectiles striking metal, plastic deformation, fracturing glass, etc. I don't think games will offer you much that's based on rigorous physics.
Those kinds of calculations are usually done using finite element analysis packages like ANSYS, NASTRAN,ABAQUS etc. If you're a material scientist, and you want more than an empirical answer, I would say that gaming engines wouldn't have the fidelity that you're looking for.
I loaded the material deformation article that chaos posted. I'm firmly in the FEA camp.
LS Dyna is another contender that you should check out. It's used for highly non-linear impact problems as well.
Related
I'm playing with ECS. I'd like to know if it is possible to have lots of cubes with rigid bodies instantiated as entities in order to get lots more of them?
I want tens of thousands (if not more) of simple (Mesh + Collider + Rigidbody) objects in a scene just to passively interact with the scene.
ECS is an architecture pattern which stands for entity-component-system. In answer to your question; Yes. It is possible to have many instances of simple mesh-rigidbody-collider entities, if you engineer your code in such a way to accommodate this technical requirement. The rest of this answer is moving forward with the assumption you are referring to designing your own game engine (as the question lacks detail)
From my experience (I have designed 2 physics engines and 3 custom game engines) the major bottlenecks are as follows:
Graphics implementation - It doesn’t matter if you’re using OpenGL or DirectX, inexperienced or outdated graphics implementations are a huge source of custom engine bottlenecks. To remedy this, I suggest using the modern OpenGL tutorials, specifically on things like deferred rendering. In DirectX, the implementations can get quite complicated as there are less learning resources available for free online (Partly due to the fact that implementation details differ largely from version to version in directx). The big new thing I’ve heard from the latest directx version is something called mesh shaders which appear to “simplify” the process.. Research will be your friend for this step
Physics - This can reduce frame rate especially with lots of collisions. Unless you want to be a physics programmer, I suggest using available open source implementations such as Bullet physics, an excellent C++ physics engine. PhysX is an alternative however the implementation can be daunting, and both libraries suffer from subpar or terse documentation. These libraries can be easily integrated (from a design standpoint) into a standard ECS framework. If you are insistent on designing your own, I suggest reading through GDC presentations from people like Erin Catto, Erwin Coumins, Gino Van den Bergen, Dirk Gregorius etc.
As for “tens of thousands” I can almost guarantee if they aren’t spheres, tens of thousands of passive colliders will absolutely slow down your engine with a custom physics implementation. You can trivially multithread a custom physics engine with an iterative solver in two areas; Internal Collider geometry updating (both their bounding volume and world geometry) as well as the narrowphase of collision detection. If your broadphase collision detection outputs unique pairs of potential collisions, you can easily parallelize the actual collision testing if your geometry is updated prior to this stage, as collision detection could be considered a read-only task.
The last simple optimization for physics would be to use collision islands (see bottom of page under optimizations), which essentially separates collisions into groups which are independent, i.e. Two janga towers would be represented by two collision islands, and each can be solved in a separate thread due to data dependencies and the nature of iterative solvers.
For tens of thousands, you may even consider experimenting with compute shaders, as they are great for passive simulation of large quantities of objects. The link provided actually incorporates simple collisions in learning how to use these shaders.
I recently got interested in Theo Jensen's strandbeest, (If you haven't seen them before look them up! Such incredible engineering.) and I want to mess around with the design he has for his strandbeests' legs. However doing straight forward kinematics is waaay over my head for something like this.
Here's what I'm trying to model:
https://upload.wikimedia.org/wikipedia/commons/6/61/Strandbeest-Walking-Animation.gif
(Can't link directly because I don't have enough reputation :/)
All I really need to know is the path of the 'foot', so something visual isn't necessary.
The final goal is to be able to apply an evolutionary algorithm to it and see if I come up with the same linkage lengths as Theo did, or maybe improve them somehow, so if I there was some software that allowed scripts to be run, that'd be ideal.
Sorry if the question is kind of vague, I'm not all that sure what I'm looking for. Even if there is some maths/engineering topic that would make this easier I'd love to learn.
Thanks!
-Oisin.
Well, I searched for Physics Engine, and found a promising result.
Open Dynamics Engine seems to be an open source physics engine that could fit your needs.
The Open Dynamics Engine (ODE) is a free, industrial quality library for simulating articulated rigid body dynamics. Proven applications include simulating ground vehicles, legged creatures, and moving objects in VR environments. It is fast, flexible and robust, and has built-in collision detection.
Source: Wiki Introduction
There site is ode.org, and it looks like you should be able to evaluate it from there. "[S]imulating rigid body dynamics" is what you want, right? From what I understand, it ought to fit the bill. C++ is probably a reasonable language to attempt this in. I presume you have previous programming experience? This is not what I would consider a beginner's project.
When you get to the evolution, search for Genetic Algorithms. They're frequently used for optimization, and could help you out considerably. Another thing to consider is what you're actually optimizing for (lowest wind speed to function, fasted movement, etc).
I'm considering using a neural network to power my enemies in a space shooter game i'm building and i'm wondering; how do you train neural networks when there is no one definitive good set of outputs for the network?
I'm studying neural networks at the moment, and they seem quite useless without well defined input and output encodings, and they don't scale at all to complexity (see http://en.wikipedia.org/wiki/VC_dimension). that's why neural network research has had so little application since the initial hype more than 20-30 years ago while semantic/state based AI took over everyone's interests because of it's success in real world applications.
A so a good place to start might be to figure out how to numerically represent the state of the game as inputs for the neural net.
The next thing would be to figure out what kind of output would correspond to actions in the game.
think about the structure of neural network to use. To get interesting complex behavior from neural networks, the network almost has to be recurrent. You'll need a recurrent network because they have 'memory', but beyond that you don't have much else to go on. However, recurrent networks with any complex structure is really hard to train to behave.
The areas where neural networks have been successful tend to be classification (image, audio, grammar, etc) and limited success in statistical prediction (what word would we expect to come after this word, what will the stock price be tomorrow?)
In short, it's probably better for you to use Neural nets for a small portion of the game rather as the core enemy AI.
You can check out AI Dynamic game difficulty balancing for various AI techniques and references.
(IMO, you can implement enemy behaviors, like "surround the enemy", which will be really cool, without delving into advanced AI concepts)
Edit: since you're making a space shooter game and you want some kind of AI for your enemies, I believe you'll find interesting this link: Steering Behaviors For Autonomous Characters
Have you considered that it's easily possible to modify an FSM in response to stimulus? It is just a table of numbers after all, you can hold it in memory somewhere and change the numbers as you go. I wrote about it a bit in one of my blog fuelled deleriums, and it oddly got picked up by some Game AI news site. Then the guy who built a Ms. Pacman AI that could beat humans and got on the real news left a comment on my blog with a link to even more useful information
here's my blog post with my incoherant ramblings about some idea I had about using markov chains to continually adapt to a game environment, and perhaps overlay and combine something that the computer has learned about how the player reacts to game situations.
http://bustingseams.blogspot.com/2008/03/funny-obsessive-ideas.html
and here's the link to the awesome resource about reinforcement learning that mr. smarty mcpacman posted for me.
http://www.cs.ualberta.ca/%7Esutton/book/ebook/the-book.html
here's another cool link
http://aigamedev.com/open/architecture/online-adaptation-game-opponent/
These are not neural net approaches, but they do adapt and continually learn, and are probably better suited to games than neural networks.
I'll refer you to two of Matthew Buckland's books.
Programming Game AI by example
AI Techniques for Game Programming
The second book goes into back-propagation ANN, which is what most people mean when they
talk about NN anyway.
That said, I think the first book is more useful if you want to create meaningful game AI. There's a nice, meaty section on using FSM successfully (and yes, it's easy to trip yourself up with a FSM).
For a while I've been attempting to simulate flowing water with algorithms I've scavenged from "Real-Time Fluid Dynamics for Games". The trouble is I don't seem to get out water-like behavior with those algorithms.
Myself I guess I'm doing something wrong and that those algorithms aren't all suitable for water-like fluids.
What am I doing wrong with these algorithms? Are these algorithms correct at all?
I have the associated project in bitbucket repository. (requires gletools and newest pyglet to run)
Voxel-based solutions are fine for simulating liquids, and are frequently used in film.
Ron Fedkiw's website gives some academic examples - all of the ones there are based on a grid. That code underpins many of the simulations used by Pixar and ILM.
A good source is also Robert Bridson's Fluid Simulation course notes from SIGGRAPH and his website. He has a book "Fluid Simulation for Computer Graphics" that goes through developing a liquid simulator in detail.
The most specific answer I can give to your question is that Stam's real-time fluids for games is focused on smoke, ie. where there isn't a boundary between the fluid (water), and an external air region. Basically smoke and liquids use the same underlying mechanism, but for liquid you also need to track the position of the liquid surface, and apply appropriate boundary conditions on the surface.
Cem Yuksel presented a fantastic talk about his Wave Particles at SIGGRAPH 2007. They give a very realistic effect for quite a low cost. He was even able to simulate interaction with rigid bodies like boxes and boats. Another interesting aspect is that the boat motion isn't scripted, it's simulated via the propeller's interaction with the fluid.
(source: cemyuksel.com)
At the conference he said he was planning to release the source code, but I haven't seen anything yet. His website contains the full paper and the videos he showed at the conference.
Edit: Just saw your comment about wanting to simulate flowing liquids rather than rippling pools. This wouldn't be suitable for that, but I'll leave it here in case someone else finds it useful.
What type of water are you trying to simulate? Pools of water that ripple, or flowing liquids?
I don't think I've ever seen flowing water ever, except in rendered movies. Rippling water is fairly easy to do, this site usually crops up in this type of question.
Yeah, this type of voxel based solution only really work if your liquid is confined to very discrete and static boundaries.
For simulating flowing liquid, do some investigation into particles. Quite alot of progress has been made recently accelerating them on the GPU, and you can get some stunning results.
Take a look at, http://nzone.com/object/nzone_cascades_home.html as a great example of what can be achieved.
I would like to make a list of remarkable robot simulation environments including advantages and disadvantages of them. Some examples I know of are Webots and Player/Stage.
ROS will visualize your robot and any data you've recorded from it.
Packages to check out would rviz and nav_view
This made me remember the breve project.
breve is a free, open-source software package which makes it easy to build 3D simulations of multi-agent systems and artificial life.
There is also a wikipage listing Robotics simulators
Microsoft Robotics Studio/Microsoft Robotics Developer Studio 2008
Also read this article on MSDN Magazine
It all depends on what you want to do with the simulation.
I do legged robot simulation, I am coming from a perspective that is different than mobile robotics, but...
If you are interested in dynamics, then the one of the oldest but most difficult to use is sd/fast. The company that originally made it was acquired by a large cad outfit.
You might try heading to : http://www.sdfast.com/
It will cost you a bit of money, but I trust the accuracy of the simulation. There is no contact or collision model, so you have to roll you own. I have used it to simulate bipeds, swimming fish, etc.. There is also no visualization. So, it is for the hardcore programmer. However, it is well respected among us old folk.
OpenDynamics engine is used by people http://www.ode.org/ for "easier" simulation. It comes with an integrator and a primitive visualization package. There are python binding (Hurray for python!).
The build in friction model.. is ... well not very well documented. And did not make sense. Also, the simulations can suddenly "fly apart" for no apparent reason. The simulations may or may not be accurate.
Now, MapleSoft (in beautiful Waterloo Canada) has come out with maplesim. It will set you back a bit of money but here is what I like about it:
It goes beyond just robotics. You can virtually anything. I am sure you can simulate the suspension system on a car, gears, engines... I think it even interfaces with electrical circuit simulation. So, if you are building a high performance product, than MapleSim is a strong contender. Goto www.maplesoft.com and search for it.
They are pretty nice about giving you an eval copy for 30 days.
Of course, you can go home brew. You can solve the Lagrange-Euler equations of motion for most simple robots using a symbolic computation program like maple or mathematica.
EDIT: Have not be able to elegantly do certain derivatives in Maple. I have to resort to a hack.
However, be aware of speed issue.
Finally for more biologically motivated work, you might want to look at opensim (not to be confused with OpenSimulator).
EDIT: OpenSim shares a team member with SD/Fast.
There a lots of other specialized simulators. But, beware.
In sum here are the evaluation criteria for a simulator for robot oriented work:
(1) What kind of collision model do you have ? If it is a very stiff elastic collision, you may have problem in numerical stability during collisions
(2) Visualization- Can you add different terrains, etc..
(3) Handy graphical building tools so you don't have to code then see-what-you-get.
Handling complex system (say a full scale humanoid) is hard to think about in your head.
(4) What is the complexity of the underlying simulation algorithm. If it is O(N) then that is great. But it could be O(N^4) as would be the case for a straight Lagrange-Euler derivation... then your system just will not scale no matter how fast your machine.
(5) How accurate is it and do you care?
(6) Does it help you integrate sensors. For mobile robots you need to have a "robot-eyes view"
(7) If it does visualization, can it you do things like automatically follow the object as it is moving or do you have to chase it around?
Hope that helps!
It's not as impressive looking as Webots, but RobotBasic is free, easy to learn, and useful for prototyping simple robot movement algorithms. You can also program a BasicStamp from the IDE.
I've been programming against SimSpark. It's the open-source simulation engine behind the RoboCup 3D Simulated Soccer League.
It's extensible for different simulations. You can plug in your own sensors, actuators and models using C++, Ruby and/or RSG (Ruby Scene Graph) files.
ABB has a quite a solution called RobotStudio for simulating their huge industrial robots. I don't think it's free and I don't guess you'll get much fun out of it but it's quite impressive. Here's a page about it
I have been working with Carmen http://carmen.sourceforge.net/ and find it useful.
One of the disadvantages with Carmen is the documentation with all respect I think the webpage is a bit outdated and insufficient. So I like to hear from other people with experience in working with Carmen, or student reports/projects dealing with Carmen.
You can find a great list with simulation environments http://www.intorobotics.com/robotics-simulation-softwares-with-3d-modeling-and-programming-support/
MRDS is one of the best and it's free. Also LabView is good to be used in robotcs
National Instruments' LabView is a graphical programming environment for developing measurement, test, and control systems.
It could be used for 3D control simulation with SolidWorks.
MRDS is free and is one of the best simulation environment for robotics. Workspace also can be used, and please check this link if you want a complete list with robotics simulation software
Trik Studio has a nice and clear 2D model simulator and also visual and textual programming programming environments for them. They also soon will support 3D modeling tools based on Morse simulator. Also it is free and opensource and has multi-language interface.