I hope that this is the right venue for these sorts of questions. I've been pretty impressed with the courtesy I've seen in this forum, and I hope it extends to what are almost surely stupid questions on my part.
I am currently flirting with the development of a game whose central mechanic is both two-dimensional and physics-based, which is what led me to Jbox2D, but now I'm concerned that I'm far out of my depth. Although the documentation of the library is fantastic, the absolute lack of tutorials or simple user guides (unfortunately my illiteracy in C++ rules out the otherwise wonderful Box2D User Manual) leaves me at your mercy, Box2D forums! Of course, if there is a better place for me to be asking for this kind of help, let me know, and I'll be on my way.
The game I am trying to design is fairly simple, as a concept. The game environment consists of a two-dimensional field of play which is populated by, in its most basic form, a goal zone and a charged particle. The object of the game is to force the charged particle into the goal zone. The player is limited in his/her interaction with the particle, in that he/she can only place other charged particles, which push and pull the target particle through the electric force. There is no gravity, and in its most basic form there aren't even obstacles other than rectangular walls which the particles can bounce off of. Naturally the particles can also bounce off of one another, too.
Again, this is only the most basic form of the game, and many other objects and features are planned, but I want to have a robust, expandable version of the game working with only the simplest elements before I start getting crazy with features. From the features that I've already mentioned, it becomes clear that I need a 2D rigid-physics engine with capable collision detection, and after searching around, Box2D comes as the most lauded, but there are some things giving me quite a bit of conceptual trouble.
Box2D, like most other 2D physics engines I've encountered, seems to be based around gravity as a force, which is unfortunately of little use to me. What I need to be able to simulate is the interaction between point charges that move freely in a two-dimensional space. Over a weekend of fevered python-scripting I hacked out the particulars of the force interactions in a step-based simulator (and the port of this code into Java has gone smoothly), but I'm having trouble building classes and methods that fit into the JBox2D framework. I don't want to waste this forum's time with beginner's questions, but I'm having a great deal of trouble understanding how the World class interacts with its contained Body objects during the step. That is, I'm having trouble determining how the World updates its elements, and how I might be able to inject my implementation of electric force interaction into that update-cycle.
So, for the tl;dr crowd, here are my questions in short:
1. Does JBox2D support forces other than gravity, such as electromagnetism; if not, does it provide a framework for defining custom forces, possibly with moving source-points, that allows them to be smoothly integrated into the simulation?
2. Is there a relatively simple explanation of the process the World class goes through when stepping through the simulation? If not, that's fine. I'm sure I'll figure it out eventually.
3. Are there any resources/tutorials for JBox2D other than the javadoc/source code and the Box2D user manual? I suspect the answer is no, as I've searched fairly extensively for such a thing, but in case I overlooked something it would be good to know. If not, I'll just get back to reading/drowning in the source code.
Anyway, thanks for enduring my beginner's questions. Just so you know, I'm also more or less a beginner as a programmer in general, too (I'm only in my second semester as a Computer Science bachelor at Uni), and so if this is the wrong place to be looking for help, please let me know. Any help is appreciated!
Peter
I am currently flirting with the development of a game whose central mechanic is both two-dimensional and physics-based, which is what led me to Jbox2D, but now I'm concerned that I'm far out of my depth. Although the documentation of the library is fantastic, the absolute lack of tutorials or simple user guides (unfortunately my illiteracy in C++ rules out the otherwise wonderful Box2D User Manual) leaves me at your mercy, Box2D forums! Of course, if there is a better place for me to be asking for this kind of help, let me know, and I'll be on my way.
The game I am trying to design is fairly simple, as a concept. The game environment consists of a two-dimensional field of play which is populated by, in its most basic form, a goal zone and a charged particle. The object of the game is to force the charged particle into the goal zone. The player is limited in his/her interaction with the particle, in that he/she can only place other charged particles, which push and pull the target particle through the electric force. There is no gravity, and in its most basic form there aren't even obstacles other than rectangular walls which the particles can bounce off of. Naturally the particles can also bounce off of one another, too.
Again, this is only the most basic form of the game, and many other objects and features are planned, but I want to have a robust, expandable version of the game working with only the simplest elements before I start getting crazy with features. From the features that I've already mentioned, it becomes clear that I need a 2D rigid-physics engine with capable collision detection, and after searching around, Box2D comes as the most lauded, but there are some things giving me quite a bit of conceptual trouble.
Box2D, like most other 2D physics engines I've encountered, seems to be based around gravity as a force, which is unfortunately of little use to me. What I need to be able to simulate is the interaction between point charges that move freely in a two-dimensional space. Over a weekend of fevered python-scripting I hacked out the particulars of the force interactions in a step-based simulator (and the port of this code into Java has gone smoothly), but I'm having trouble building classes and methods that fit into the JBox2D framework. I don't want to waste this forum's time with beginner's questions, but I'm having a great deal of trouble understanding how the World class interacts with its contained Body objects during the step. That is, I'm having trouble determining how the World updates its elements, and how I might be able to inject my implementation of electric force interaction into that update-cycle.
So, for the tl;dr crowd, here are my questions in short:
1. Does JBox2D support forces other than gravity, such as electromagnetism; if not, does it provide a framework for defining custom forces, possibly with moving source-points, that allows them to be smoothly integrated into the simulation?
2. Is there a relatively simple explanation of the process the World class goes through when stepping through the simulation? If not, that's fine. I'm sure I'll figure it out eventually.
3. Are there any resources/tutorials for JBox2D other than the javadoc/source code and the Box2D user manual? I suspect the answer is no, as I've searched fairly extensively for such a thing, but in case I overlooked something it would be good to know. If not, I'll just get back to reading/drowning in the source code.
Anyway, thanks for enduring my beginner's questions. Just so you know, I'm also more or less a beginner as a programmer in general, too (I'm only in my second semester as a Computer Science bachelor at Uni), and so if this is the wrong place to be looking for help, please let me know. Any help is appreciated!
Peter