Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 25 Oct 2005
Offline Last Active Sep 15 2016 02:43 PM

Posts I've Made

In Topic: Efficiently calculating increase in money over a period of time

07 May 2013 - 05:39 AM

The player has a known number of workers (eg. 10, 20, 123)

Each worker will produce 100 credits per minute

A new worker is generated periodically (eg. every 1 minute, every 1.5 minutes, every 30 minutes) based on other variables

A period of time passed (eg. 1 minute, 4 minutes, 2034 minutes)


How to I calculate how many credits have been produced in the time period?



The player has 20 workers

The worker spawn rate is 1 worker every 2 minutes

20 minutes have passed since the last update


How many credits have been generated in this time frame

In Topic: Efficiently calculating increase in money over a period of time

07 May 2013 - 04:28 AM

I'm not really seeing how to apply this to my problem in a more general manner. Your solution does provide the answer for 1 hour where the increase in workers is 1p/m. How to I alter this to handle 2,3,4 hours or a worker increase of 2 p/m?

In Topic: Game engine design help!

10 August 2010 - 02:17 AM

Original post by lightbringer
You can of course build your own ModelView matrix and transform each vertex yourself. But this is not efficient - you should leave this kind of operation to the graphics card, which can perform it in parallel for many of your vertices (you can still compute the MV yourself instead of using glTranslate and glRotate, though). You already have the position and orientation of your actors stored, and that's all you need for distance checks and collision detection (along with a bounding volume which you can compute once at startup by looking at the local coordinates in the actor's mesh for instance).

Ok, that makes sense.
What happens when an actor contains another actor though. ie. My player actor is carrying a barrel actor.

I get that I can rotate and transform to draw the player, then again to draw the barrel but how then do I know where the barrels bounding box is since I now have no global position for the barrel?

In Topic: Game engine design help!

10 August 2010 - 01:47 AM

Original post by lightbringer
So, first, like stated above, a vertex is just one point. At minimum the vertex has x, y, z for position in the local space (the coordinate system of the model the vertex belongs to). It can also have a set of x, y, z for defining a normal vector (for lighting) and s, t for texture coordinates.

For positioning your triangles, you don't need to retrieve anything back from OpenGL. For now, if you want to keep drawing in immediate mode like you have been doing, what you can do is simply start with an identity modelview matrix, then translate and rotate to the position of the model. Thus your world and local space become the same, and at this point you can simply draw your triangles using their local coordinates.

The wording in my first post was incorrect, the vertex has 3 floats (x,y and z). I realise that my terminology isn't brilliant.

I could just use rotate and translate but I'd rather just transform the coordinates so that I can easily compare the position of two objects (for collision detection and for working out distances between objects)

In Topic: local coordinated to world coordinates

22 April 2008 - 09:42 PM

Sorry Ill try to be clearer. In this matrix

1 0 0 X
0 1 0 Y
0 0 1 Z
0 0 0 1

Are X,Y and Z the world coordinates of the current position no matter how many translates and rotates I do?