Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Vero

Member Since 20 Jun 2012
Offline Last Active Nov 02 2012 08:44 AM

Topics I've Started

Retrieving the Last error in from the Kernal Mode when in User Mode

01 November 2012 - 09:46 AM

Hi all,

I've been doing a few things with ioctl and in this one case the call is trying to open an event. in this case it alters the handle you pass in as a pointer in the parameter from the kernal side I can see the GetLastError is 2 aka a file not found error but I need this error code to float up to the user space. Any ideas on how to do this?

Polymorphism and pointer arrays in c++

26 July 2012 - 02:15 PM

So, I haven't been able to find a good explanation on this.

I want a dynamic size to my array, basically then I read in the level it tells me how many objects I need so I do the following:

MObject *objects = new MObject[num_of_obj];

after I find out how many I need through the text file I created that's reading in the level, I find out what KIND of MObjects they are so one of them is a SpeedBoost obj (inherits MOBject)

*(object+obj_counter)= SpeedBoost(args...);

for simplicity sake objcounter is 0 for now

MObject has
virtual Draw();

SpeedBoost has
Draw();

when I attempt to run through a list of objects and call:

objects[loop1].Draw();

the SpeedBoost::Draw() is never called
only the MObject::Draw() is called.

I need it to call the implementation of the Draw for the class that it is not the base class draw.

I'm know that implementing a linked list would probably work but that's added complexity for something that an array should hopefully be able to do.

2d animation: best practices?

26 July 2012 - 10:23 AM

So, I've come to the point in my game were I feel I need to come past this hurtle before I move on to more complex features. I'm more or a programmer than an artist but I'm learning a few techniques for pixel/ 8bit style art. (btw what's your recommended program for making art? I'm mostly fiddling with it in MSpaint right now)

anyway here's run down of questions I have.

Whats the best way to creating a sprite in openGL, right now I would simply load a series of textures and when moving as time passes the textures would be rotated over the GL_QUAD to look like walking, Is there a better/ cleaner way to implement this in a 2d environment?

How would I go about creating transparency on parts of the texture? I've tried to implement a few examples of Masking but so far I haven't had any success, would I need to use something other than .bmps for this, e.g. .png

Thanks for any advice you can offer.

Preventing Chaos in your game code

25 July 2012 - 01:00 PM

Hi Everyone, I've been coding a simple game in C++ with OpenGL. I'm pretty new to creating games and though I've had a lot of college experience in coding with C++ and Java and .Net I've never really developed anything professionally on this large a scale. The thing is I'm worried things will become more and more disorganized as I progress in making the game.

So far the game is a maze where you load the maze data from a text file and then you have to navigate to the goal. It will progress from there but I want to go over how I'm implementing it.

the Game Loop:
Level1= new Grid("data/Testlvl.txt",20,70);
max_fps=2; //TODO may need to incorporate a file load or mabye just play game from start to finish
int fcount=0;  //frame counter
long long fps_sum=0LL; //sum of frame rate
long long start=milliseconds_now();
//intialise player speed
Level1->player->Velocity.x=40; //40 pixels per second
Level1->player->Velocity.y=40;
while(!done) //Game LOOOP!
{
  if(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) //is there a message?
  {  //peek will not halt program while it looks for a message
   if(msg.message==WM_QUIT) // have we received a quit message?
   {
	done=TRUE;
   }
   else{ //if not deal with the window messages
	TranslateMessage(&msg); //Translate the Message
	DispatchMessage(&msg); //Dispatch the Message
   }
  }
  else{ // if there are no messages
  
   // Draw the Scene. Watch for ESC Key and Quit Messages From DrawGLScene()
   if((active && !DrawGLScene())|| keys[VK_ESCAPE])
   {
	done=TRUE;  // ESC Signalled a Quit
   }
   else{ //not time to quit, update screen
	//drew scene in the if statement
	while(FPS(start,milliseconds_now())>max_fps)
	{/*wait*/}
	if(fcount < 60)
	{
	 fps_sum=fps_sum+FPS(start,milliseconds_now());
	 ++fcount;
	}
	else
	{
	 fps=fps_sum/fcount;
	 fcount=0;
	 fps_sum=0LL;
	}
	start=milliseconds_now();
	SwapBuffers(hDC); //SwapBuffers (double buffering)
   }
  }
  }  if (!gameover && active)				// If Game Isn't Over And Programs Active Move Objects
  {
   if (keys[VK_RIGHT])
   {
	Level1->MovePlayer(M_RIGHT);
   }
   if (keys[VK_LEFT])
   {
	Level1->MovePlayer(M_LEFT);
   }
   if (keys[VK_DOWN])
   {
	Level1->MovePlayer(M_DOWN);
   }
   if (keys[VK_UP])
   {
	Level1->MovePlayer(M_UP);
   }

   Level1->Step(start);// what happens next?
  }
  //outside of live play:
  if(keys['A'] && !ap)
  {
   ap=TRUE;
   max_fps++;
  }
  if (!keys['A'])					 // If 'A' Key Has Been Released
  {
   ap=FALSE;				   // ap Becomes FALSE
  }
  if(keys['Z'] && !zp && max_fps>2)
  {
   zp=TRUE;
   max_fps--;
  }
  if (!keys['Z'])					 // If 'A' Key Has Been Released
  {
   zp=FALSE;				   // ap Becomes FALSE
  }

  //*********update scene****************
  /// Beat first Level Snippet
  if(Level1->player->isTouching(*Level1->goal))
   levelend=true;
  ///end of snippet
}


