Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 12 Sep 2009
Offline Last Active Sep 27 2014 04:30 AM

#5116844 Fog of war game logic

Posted by on 14 December 2013 - 05:43 AM

Your question is quite broad, it really depends on your needs. Let's say that you have a data structure holding your level information. If the level is the same for every player, one instance is enough. But if you're saying that different people might see certain stuff, you might want to have an instance for every player, plus a global instance that holds all recent data. If a player sees more, his own instance is updated with the global one.


If you implement the multiple instances, be sure to read/write to the correct one at the correct time. To give an example: in Company of Heroes, path finding is (unfortunately) done on the global instance. This means that I can use this path finding to find out if a certain route is available. (let's say my map shows a bridge in the fog of war. When I give a move order to my troops, I can see if the bridge is available or broken by the path my troops will go, even before they can see the actual area).


Technically speaking, the AI should have the same resources as the humans. However, the fair method makes programming the AI a lot harder: you need to implement certain behaviours (such as "smart scouting"). While if you just give them the full map to see, they know where the resources are without scouting. Because creating a worthy AI is a very hard challenge, AI's are often have access to the global map.

#5095569 Do I (really) need openGL?

Posted by on 20 September 2013 - 02:22 PM

About the 2D/3D: most 2D/3D related calculations can easily be extended (A 2D vector addition can also be done as a 3D addition with the last element zero) and most API's accept 2D data as well.  This means that you can perfectly use the OpenGL/Direct3D or any abstraction (SDL/SFML/Allegro...) for 2D games and still utilize the power of the GPU. Given that a GPU has a raw processing power that is far beyond a CPU's, even for simple 2D games like platformers I'd recommend using it.


About the "do I need a videocard"; the whole pipeline goes a little like this:

Application <-> (optional) Abstraction layer (such as SDL) <-> OpenGL/DirectX <-> Video Drivers <-> Hardware


This means that if there is a video driver that uses the CPU instead of the GPU; then you can run a game without a videocard but given the fact that the CPU has a lot less processing power (but is a lot more flexible) it probably won't be very smooth.


The hardware (GPU's) are there because they offer enormous amounts of power,

The drivers are there because every hardware is different and every vendor has their own architectures, (and because of this writing code directly for one GPU architecture is a very bad idea!)

The OpenGL/Direct3D api's are there because they standardize calls: you don't want vendors to include their own special features so you have to write your graphics code only once to run on all GPU's that support a certain OpenGL/Direct3D level,

The abstraction layers are there because the OpenGL and Direct3D API's are suited for all possible graphics applications and libraries such as SDL make certain applications easier (and often provide other features such as input handling which a graphics API doesn't provide).

#4942629 Team communication software

Posted by on 23 May 2012 - 10:58 AM

Assembla (see link on gamedev page) or Redmineas ticket / tracker system. Altough I think assembla is quite good (I'm in love with the cardwall tool)

MSN as Instant Messenger / Mumbleas voice chat

And the most important thing: these tools might be great, nothing beats real-life, face to face communication and a wall with post-its ;)

#4942608 Java RPG Item system

Posted by on 23 May 2012 - 10:13 AM

The more details you give, the better.
-> How big is the inventory? If every Item takes maximum of 1 'spot' in your inventory, you could go for an 2 dimentional array.

Item Inventory[HorizontalSizeOfInventory][VerticalSizeOfInventory];

You can then loop them and everywhere Item[x][y] != null, you display that item.

For the Item structure, I'd work with a system like this:
Have one base Item class with the basics that every Item has; If every item has the same, leave it this way.
If some Items are different (for instance, Health items, Weapon Items ...) inherit from the Item base class and use the factory design pattern. This allows you to 'load' your items from a database or XML. Don't create a class for every Item, as it makes your code to 'implementation-wise' and adding Items will be more difficult.

The following UML can make things clear: make the following. Then create some class that will spawn the items (factory pattern) and add them to the inventory.

Posted Image

Of course, the array idea only works with everything of size 1. Otherwise you could use some system that has a 'size' field in the Item class and prevent from inserting new items to zones which are taken :)