Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Rhob

Member Since 14 Oct 2003
Offline Last Active Aug 24 2012 05:10 AM

Topics I've Started

[SlimDX] SEHException thrown from call to Device.CreateWithSwapChain()

23 August 2012 - 03:37 PM

I just started looking into SlimDX and was trying to run tutorials 2 and 3 on my home computer, but I ran into a snag on the line where Device.CreateWithSwapChain() is called. Apparently an SEHException is thrown on that line. The error code is -2147467259, which apparently means an undetermined error has occurred. This issue comes up with both DeviceCreationFlags.None and DeviceCreationFlags.Debug, which suggests that downloading the DirectX SDK won't solve the problem (but I could be wrong). For reference, my computer is running 32-bit Windows XP Professional. The processor is an Intel E5400 with integrated graphics (i.e. I don't have a separate graphics card).

[C++] Deleting struct doesn't work?

30 April 2010 - 04:58 AM

I'm probably missing something obvious here. Can anyone tell me what it is? Thanks.
#include <iostream>
#include <vector>

using namespace std;

struct Test
{
    int a;
    float b;
    char* c;
};

int main()
{
    vector<Test*> first;
    vector<Test*> second;

    for(unsigned int i = 0; i < 2; i++)
    {
        Test* pTest = new Test;

        pTest->a = i;
        pTest->b = 2.0;
        pTest->c = "Hello world!";

        first.push_back(pTest);
        second.push_back(pTest);
    }

    for(vector<Test*>::iterator it = first.begin(); it != first.end();)
    {
        Test* pTest = *it;

        if(pTest->a == 1)
        {
            if(second[1] == pTest)
            {
                cout << "Pointers are equal!" << endl;
            }
            else
            {
                cout << "Pointers are NOT equal!" << endl;
            }

            it = first.erase(it);
            delete pTest;

            cout << "Pointer value: " << pTest << endl;

            // Program should crash here, but doesn't?
            cout << "Test.c value: " << pTest->c << endl;
        }
        else
        {
            it++;
        }
    }

    cout << first.size() << endl;
    cout << second.size() << endl;

    return 0;
}




2D Shooter: Firing Control

09 March 2010 - 05:27 AM

So lately I've been working on a 2D tank shooter game. I've gotten a tile map fully implemented, including restricting collision detection to only a tank's current tile and its eight neighboring tiles. Additionally, each tank has a pointer to a "control function", which allows it to be controlled either from human input or "AI" algorithms. Right now I'm somewhat concerned about firing control. This is more of a code-organizational problem than anything else. What I mean is, in the even that a tank is ready to fire (however that's defined in the code), the firing should not happen until after its position has been updated and passed through collision detection. That way, the position of the projectile will be "correct" with respect to the tank's position. However, if I want to keep a single control-function pointer for each tank, that would mean putting the collision detection inside the functions that can be used as control functions. I suppose this wouldn't be so bad if I put the collision detection inside its own function, which is called from each control function. But I don't expect the collision detection to change between human- and computer-controlled tanks. "Semantically speaking", then, it would seem that the collision-detection function doesn't belong in the control code. The alternative, though, would seem to be having two separate control functions, one for movement and the other for firing. What are your thoughts on this, fellow game developers? Is there anything that I'm missing with the above? Am I making a mountain out of a molehill? Thanks in advance for your input! [Edited by - RobAU78 on March 9, 2010 2:30:12 PM]

[web] Overriding Constructors in ActionScript 3

04 March 2010 - 03:53 PM

So I've decided to delve into web-driven game development on the side, using ActionScript 3 (specifically the Flex SDK). This tutorial talks about overriding constructors in AS3 classes. However, I'm a bit confused by what effect this actually has. According to this, the default behavior for a subclass's constructor function is to automatically call its superclass's constructor first. So my guess is that, if you override the constructor, that default behavior doesn't happen. Does anyone know whether I'm right? Thanks!

Tank Game: Movement Question

11 February 2010 - 02:24 AM

So I've been experimenting with programming a game in pure C/Win32. At first I wasn't sure what kind of game to make, but I've since decided to make a top-down tank game. Right now I'm at the stage where I'm ready to implement a basic sort of tile map, which will require a distinction between world coordinates and screen coordinates. This leads to my question. I'm not sure which way would be better to handle the movement of the player's tank: always keep it centered on the screen (i.e. in the window), or simply keep it viewable on the screen. If I go with the former, I'll scroll the map whenever the player moves; with the latter, I'll only need to scroll it when the player would go "invisible" otherwise. A potential drawback with the latter approach is that the player could get killed at the edge of the map's "viewport" by something he can't see. What do the rest of you think? How do existing tank games handle this?

PARTNERS