Jump to content

  • Log In with Google      Sign In   
  • Create Account

bennettbugs

Member Since 03 Jun 2011
Offline Last Active Sep 08 2013 08:21 AM

#5048136 Where to begin on first game

Posted by bennettbugs on 29 March 2013 - 03:46 PM

Except that games like Pong teach you the basic mechanics of making anything. If you start deep into coding a massive game, you will be making mistakes that you would have made with Pong. This means every mistake you made will have to be fixed later, taking up more time since the code will all be dependent on what you base it off of. If you want to start making a game, you should start simple or at least make your code modular so that if you need to fix any major mistakes, it will take less time to fix the rest of the game.

 

In my experience, of course. I dove right into it and always had to rewrite what I wrote before, which took more time than if I started simple.




#4985063 I want to be an indie game developer, where do I start?

Posted by bennettbugs on 29 September 2012 - 08:42 AM

Teenager to teenager, I first started with a dream. A dream of an awesome game. That dream turned into a lot of writing - maybe about 100 pages of stuff about our game. Whilst designing, I picked up on Lua. After some coding of a basic engine, I though "Hey, this is way too slow for our expectations." So I ditched that engine, and went on to learning C++ as my first language. After reading a book in a month or so, I dove right in. I never thought once to start with something simple. For the past 2+ years I have been re-writing and writing new code from the first int main() I wrote.

I wouldn't say go brutal force on it, but definitely have a passion and enough effort. My friend wants to code with me, but lacks both.


#4982180 Games with menus

Posted by bennettbugs on 20 September 2012 - 04:15 PM

What I have for my engine are 2 states: "In Game" and "In Screen". Since it is a 3D game, I separated the game and screen drawing and logic. So if the user goes into the credits, the main menu, the pause menu, etc. it switches states. I also have an interface for "Screens" or "Menus" which helps for general or specific menus.

I even wrote my own external menu loader that can load script files that are human-readable, or compiled for faster loading, and custom compiler.


#4909851 C++ Win32 Using XBox Controller For Input With Windows Messages

Posted by bennettbugs on 05 February 2012 - 10:47 AM

Oh, ok. So i thought the ports the controllers were on were the actual usb ports, but its just the player # of the controller, and so forth. I created a new thread for capturing the controller input because it really bottle-necked the application in the WindowMessage handler. I also created a class for the controller. Here is the code:

XBox.h
class XBOXController
{
    public:
    HANDLE mThread;
    unsigned int ThreadKillState;
    bool InUse;
    POINT LAnol,RAnol;
    unsigned int LTrig,RTrig;
    bool A,B,C,X,Y;
    bool Start,Select;
    void Init();
    void StartChecking();
    void StopChecking();
    void Check();
};
DWORD WINAPI HandleXBOX(void* nID);

Xbox.cpp
extern myApp APP;
void XBOXController::Init()
{
    this->ThreadKillState=0;//started
    this->InUse=false;
    this->LAnol.x=0;this->LAnol.y=0;this->RAnol.x=0;this->RAnol.y=0;
    this->LTrig=0;this->RTrig=0;
    this->A=false;this->B=false;this->X=false;this->Y=false;
    this->Start=false;this->Select=false;
}
void XBOXController::Check()
{
    DWORD isController;//Is it connected?
    _XINPUT_STATE ConState;//all states of controller
    ZeroMemory(&ConState,sizeof(_XINPUT_STATE));
    isController=XInputGetState(0,&ConState);
    if(isController==ERROR_SUCCESS)
    {
	    if(!this->InUse)
	    {
		    this->InUse=true;
		    std::stringstream ConRep;ConRep<<"Switched To Using Xbox Controller";
		    APP.Log.Write(ConRep.str().c_str());
	    }
	    if(ConState.Gamepad.bLeftTrigger!=0)
	    {
		    this->LTrig=ConState.Gamepad.bLeftTrigger;
	    }
	    if(ConState.Gamepad.bRightTrigger!=0)
	    {
		    this->RTrig=ConState.Gamepad.bRightTrigger;
	    }
	    if(ConState.Gamepad.sThumbLX!=this->LAnol.x)
	    {
		    this->LAnol.x=ConState.Gamepad.sThumbLX;
	    }
	    if(ConState.Gamepad.sThumbLY!=this->LAnol.y)
	    {
		    this->LAnol.y=ConState.Gamepad.sThumbLY;
	    }
	    if(ConState.Gamepad.sThumbRX!=this->RAnol.x)
	    {
		    this->RAnol.x=ConState.Gamepad.sThumbRX;
	    }
	    if(ConState.Gamepad.sThumbRY!=this->RAnol.y)
	    {
		    this->RAnol.y=ConState.Gamepad.sThumbRY;
	    }
	    if(ConState.Gamepad.wButtons & XINPUT_GAMEPAD_A){this->A=true;APP.KeyLog.Write("XBox A Pressed");}else{this->A=false;APP.KeyLog.Write("XBox A Released");}
	    if(ConState.Gamepad.wButtons & XINPUT_GAMEPAD_B){this->B=true;APP.KeyLog.Write("XBox B Pressed");}else{this->B=false;APP.KeyLog.Write("XBox B Released");}
	    if(ConState.Gamepad.wButtons & XINPUT_GAMEPAD_X){this->X=true;APP.KeyLog.Write("XBox X Pressed");}else{this->X=false;APP.KeyLog.Write("XBox X Released");}
	    if(ConState.Gamepad.wButtons & XINPUT_GAMEPAD_Y){this->Y=true;APP.KeyLog.Write("XBox Y Pressed");}else{this->Y=false;APP.KeyLog.Write("XBox Y Released");}
    }
    else if(this->InUse)
    {
	    this->InUse=false;
	    std::stringstream ConRep;ConRep<<"NOT Using Xbox Controller";
	    APP.Log.Write(ConRep.str().c_str());
    }
}
void XBOXController::StartChecking()
{
    this->mThread=CreateThread(NULL,0,HandleXBOX,(void*)NULL,0,NULL);
}
void XBOXController::StopChecking()
{
    this->ThreadKillState=1;
    //while(this->ThreadKillState<2)
    //{
    //}
    TerminateThread(this->mThread,0);
}
DWORD WINAPI HandleXBOX(void* nID)
{
    while(APP.XBOX.ThreadKillState==0)
    {
	    APP.XBOX.Check();
    }
    APP.XBOX.ThreadKillState=2;//Done with thread
    while(APP.XBOX.ThreadKillState==1)
    {
	    APP.XBOX.ThreadKillState=2;
    }
    ExitThread(0);
}

Just make sure to call XBox.Init(), then after creating the window call XBox.StartListening(), then when youre done, call XBox.StopListening()

I have the XBox class in a App class... so this is how i handled it. ;)


#4900230 Win32 disable or get around key repeating (only check if up or down once)

Posted by bennettbugs on 05 January 2012 - 10:44 PM

Hm... i think i know what youre saying... so... like this:

bool Key_Flags[1];
bool A_Key=false;
case 'a'://down
Key_Flags[0]=true;
break;
case 'a'://up
Key_Flags[0]=false;
break;
if(Key_Flags[0])
{
A_Key=true;
}

or... DX im getting... sort of... the idea. some sample code might set my logic straight.


#4864437 C++ std::ifstream cant open files that are there

Posted by bennettbugs on 21 September 2011 - 05:07 PM

DX there is no way to simplify it; im asking if anyone who would want to read through all the code and see if i made any mistakes. i honestly dont care if you dont help me because you dont feel like reading all that code.


PARTNERS