Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a game with newtonian physics.

Before you read the rest of this, this is my main question I'm trying to find an answer to:

  • I keep getting an error that pops up in a window after I try and run my code. What library or dll am I missing?

I've got an apple, an orange, and a pencil. I've read most of the documentation with the bullet physics engine, but I just can't seem to get the apple to behave like a piece of paper (2d-ish). Box2d physics engines and such aren't what I want. I don't like boxes in real life, let alone in cyberworlds.

I want the apple to float down to the ground, kind of swinging back and forth like a piece of paper would. This site gave some useful info that I integrated into my code: htp://!!-Simulating-paper-floating-to-ground

I have this idea for a game where you make objects behave like other types of objects, but my simulations of the game just aren't working.

I've gone through too many types of apples to count, and none of them even come close. I've tried searching for other people who have tried similar things, (using googles like, but no apples are ever returned!

Thus, I think I'm going into new territory here (don't worry, I'll opened source my techniques), and that's why things just aren't working for me.

I've tried programming different kinds of apples, but maybe I need a cyber apple? I don't know where to get one of those, maybe at a place like this: That site is down for now though - it's only ever talking about some cgi rubbish bin or something. Any tips on this as well?

This is the part of my code that deals with the apple simulating a game stuff:

///... /* setup other objects in the room and other stuff */ ...

// see
// for more arlet apple details
paper_2d_behaving_apple = new ArletApple[);

/ setup the arlet apple's general characteristics
paper_2d_behaving_apple.species = SPECIES.MALUS_DOMESTICA;
paper_2d_behaving_apple.parentage = PARENTAGE.GOLDEN_DELICIOUS_X_IDARED:
paper_2d_behaving_apple.introduced = make_year(1958);
paper_2d_behaving_apple.fruitColor =;
paper_2d_behaving_apple.fleshCOlor = APPLE_FLESH_COLORS::CREAM;
paper_2d_behaving_apple.fruitSize = GENERIC_FRUIT_SIZES.MEDIUM;
paper_2d_behaving_apple.GoodFor.add("eating fresh");
paper_2d_behaving_apple.GoodFor.add("use / keeping: 3 months or more");
paper_2d_behaving_apple.GoodFor.add("ripening PERIOD: 3 months or more");
paper_2d_behaving_apple.diseaseResistances = [DISEASE_RES::SCAB, DISEASE_RES::MILDEW];
///... (I cut some of this out for brevity's sake) ...

///* setup this specific apple's characteristics
paper_2d_behaving_apple.base_color = 0xff2000;
paper_2d_behaving_apple.bumpMap = BUMP_MAP_APPLE;
paper_2d_behaving_apple.texture = TEXTURE_REALISTIC_APPLE;
paper_2d_behaving_apple.feel_texture = SMOOTH;
paper_2d_behaving_apple.has_small_orangey_stripes = TRUE;
paper_2d_behaving_apple.DoesntHaveStem = FALSE;
paper_2d_behaving_apple.juicy = true; // needs a lowercase true for some reason
paper_2d_behaving_apple.has_bugs = false; // heck no it doesn't, I only buy good apples
///... (again I cut some stuff out so this post would'n't be too long) ...

// from!!-Simulating-paper-floating-to-ground
// "i think reactor can do this, i would try cloth witha high air resistance and a very high stifness"
// got this technique from
import gimp ; GIMP::Clothify(paper_2d_behaving_apple); pass
// / 7 should be high enough - it's a big number
paper_2d_behaving_apple.reactor.stiffness = 7.0f;
paper_2d_behaving_apple.reactor.airResistance = 5.0f; // high, but not "very high"

// setup the world the apple exists in
paper_2d_behaving_apple.owner = new BobFlanderson();
paper_2d_behaving_apple.owner.appearance = APPEARANCE_AWESOME;
paper_2d_behaving_apple.owner.clothes.size = CLOTHES_SIZE_MEDIUM;
paper_2d_behaving_apple.owner.owns_house = false; = true;
paper_2d_behaving_apple.owner.has_wife = false;
paper_2d_behaving_apple.viewSpace = LIVING_ROOM;
paper_2d_behaving_apple.RESTINGon = Kitchen.GetSurfaces()->COUNTER_BY_STOVE;
////... (also cut some  more out here too) ...

// transform the paper behaving apple into something viewable
view_matrix = new ViewMatrix();


actual_existing_apple_on_myCounter = new ExistingApple(paper_2d_behaving_apple);

// saw the IW_FIXED on some jam making site
// (
//  - that's the closest I've come to seeing anything close to what
// I'm trying to do
actual_existing_apple_on_myCounter.TranslateTo(0, 0, IW_FIXED(10.0f));
apple_now_inAir = actual_existing_apple_on_myCounter;

// I know this is C++ code, but some ruby sites were saying that it's best
// to put an exclamation point after a function that modifies a physical
// object - no luck yet for me

As you can see, I've got the basic concepts down, and I'm being very descriptive with my variable names and the object attributes. I setup the world very succinctly and clearly, although I've simplified the world in the game as compared to actual kitchen.

I think the problem is binding the paper_2d_behaving_apple to the actual_existing_apple_on_myCounter apple, and then transferring that to the one in the air (apple_now_inAir);

Whatever the case is, and no matter how well I format everything, nothing seems to happen. Below is an image of how I run the program:

enter image description here

Has anybody run into this before? Thanks in advance. I'm just starting out with programming games, having recently switched careers, so don't feel bad.

Thanks, Bob

share|improve this question

closed as not a real question by John McDonald, Byte56, Josh Petrie, ashes999, Tetrad Aug 9 '12 at 0:09

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

You are asking too many questions here. The part about the incompatibility should be asked on stackexchange as its not really related to gamedev. The apple part should be asked here as its own question. Also try to remove some of the irrelevant text about not having enough rep and other personal story stuff that doesn't help people answer the question. – AttackingHobo Aug 8 '12 at 19:09
"Why can't I get my code to work?" pretty much sums up every programming question ever. Think about what you want to know, and then edit the question accordingly, please. – jcora Aug 8 '12 at 19:12
This is now my favorite question on gamedev.SE. – Jimmy Aug 8 '12 at 19:25
I started to edit this. Then I realized it must be trolling ("cyber apple"?). If this is not trolling, you really need to start with something simpler. – Byte56 Aug 8 '12 at 20:01
This is so funny. The Rubyism -- apple_now_inAir.Drop!(); -- is a riot. There is something about this post -- ambitious, confused, doomed... – solidsnack Sep 14 '12 at 17:53

The main issue I see here is that you're using a Windows system. This OS works best for simulating things like windows and doors (non-organics). You need to switch to a Macintosh computer, these are exceptional with simulating apples. The latest version of the OS not only simulates apples, it has additional support for large cats, particularly mountain lions. However, if you want to continue using your Windows system, you're going to need to make some changes. First download the Visual Studio, it's primary use is for visualizing code. In your case, it will visualize your apples.

Next you need to code-plant a binary tree to get your apples to properly mature. Make sure to add plenty of leaves so that the tree grows strong (also make sure you give it a big root). To test the apples for ripeness you can take a byte out of one and pass the bits through the tasteTest() function. Now, you've got apples! But, you said you wanted them to be like paper right? You'll want to port them to a flat file to achieve that effect. Don't use a database to store the apples, they won't be flat enough.

Finally, to get the apples to float down you're missing one critical step in your code! You forgot to add:

paper_2d_behaving_apple.hasGravity = true;

It's a noob mistake, but that's OK. Finally, make sure you put the apple at the top of the screen, so it has somewhere to fall. And Jimmy suggested, you can also turn the monitor upside down if the apple is on the wrong side, since you're just starting, this is likely to happen.

As a side bonus, since you're using Windows, if you wanted to make an apple pie chart in Microsoft Excel, you could easily simulate a window to cool it on.

Alternatively there is a much easier way of doing this if you want to spend a little money.

There's a device called then ENCOM Digitizing Molecular Laser. I've seen it used to digitize apples before, and I think it would come in handy for you. You wouldn't even have to type in all those variables, the scanner would do it for you. Here it is in action:

enter image description here

share|improve this answer
It might be confusing to you, but I understand it. It's my computer that has the problem, which is why I was thinking I was missing some libraries or something. I'm actually reading through the google coding style guide right now. Hopefully that will resolve some of the concerns you guys have about my coding style. – Bob Flanderson Aug 8 '12 at 20:45
You're right, I was confused. I changed my answer. – Byte56 Aug 8 '12 at 21:29
Yes! Please visualize my apples! I haven't been able to do that yet because I still haven't found the library that I'm missing – Bob Flanderson Aug 9 '12 at 0:42
I think the root problem is: paper_2d_behaving_apple.owner.has_wife = false; If it had a wife then she would tell him what's wrong. – David Thielen Sep 15 '12 at 0:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.