Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 25 Oct 2005
Offline Last Active Feb 20 2015 10:41 AM

Topics I've Started

Trading and deck management in a multiplayer card game

21 October 2014 - 11:12 AM

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...

  1. 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?)
  2. 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...

  1. 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.
  2. 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.

Platformer movement (Flashback / Prince of Persia style)

17 September 2013 - 07:50 AM

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?

Efficiently calculating increase in money over a period of time

06 May 2013 - 01:49 AM

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!

Sorting by depth

21 August 2010 - 04:10 PM

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?


Game engine design help!

09 August 2010 - 01:32 PM

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,