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.


chbrules

Member Since 28 Aug 2004
Offline Last Active Nov 04 2012 06:44 AM

Topics I've Started

Program Design Theory - Managing How To Draw To Screen

30 October 2012 - 02:09 AM

So I'm writing a little 2D game for fun in C++ with the SFML API. You don't need to know about it anymore than this fact: to draw a sprite to the screen you have to pass it to the draw member method of the base window class you create. I just called it "App." So basically you go "App.draw(sprite);".

My problem comes to the design of the whole shabang. What I've ended up doing is simply passing a reference to "App" in the constructor of all the drawable objects. Every drawable/animated object has a draw member method (inherited from base class), so I just let it handle all the drawing itself in one convenient function I iterate through in a manager class using a pointer array of the base class.

Maybe I'm just crazy, but I feel this is rather sloppy. Does anyone have any input on this? Am I being an idiot doing it this way? Thanks! Posted Image

Engine design questions

26 July 2010 - 11:59 PM

I'm starting to develop a little 2D overhead tile-based game engine. I'm trying to design the engine layout beforehand so I don't just jump in and go in over my head here.

In my design, I want to have a cPlayer class that handles all the player's movements, animation, stats, and rendering. Likewise, I want a cMap class that will handle the loading, world shifting with respect to player position, tile image loading, and rendering.

My issue being, is this the best way to go about designing something like this? Should I have my classes render their own part of the engine where need be? If so, what are the best ways to share something like player position, entity positions, and the like with cMap?

An issue with the design I see is messily having to reference to all the other classes to share data betwixt them. I'm not sure if that's bad design, or just how it's supposed to be. I'm a bit OCD about efficiency and cleanliness :3

Thanks!

[web] JS: Access class member using 'this' inside an anon function call in a class method

28 March 2010 - 08:44 AM

I'm using jquery to make it easy for AJAX calls. So I create a class: function cMap(mapID){//vars and stuff} I go and prototype a function: cMap.prototype.loadMap = function(){ //jquery AJAX call } Now in the jquery $.ajax({...}); call, I use an anonymous function on the "success:" call: success: function(data){ this.member = data; } My problem is that inside this anonymous function call I'm trying to call a class member of my cMap class to store the data in from the AJAX call, but it's out of scope. So the JS console in FF/Chrome throws errors about bad value/doesn't exist. How can I access this class member from inside an anonymous function? Or at least what's a good way to go about doing all this? Thanks in advance! :D

Basic Collission Detection (2D tile-based world)

31 March 2009 - 10:29 PM

My game is a 2D tile-based RPG world, with tiles being 32x32 px. I want to create a simple collission detection system for entities in the world. A player can only be on a single tile at a time. They will walk from tile to tile automatically when the user moves the character (Like the Pokemon games). This, hopefully, will make my collission detection scheme a lot easier since it's already a grid. However, after reading different approaches to the theory I've come to find that optimizing the alogrithm to only compare objects in the area of the player isn't as easy as it seems. I was wondering what the best method for me to scan a list (array) of entities (like monsters and other characters) for their visibility on the user's screen first, then only checking collissions and running their AI/operations if they're on the screen. I'm kind of trying to kill two birds with one stone; save CPU resources by detecting what's visible to the user on the screen and only running their operations. Thanks!

Need a Professional's Explanation of OGL's Core Usage

29 June 2007 - 08:57 PM

Is the core API of OpenGL 3D only? I mean that in comparison with 2D graphical rendering. Does OpenGL only have support for 3D rendering, although it can emulate a 2D environment, such as SDL using a polygonal face as a 2D raster-based display, or that you could simply move polygons on 2 axis and not use depth. Thank you.

PARTNERS