So right now inorder to switch scenes in the game loop I set global flags to true and false ( good or bed way to do it) and the DrawGLScene() will check the flags and determine which scene to draw,

After declaring a few setup variables I move everything along via time, I even force a max frame rate so that i can control the FPS. (I did this starting out just because I could and now I'm thinking about turning the FPS into something like a reward system collect items increase the FPS makes for smooth gameplay)

All my classes are contained within the Grid Class, the Grid Class will contain a player and a List of objects (coins enemies and such all will inherit the MObject class which has a bunch of virtual functions so I can iterate through the list and call Step() and Draw() functions. Step basically updates all the objects positions and other such statuses given that point in time. everything goes through Grid so when the user enters any key commands the Grid can determine what information flows to what objects it's managing. I keep most things public right now but I hope to eventually makes the objects private and get implement public functions to keep things from getting confuzzled.

so kind of breaking it down to the flow so far psuedo codeish:
GameLoop:
     DrawScene:
		  [chooses what scene to draw based on flags]
    	  assuming game is running 
          Draw header()
          Grid->Draw()
                    Draws grid 
                    Draws Players
                    Draws Goal
                    todo: draw enemies
                    todo: draw items
     Isgamerunning? 
     Check for input
          Move player, enemies
     Step
          grid.Step()
			   update animated items, players enemies,

          Are game changingg conditions met
               progress game


I'd really appreciate constructive criticism and how to make it better, methods to keep things organized, what your own ways to coding the loop are.

I hope my post makes some sense too

Installing GLEW.h libraries for VS express 2010

08 July 2012 - 08:27 PM

I having some serious issues trying to get the GLEW libraries to compile without linker errors any help would be appreciated.

[code=auto:0]

#include <Windows.h> // Header File For Windows
//#include <GL/GL.h> // Header file for OpenGL32 Library
//#include <GL/GLU.h> // Header File for GLu32 Library
#include <stdio.h>
#include <stdarg.h>
#include "aMaze_Objects.h"
#include <gl\glew.h>
#include <GL/glut.h>
#include "SOIL.h"
[code=auto:0]

here's the error log when i try to compile. I've tried numerious folders to place the bin lib and include files

1>------ Build started: Project: aMaze, Configuration: Debug Win32 ------
1>aMaze_Main.obj : error LNK2019: unresolved external symbol __imp__glewInit referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)
1>aMaze_Objects.obj : error LNK2001: unresolved external symbol __imp____glewBlendFuncSeparate

1>C:\Users\Varonec\Dropbox\Game\aMaze\Debug\aMaze.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I have tried searching the internet and I've read this link up and down:
file:///C:/Users/Varonec/Downloads/glew-1.7.0-win64%281%29/glew-1.7.0/doc/install.html

anyway, I'm not sure where I can go from here

PARTNERS