Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 08 Mar 2004
Offline Last Active Today, 10:40 AM

#5302504 2D Plain/layer Shift Game Play Mechanics

Posted by McGrane on 25 July 2016 - 11:03 AM



This just looks like there are two tilemaps at play, so using one for a forground, and one for a background.





player_position_forgroundX = player_postionX / 20;

player_position_backgroundX = player_postionX / 40;


player_position_forgroundY = player_postionY / 10;

player_position_backgroundY = player_postionY / 20;


and when the witch occurs you are just using a smaller image / scaled image, and display it on the toggled map.


This is an overly basic explanation, as im just finished work now and about to run out the door :)

#5182887 if Z plane exist , why should i make a Prespective Projection

Posted by McGrane on 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.

#5170837 Snake code review request

Posted by McGrane on 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:


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 :)

#5159144 Beginning GLSL - Quick Question

Posted by McGrane on 08 June 2014 - 02:57 PM

All right, I understand enough now, and have taken up enough time ;) I had assumed to send them to the GPU was the way to go for speed, and had avoided doing any calculations on the CPU, I see now that it should not be solely done by either. And that most my problems are stemming from assumptions :P


I have enough information now, and have a working example, that I can now further my reading into everything matrix related, and modern opengl related. Its just demotivating if you cant get something simple to go correctly


Thanks for the help, its greatly appreciated



#5158541 Beginning GLSL - Quick Question

Posted by McGrane on 05 June 2014 - 03:39 PM



I have begun delving into the latest OpenGL, and am hoping someone can just answer some basic questions for me. 

I'm currently working on a 2d game, I have set up my shaders, and all is well. I have my map loading and rendering correctly to the screen, and even have the view matrix set up to scroll the map. All is good :)


My map is currently loaded from a basic text file, the coords and colours are calculated, and are stored in a 1D array contiguously. What I now want to do is add a basic character, this is where I got confused. I add the the tile for this character - But am unsure of how I should go about moving him independently to the rest of the map. Should I just update the positions on the array, and then send the whole array to be drawn again? - Or do I set up a second shader program, and run them independently ? Or maybe is there a way to just update certain index of the array loaded in the GPU?


I use uniforms to update the matrices and such in the shaders, but really don't know how id update just one tile out of 4000/whatever.


I have not added any code, as I dont think its really relevant - but easily can if needed.


Im sure there is any easy answer for this, im just hoping someone can point me in the right direction - to save me wondering around google aimlessly :)


Thanks for your time!


#5124429 OpenGL Camera following object

Posted by McGrane on 17 January 2014 - 10:56 AM


I'm not sure exactly how your lx and lz are being changed, but if you want to rotate a point, and know where it actually is, you should do so using a rotation matrix. You should have a point as what you are looking at, and then rotate it around your character - as far as i can tell, you are just rotating the world around using glRotatef. Another advantage to rotating a point is that you can then easily change the direction of your character to walk towards it, while glRotate will not necessarily allow you to do this.

Have a look here for an explanation of rotation matrix http://en.wikipedia.org/wiki/Rotation_matrix or just Google them.

Note: The thing that caught me the first few times with opengl is that when using the math lib for cos an sin - that it uses radian's .. not degrees ! Keep this in mind 

#5118156 Good OOP book

Posted by McGrane on 19 December 2013 - 10:37 AM

I read 'Object Orientated Programming in C++' Some years ago, and found it quite helpful at the time.


Admittedly i haven't looked at it in awhile and don't remember much of it now, but still have it and might have a look over later :)  

#5118147 How to make this work?

Posted by McGrane on 19 December 2013 - 10:20 AM


Have you done any form of programming in the past? - I only ask because you seem to be trying to do a lot as a first project.

Anyway, for a browser based 3d game, you should probably start with learning HTML5/CSS JavaScript 

W3Schools Online Web Tutorials and WebGL http://en.wikipedia.org/wiki/WebGL. If you wish to make a game for

something like facebook, you will want to look up their API and maybe something like python ? - Not sure what is actually used for it.

These are only some general pointers in directions to take. If you are total beginners - i think that HTML programming is a good place to start, just to grasp the basics - and maybe start off on a smaller project smile.png

Dont make a game to learn to program, learn to program to make a game ;)

#5116210 Action Script 3.0 game

Posted by McGrane on 11 December 2013 - 09:05 AM

Hi Jenna

Do you have any experience in ActionScript and/or coding ?

Are you asking how to program - ie the logic behind it, or you know how to program in Actionscript and are looking for advice ?

#5112502 2D Java game-deleting NPC's from an array

Posted by McGrane on 27 November 2013 - 12:07 PM

When you say list( array ) - do you mean a list or an array?


If you are using lists - you should probably read up on them a bit, they are simple to understand and will only take a 10 minute read.

It would be a case of something like  'currentNPC.remove()' or something similar ( I dont use Java )

Check out - http://docs.oracle.com/javase/7/docs/api/java/util/List.html


If its an array, and you are doing something like NPC[10] and iterating through them, just move your dead enemy to the last array position, move all the rest up - and reduce the count in the update to something similar to 

int NPC_AMMOUNT = 10;


Enemy Dies - Reorder array



for( int i = 0; i < NPC_AMMOUNT; i++ ) {
    ... do rendering

Maybe if your new to programming, you should try out the beginners boards :)

#5061632 Super slow compiling?

Posted by McGrane on 13 May 2013 - 05:38 PM

Have you kept an eye on the ram and cpu as your programs are running? is it possible you have a memory leak eating all of your memory up ? Bar that it could be anything, virus, hardware change, just do the usual scans and such ! - a favorite of mine is ccleaner ;)

#4942338 Isometric (2.5D) Voxel Engine (Destructible Terrain & Platform)

Posted by McGrane on 22 May 2012 - 02:51 PM

I would also like too see this tutorial, and im sure there are many more, but if you dont want too its very understanable It would probably be a lot of work.

#4939310 Linked List Problems

Posted by McGrane on 11 May 2012 - 08:53 AM

I dont feel that i wasted anytime, the debug literally took 10 seconds, and by posting to the boards i learned something that would have took me alot longer to figure out myself if ever. All i consider here for lazy programming is not checking for empty list when dropping a node, but as i just said i only left them out because at the minute this will never be the case, it is only used to remove one unused element added by a for loop. I was making this more as a proof of concept for myself, and something to learn from, your comment however does not add to this topic, clear up anything, nor in anyway is help-full, it to me just seems you've wasted your time writting a message to say stop being lazy. This is an obvious suggestion.
Thanks anyway