Jump to content

  • Log In with Google      Sign In   
  • Create Account

McGrane

Member Since 08 Mar 2004
Offline Last Active Dec 17 2014 06:16 AM

Posts I've Made

In Topic: Understanding Perspective Devide

21 October 2014 - 10:33 AM

Thanks Diego,

 

That's quite easy to follow, and makes sense. And from your mention of known property, I know have something to research for helping me with the rest of the article. And as an added bonus, I have received a call to say my book has arrived 3 weeks early.. Good day all around :D

 

Thanks again !


In Topic: if Z plane exist , why should i make a Prespective Projection

25 September 2014 - 08:00 AM

Perspective Projection is used to give the effect of things further away becoming smaller.

Although the z coordinate may indicate the depth in the screen, it will not transform these points to give you a realistic perspective of the scene.

 

 

For further information have a look at this chapter :

 

http://www.arcsynthesis.org/gltut/Positioning/Tut04%20Perspective%20Projection.html and or just read the whole thing smile.png It explains modern opengl very well.


In Topic: Snake code review request

01 August 2014 - 04:09 AM

Currently your game's level is four walls bound by the windows size. If instead you create a class that can read information from a text file, and convert it into a map. You will then be able to edit / create new maps for your game, without the need the recompile your code. This means you can expand your game quickly, and / or other people may create maps for you.

For example, if you created a text file; map1.txt, and it contained the following:

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 

1, 0, 0, 0, 0, 0, 0, 0, 0, 1,

1, 0, 0, 0, 0, 0, 0, 0, 0, 1,

1, 0, 0, 0, 0, 0, 0, 0, 0, 1,

1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 

1, 1, 1, 1, 1, 1, 1, 1, 1, 1 

Where a '1' would represent a wall. You could then quickly expand this into may variations of levels in different files:

Map2.txt

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 

1, 0, 1, 0, 0, 0, 0, 1, 0, 1,

1, 0, 1, 0, 0, 0, 0, 1, 0, 1,

1, 0, 0, 0, 1, 0, 0, 0, 0, 1,

1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 

1, 1, 1, 1, 1, 1, 1, 1, 1, 1 

 

Now that your level is no longer hard coded, but saved in files as data, you can update and create new maps for your game as needed, or other people playing your game, could make their own levels.

 

This could also be expanded using a config file, containing a list of all maps. To add a new level to the game, all one would have to do then is create a new text file containing a map, and add the text files name to the config file.

 

I think this is a good way to code most projects as it makes you think of how to make your code more reusable, and thus, can be reused in other games :)


In Topic: Looking for source code for a tiled 2d scroller

10 July 2014 - 08:30 AM

Hey Nick

 

Displaying and scrolling a map is relatively easy, and i'm sure you can find someone who may sell you this code.. but i don't think its worth purchasing. If you wish to build a platform game, but are unable to build the map, we may not be at a stage to progress said game, so it may not be any faster to develop - you may just be out of pocket.

 

For a simple example of a tile map, use and array, you use the indices to calculate the postion of each tile, and use the value for your tile type, eg 1: Wall, 0: Grass, 2: Water 

int tileSize = 128;
int map[5][5] = {
1,1,1,1,1,
1,0,0,0,1,
1,0,2,0,1,
1,0,0,0,1,
1,1,1,1,1
}
 
...
 
for( int y = 0; y < 5; y++ ) {
     for( int x = 0; x < 5; x++ ) {
         DrawTile( x * tileSize, y * tileSize, map[y][x] )
    }
}
 
...
 
DrawTile( int postionX, int positionY, int tileID ) {
...
}

In Topic: Image detection

10 July 2014 - 01:40 AM

Hi destluk,

 

Maybe im missing something here, but do you need image detection if you just want to match two images? Could you not just give your images a unique id, and check them off each other? Just from your screen shot, im not sure why you would need something so complex ( but im sure there could be a reason smile.png )

 

[Edit] I now see that anti-macro is a game, and you want to use this in said game - Disregard ;)


PARTNERS