Skip to main content
GameDev.net gamedev.net
🔒 Locked

Chemics Engine?

Started by Gandi Feb 23, 2009 at 10:30 AM 9 replies 1.7k views
Original Post
Gandi
Gandi
Hey, I wanted to integrate some sort of "chemics engine" into my next game. What I am thinking of is some engine which automatically calculates chemical reactions, the resulting energy and so on. So maybe you create tow "ChemicsObject"'s in 3D space and tell the engine they are made of H² and O² and have a specific mass, and the engine automatically generates a new ChemicsObject of H²O with 2 times the mass. Then you can combine these Objects with some Graphics Engine to see the results. My questions are: 1. Are there libraries for this (I couldn't find any) 2. If there are none, how would you design such a engine? Are there any articles/etc. on this? Thanks in advance gandi
Winegums
Winegums
That sounds like a lot of work. Even just representing the fluids in 3d is a feat unto itself.

I'm not aware of anything like that for games at the moment (since I suppose its use is sort of niche), I'd recommend looking at fluid dynamics to get an idea of how to visualise the chemicals. There might be professional software used by scientists to visualise chemical reactions, but I'd expect it to cost a lot..
LessBread
LessBread
Quote:
Original post by Gandi
So maybe you create tow "ChemicsObject"'s in 3D space and tell the engine they are made of H² and O² and have a specific mass, and the engine automatically generates a new ChemicsObject of H²O with 2 times the mass.


2 times the mass?

Molar mass of H2 ~2 grams
Molar mass of 02 ~32 grams
Molar mass of H20 ~18 grams

2H2 + 02 -> 2H20

4g + 32g -> 36g



"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
Yann L
Yann L
What you are looking for is called "chemical kinetics". It is a very complex subject. This paper, for example, shows a way to model the reaction of two molecules in 3D space. This is real hardcore stuff.

For a game, I would simply create a database of common reactions, and look up everything there.
Gandi
Gandi
Quote:
Original post by LessBread
Quote:
Original post by Gandi
So maybe you create tow "ChemicsObject"'s in 3D space and tell the engine they are made of H² and O² and have a specific mass, and the engine automatically generates a new ChemicsObject of H²O with 2 times the mass.


2 times the mass?

Molar mass of H2 ~2 grams
Molar mass of 02 ~32 grams
Molar mass of H20 ~18 grams

2H2 + 02 -> 2H20

4g + 32g -> 36g


What I meant what was 2 times the mass of h2o, but just forget about it^^

This chemical kinetics-stuff looks really scary, so I guess I'll go for the database approach.

Anyway, thanks for helping
gandi
kirkd
kirkd
It all depends on what you're trying to accomplish. If you want to replicate chemical reactions as they would occur in nature, I would recommend you change your goal. 8^) Computational chemistry is VERY complex and even the best possible simulations aren't quite right yet.

If you want something more simple, you can get away with rule-based systems that are limited in their scope and abilities but do indeed produce some artificial chemistries. Here are some references for you to check out. I realize some of them are paper, but with a teeny bit of effort you can find many of the papers online in PDF format for free.

-Kirk

http://www.mitpressjournals.org/toc/artl/15/1
This issue of the journal Artificial Life is devoted to artificial chemistries. Like I said, many of these articles can be found online for free.


http://organicbuilder.sourceforge.net/
Organic Builder is from Tim Hutton, a major researcher in artificial chemistries. The demo is very cool and gives you some insight into artificial chemistry's capabilities.


http://johnnyvon.sourceforge.net/
JohnnyVon is an artificial life/computational evolution application. Very cool.


http://www.ventrella.com/Darwin/darwin.html
Darwin Pond is another artificial life/evolution application.



Prune
Prune
Quote:
Original post by Yann L
This paper

This is useless information unless Gandi has a supercomputer, or better (and by better, I mean this http://mags.acm.org/communications/200807/?folio=91&CFID=23814078&CFTOKEN=83211963)
"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)
Yann L
Yann L
Quote:
Original post by Prune
Quote:
Original post by Yann L
This paper

This is useless information unless Gandi has a supercomputer

No shit, Sherlock... [rolleyes]
Gandi
Gandi
Oh wow, I never thought it would be impossible to perform calculations per molecule on a normal computer xD

To make that clear - I don't want to make an exact simulation of reactions. It is just for a game and it does not need to be perfectly realistic. So I guess a database or rule-based system will fit best.

Gandi
kirkd
kirkd
Look at the artificial chemistry links a suggested. Organic Builder in particular should give you some good ideas.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.