Jump to content

  • Log In with Google      Sign In   
  • Create Account

Devine Caesar

Member Since 11 Jan 2011
Offline Last Active Mar 05 2013 04:35 PM

Topics I've Started

Are primitive types necessary for Game Programming?

26 February 2013 - 10:49 AM

I was stumbling around the net and discovered that suggestions have been made for primitive types to be removed from future versions of the Java programming language.  This got me thinking, even though Java more or less "does it for you" when it comes to memory management surely there is an inherent understanding that using primitives instead of objects where appropriate would be better? or is that a false assumption on my part?


For simple things like keeping track of a player's numerical attributes number of lives, health, experience, etc I would have thought using primitive types instead of Object types would have made more sense.


There are other programming languages that don't have primitive types at all, but to my knowledge they aren't as popular for games as C/C++ and Java etc wihich do have primitives.  So the question is quite simply, are primitive types necessary for Game Programming?  Would there be any knock on effects of removing them from a language?

XML DTD Repository?

31 January 2011 - 08:29 AM

Apologies in advance but I did not know where else to put this.

Does anyone know of any repositories or sites which provide existing XML DTDs for download? Not necessarily related to Games

Someone asked if they could download a DTD for an existing file type that uses XML. They were not looking for any file type in particular, they are building an application that is essentially a Calendar and they wanted to know what existing XML based file types existed and if their DTD were downloadable. This original question is not relevant anymore what we now just want to know, as the title of the post says, is there an XML DTD repository or collection that anyone knows of?

Clean Design vs Efficiency

11 January 2011 - 07:35 PM

I have developed a 2D Game Engine that currently represents the scene as a series of Tile Objects, each tile has an associated texture.

At present there is a texture Palette, this is a collection that stores a single copy of each texture, each Tile then has a texture index which indicates which texture from the palette should be drawn.

Now, at present to render the tile the following steps are taken:

The texture index is got from the Tile,
The Texture is then got from the palette using the index
Texture is then drawn.

I have been wondering if, this is the best set up. The above setup has loose coupling and high cohesion and allows me to change how textures are stored in the engine quite easily, only the palette and the rendering engine need updating the game logic classes are unaffected, a Tile does not need to know how the texture is stored it just needs to provide the information needed to draw the correct texture.

What I was thinking of is that this process is long winded and has many execution steps, and instead I was thinking of making the Tile objects extend my texture class, so that the tiles themselves could simply be passed to the rendering engine and drawn. A single copy of each texture would still exist in the palette as before but instead of holding a texture index each tile would instead directly reference the texture in the palette.

This setup offers tighter coupling though and less cohesion and would mean if I wanted to change the way in which the texture data is stored, I would have to change all the classes as noted before, as well as the Tile class.

So I am left with the decision, possibly increase efficiency by reducing the execution steps, but increasing coupling and making the code harder to change or keep the current system.

It is worth noting that the current system has not brought forward any problems with speed or frame rate, but I have not tested the engine on lower spec machines. Also the main reason for the current system was to try and keep the game logic and the rendering engine separate as much as possible.

What is everyones' advice or opinion on this matter? Stick with what I have or change it around?