• Content count

  • Joined

  • Last visited

Community Reputation

146 Neutral

About BkoChan

  • Rank
  1. I am currently creating an multi-player browser version of the Triple Triad card game from Final Fantasy 8.   The matches work in a similar way to most modern mobile games in that they are not 100% live. It is possible for a player to be playing multiple matches at any one time. The player is free to log out and come back at a later date to take their turn in any number of matches.   Players are able to build up a collection of cards to play with. When a player joins a new match they allocate 5 cards from their deck to play in that match (this is so that the player can't play the same card in more than one match simultaneously)   The problem is I can't settle on the best way of allowing players to acquire new cards.   My first thought was to just go with the original trading mechanism from FF8. If a player wins a match they can steal a number of cards from their opponents hand to add to their own deck. I like this method because it adds a real element of competition between players but there seems to be a number of draw backs... If a players deck size drops below 5 (the number of cards required to play a match) then how do they ever recover? (Maybe they can choose to abandon their deck and start again?) How do I introduce rare cards if players can only ever gain cards from other players My second idea was to allow players to earn credits from playing matches. They could then purchase new cards from a store. Again, I've found problems with this method... There's nothing to stop players buying large numbers of the better, rarer cards from the store. This leads to an arms race where eventually it will be impossible to win a game without having the very best cards. This method effectively removes risk from games because there's nothing to lose Does anyone have any suggestions that could get me past this road block? The project is actually coming along quite nicely apart from my inability to settle on these points.
  2. I'm programming a pretty basic tile based platformer in Javascript and I'm struggling to figure out how to code the movement of entities correctly.   Originally the entities were directly influenced by key presses ie. pressing left would make the entity move one tile width to the left (Pressing SHIFT would make the entity sprint instead of walk) but this caused problems with the entity's animation and position if the entity began to sprint half way through moving.   I remember games like Flashback and Prince of Persia had a very distinct movement style where the entity would only begin to sprint when it reached the next tile. I tried to implement a system where the player would actually move onto the next tile instantly but the sprite would have an offset that would catch up to the entity eventually (and the entity would not process key presses until the sprite had caught up). This gave the right effect when moving left and right but it all started to fall apart when jumping / crouching / getting knocked back. Also I liked the way that (in Flashback) it was possible to press a button to draw your gun mid-step and the character would remember to do that when they reached the next tile.   Could anyone suggest a simpler way of achieving this kind of movement or point me to an existing example?
  3. 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?   example: 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
  4. 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?
  5. I'm currently working on the server side logic of a real-time online browser game build using NodeJS. Currently the logic works like this...   1. Receive an event from a player (queue something for production) 2. Calculate when the next event will happen in the game (look at when the next production will complete or when the next research project will finish) 3. Set a timeout so that the server effectively sleeps until the next event happens (unless interrupted by a player sending another event)   This seems to work very well so far. When the server wakes up from the timeout it updates the game with the amount of time passed and all production and research etc. is updated by the ellapsed time.   The problem I'm having at the moment is that the amount of money generated for a player is based on how many workers they have. Worker numbers slowly increase over time until they reach a population cap. Given the following facts...   - The player has 1 worker - The player has no money - A new working is created every minute - A worker produces 100 credits per minute   How many credits does the user have after an hour? I have no idea how to predict the number of credits produced as the number of workers increases over time   I hope that makes sense!
  6. I currently have a tree of nodes in my game. The screen shot below shows this tree rendered. The larger girls are top level nodes, with no parents. The boy is also a top level node, the small girl is a child node of the boy. When each node is queued with the renderer it applies its own transformations to the current matrix and then stores a copy of it. When the screen is finally drawn I keep replacing the current matrix with the one stored inside each node. This positions everything correctly within my scene but I get the following problem... Uploaded with ImageShack.us As you can see from this screen shot the boy is being rendered correctly on top of the other parent nodes however the child node is being obscured because it is drawn after its parent. How can I sort my scene to correct this problem? The only positioning information I have at the time the image is rendered is a matrix defining where on the scene it should be rendered. Can I extract a Z position from this matrix? Thanks!
  7. Game engine design help!

    Quote: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?
  8. Game engine design help!

    Quote: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)
  9. Game engine design help!

    I keep coming back to game development and keep falling at the same hurdle so it's time I solved this once and for all! Please excuse the wall of text. I am building a game engine. So far my code goes like this... Engine creates a game state game state creates an actor actor creates triangles triangles have 3 vertices vertices have 3 points The engine also creates a renderer. The actor has a position x,y,z. Triangles have no position, their position is defined by the actors position plus the position of their 3 vertices Actors can also contain other actors (child actors) The game engine calls render on the state, the state calls render on all its actors and the actors loop over their triangles and queue them inside the renderer object. Inside the renderer object the triangles are stored inside a vector. Once all actors have queued their triangles, the game engine then tells the renderer to draw the whole scene. From this point on I am lost. Just outputting the triangles to the screen draws them all in the center, since I'm not using the actors position for anything. Even if I add the position of the actor to the triangles position, it doesn't take into account that the actor may have rotated and doesn't help me render child actors which will be relative to the parent actor. What I *think* I need to do is when render is called on the actor, translate and rotate to the actors position, then multiply each of the triangles vectors by the current model/view matrix. Is it possible to retrieve the resulting x,y and z positions from this multiplication? for example... if an actor is at 10.0f, 0.0f, 0.0f and the first vertex of the actors first triangle is at 2.0f, 0.0f, 0.0f is it possible to use glTranslatef( 10.0f, 0.0f, 0.0f ); then multiply the position of the vertex by this matrix and retrieve the "global" space coordinates of the vertex as if I hadn't translated? Please, please, please help. I've been stuck on this for so long and I really would like to move forward,
  10. I'm trying to build a (simple) game engine using c++, SDL and OpenGL but I can't seem to figure out the next step. This is what I have so far... An engine object which controls the main game loop A scene renderer which will render the scene A stack of game states that can be pushed and popped Each state has a collection of actors and each actor has a collection of triangles. The scene renderer successfully sets up the view projection matrix I'm not sure if the problem I am having relates to how to store an actors position or how to create a rendering queue. I have read that it is efficient to create a rendering queue that will draw opaque polygons front to back and then draw transparent polygons from back to front. Because of this my actors make calls to the "queueTriangle" method of the scene renderer object. The scene renderer object then stores a pointer to each of the actors triangles, then sorts them based on their position and then renders them. The problem I am facing is that for this to happen the triangle needs to know its position in world coordinates, but if I'm using glTranslatef and glRoatetef I don't know these coordinates! Could someone please, please, please offer me a solution or perhaps link me to a (simple) guide on how to solve this. Thankyou!
  11. I was wondering if anyone knew of a simple opengl game engine for linux where the source is available to read. I basically want to read the source to get a better idea of how things are put together without worrying about the code being cross platform or having fancy particle effects or anything.
  12. Moving a point in 3d

    Hi Guys, I realise you must get this question ten times a day but I can't find a solution by searching the forum. I have a point at 0,0,0 I rotate the point 30deg around the Y axis, the 30 around the X axis. I then want to move the point 10 units forward. I know how to work out the new X and Y position MovementX = cos(angle) * MoveDistance; MovementY = sin(angle) * MoveDistance; But then I realised that these values will change because of Z, won't they? How do I work out Z and have I worked out X and Y correctly? Thanks!
  13. Topic deleted

    Sorry realised i posted this in the wrong forum [Edited by - BkoChan on October 7, 2009 5:20:04 AM]
  14. 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?
  15. Let me see if I understand then glTranslatef( 0.0f, 0.0f, -1.0f ); glRotatef( 1.0f, 0.0f, 0.0f, 1.0f ); glTranslatef( 0.0f, 0.0f, -1.0f ); glRotatef( 1.0f, 0.0f, 0.0f, 1.0f ); glTranslatef( 0.0f, 0.0f, -1.0f ); // Draw object here glGetFloatv(GL_MODELVIEW_MATRIX , modelview); for( GLuint i = 0; i < 4; i++ ) { std::cout << modelview[ i ] << " " << modelview[ i+4 ] << " " << modelview[ i+8 ] << " " << modelview[ i+12 ] << " " << std::endl; } Produces the following matrix.... 0.999391 -0.0348995 0 0 0.0348995 0.999391 0 0 0 0 1 -3 0 0 0 1 So that -3 is the Z position, no matter how many translates and rotates I do? Sorry for the newb style questions, I just want to make sure I understand