101Asteroids: Update 1.1

April 9th, 2012 by bryan

101Asteroids rain

101Asteroids is now featuring weather effects!

Each time you start it theres an 25% chance that it rains.

For those who like/dislike like rain you can manually turn it on / off by pressing F1.

Download (Zip-Archive)

New Game: 101Asteroids

April 7th, 2012 by bryan

Heyo, my entry for the Experimental Gameplay Project ‘101things‘ theme.

101Asteroids screenshot

It’s some sort of a 2D arcade game.  2Clouds, 1 Wall, 1 Cannon & 97 Asteroids.

Move with left + right arrow keys | Shoot using space or left mousebutton

Download (Zip-Archive)

For more informations see my portfolio.

How to use OPENFILENAME

August 16th, 2011 by bryan
 
 
OPENFILENAME ofn;
char  szFile[260] = {0};       // buffer for file name
 
// Initialize OPENFILENAME
ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = Hwnd; //This can also be NULL
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = “Text\0*.TXT\0″;
ofn.nFilterIndex = 1;
ofn.lpstrTitle = “Open File”;
ofn.lpstrFileTitle = 0;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = 0;
ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
 
// Display the Open dialog box.
GetOpenFileName(&ofn);

Note that the file path will contain only one Backslash ‘\’ like this:

‘C:\Windows\System32..’ so you probably want to replace those.

I used the Boost Library for this:

std::string temp(szFile);

boost::algorithm::replace_all(temp,”\\”,”/”);

The code above replaces all “\” with “/” so it now looks like this: ‘C:/Windows/System32..’ .

For more informations about OPENFILENAME like all available Flags etc. See The MSDN Documention of it.

If you want to save a file instead of opening it take alook at GetSaveFileName.

 

Basic OpenAL – HGE Implementing

June 18th, 2011 by bryan

I was going to implement OpenAL into HGE a while ago but never really got into it, anyway ended up using another audio library. Smile

Had this piece of code finished I think, should work playing a *.wav file.

Librarys needed: OpenAL32.lib & alut.lib

SoundAL.cpp:

Code:
/*
** Haaf’s Game Engine 1.8
** Copyright (C) 2003-2007, Relish Games
** hge.relishgames.com
**
** Core functions implementation: OpenAL audio routines
*/ 

#include “hge_impl.h”

//OpenAL CoreSDK v.3.05 + Alut 1.1.0
#include “C:\Program Files (x86)\OpenAL 1.1 SDK\include\al.h”
#include “C:\Program Files (x86)\OpenAL 1.1 SDK\include\alc.h”
#include “C:\Program Files (x86)\OpenAL 1.1 SDK\freealut-1.1.0-bin\include\AL\alut.h”

ALCcontext *Context;
ALCdevice  *Device;

ALEFFECT CALL HGE_Impl::AL_Load(const char *filename, DWORD _size)
{
ALsizei size, length, samples;
ALuint Buffer;
ALuint Source;
ALvoid *buffer, *data;

if(bSilent) return 1;

else
{
data=Resource_Load(filename,0);
if(!data) return NULL;
}

// Load wav data into a buffer.
alGenBuffers(1, &Buffer);
if (alGetError() != AL_NO_ERROR) _PostError(“Can’t load sound into buffer | LN37 SoundAL”);

// Variables to load into.

ALenum format;
ALsizei freq;
ALboolean loop;

alutLoadWAVFile((ALbyte *)data, &format, &data, &size, &freq, &loop);
alBufferData(Buffer, format, data, size, freq);
alutUnloadWAV(format, data, size, freq);
// Bind buffer with a source.
alGenSources(1, &Source);

alSourcei (Source, AL_BUFFER,   Buffer);

if(!size) Resource_Free(data);
return Source;
}

void HGE_Impl::AL_Initalize()
{
// Initialization
Device = alcOpenDevice(0); // select the “preferred device”
if(Device)
{
Context=alcCreateContext(Device,0);
alcMakeContextCurrent(Context);
System_Log(“AL: Initalize()”);
}
else _PostError(“AL: Device initalization failed”);
}

void HGE_Impl::AL_Shutdown()
{
// Exit
Context=alcGetCurrentContext();
Device=alcGetContextsDevice(Context);
alcMakeContextCurrent(NULL);
alcDestroyContext(Context);
alcCloseDevice(Device);
System_Log(“AL: Shutdown()”);
}

void HGE_Impl::AL_PlayWAV(ALEFFECT Source)
{

// Position of the source sound.
ALfloat SourcePos[] = { 0.0, 0.0, 0.0 };

// Velocity of the source sound.
ALfloat SourceVel[] = { 0.0, 0.0, 0.0 };

// Position of the listener.
ALfloat ListenerPos[] = { 0.0, 0.0, 0.0 };

// Velocity of the listener.
ALfloat ListenerVel[] = { 0.0, 0.0, 0.0 };

// Orientation of the listener. (first 3 elements are “at”, second 3 are “up”)
ALfloat ListenerOri[] = { 0.0, 0.0, -1.0,  0.0, 1.0, 0.0 };
ALboolean loop;

alSourcef (Source, AL_PITCH,    1.0f     );
alSourcef (Source, AL_GAIN,     1.0f     );
alSourcefv(Source, AL_POSITION, SourcePos);
alSourcefv(Source, AL_VELOCITY, SourceVel);
//    alSourcei (Source, AL_LOOPING,  loop     );
alSourcePlay(Source);
}

hge_impl.h:

Code:
virtual   ALEFFECT    CALL   AL_Load(const char* filename, DWORD size=0);
virtual void      CALL   AL_Initalize();
virtual   void      CALL   AL_Shutdown();
virtual void      CALL   AL_PlayWAV(ALEFFECT Source);

hge.h:

Code:
virtual   ALEFFECT    CALL   AL_Load(const char* filename, DWORD size=0) = 0;
virtual void      CALL   AL_Initalize() = 0;
virtual   void      CALL   AL_Shutdown() = 0;
virtual void      CALL   AL_PlayWAV(ALEFFECT Source) = 0;

Before using it you must call AL_Initalize(), load a file using AL_Load(“/test.wav”) and finally play it with AL_PlayWAV().

Example:

Code:
ALEFFECT Test; 

hge->AL_Initalize();

Test = hge->AL_Load(“test.wav”);

//…
if(hge->Input_KeyDown(HGEK_F3)) hge->AL_PlayWAV(Test);
//…
hge->AL_Shutdown();

This might makes it easier for some people to implement OpenAL into HGE.

Happy Coding :D

The 6 Phases of Teamwork

June 10th, 2011 by bryan

Who doesnt know this, you start a project and like everything that can go wrong, goes wrong. You maybe ask yourself ‘why’?

Well probably because you didn’t use any Concept or your’s just wasnt good.

As I know from several Team Projects is using a good Concept is quite important to get the Work successfully done.

The Concept I’m showing you here is called ‘The 6 Phases of Teamwork’:

Phase 1: Defining the Goal.

  • Create an exact plan of all features that you want in the project.
  • The result is going to be presented to the whole Team.
  • Phase 2: Verify.

  • Every partial aspects are going to be reviewed.
  • Every Team-Member has it’s right to bring in his opinion and to ask questions.
  • This shouldn’t end up in a discussion about the ideas!
  • Phase 3: Suggest Solutions.

  • There are several Methods to Collect Solutions.(For example, Brainstorming.)
  • Phase 4: Choose Solutions.

  • The Team chooses the most fitting Solution/s.
  • Also the list of Tasks is getting sorted here. (What is important? What needs to be done first? What will run Parallel?)
  • Phase 5: Implementing.

  • Implement the choosen Solution/s.
  • Distribute the Tasks.
  • Phase 6: Final Reflection.

  • Note that this should be done after a milestone or at the end of a Project.
  • What Tasks got completed? What is missing? Did we reach the Goal?
  • If necessary repeat Phases.
  •  

    What  kind of Concepts are you using for your Projects?

    FIX: Plugged in, not charging

    December 18th, 2010 by bryan

    Got this today on my new Lenovo Notebook, seems to be a common problem on Notebooks running Windows 7. Hower I found a fix for it so I thought I post it here for others getting the same problem.

    Fix 1:

    1. Shutdown
    2. Remove Battery and AC
    3. Hold Power button for 60 seconds
    4. Insert Battery and AC
    5. Start!

    This one worked fine for me. ;)

    I’ve read that it discharges connectors, but yea unsure about that can anyone confirm this?

    Fix 2:

    1. Remove Battery (while running, use AC)
    2. Go to Computer->System Properties->Device Manager click on Batteries-> Microsoft ACPI-Compliant Control Method Battery and Unistall it
    3. Wait a minute and insert Battery
    4. While still having Device Manager open click on “Scan for hardware changes”

    That’s it I hope one of those works for you too, enjoy your charge-able battery. :D

    Half-life: 2 Mod Tutorial #1: Set Color of windows

    December 12th, 2010 by bryan

    Reup, have fun! :D

    Requirements:

    1. Hl2 mod
    2. Text editor (WordPad also works)
    3. SourceScheme.res (Don’t got it? Click here to Download it!)

    Open up your SourceScheme.res ( <your-mod>\resource\ ) and go to Line 18

    // base colors

    After it add this:

    "winbg"               "255 0 0 190" // Main color of the Window/Frame
    "winbgtransparent"    "255 0 0 150" // Off focus color, screw transparency down for a good result

    Don’t forget to replace the codes with the colors you want!
    Color tables can be found here.

    If you done it right your Color class should look like this now:

    Colors
    {
    	// base colors
    	"winbg"                         "255 0 0 190"
    	"winbgtransparent"              "255 0 0 150"
    	"White"				"255 255 255 255"
    	"OffWhite"			"216 216 216 255"
    	"DullWhite"			"142 142 142 255"
    	"Orange"			"255 155 0 255"
    	"TransparentBlack"		"0 0 0 128"
    	"Black"				"0 0 0 255"
    
    	"Blank"				"0 0 0 0"
    }

    After you done that scroll down to Line 65 where you should see that:

    Frame.BgColor				"160 160 160 128"
    Frame.OutOfFocusBgColor			"160 160 160 32"

    Replace it with:

    Frame.BgColor				"winbg"
    Frame.OutOfFocusBgColor			"winbgtransparent"

    Save it and place it in your \resource\ folder.

    That’s it your done! ;)

    Result:
    Result

    Play some around with the codes to get a good result

    Result 1-2

    To remember, the standard one:

    Tutorial1_standart

    Finished Tutorial File:

    Download

     Read the rest of this entry »

    Online.. again!

    December 11th, 2010 by bryan

    After a long(long, long…) time my blog is finally online again. I was pretty busy with work, family and such stuff. I’ve got an apprenticeship now as ‘System Technician’.

    Well you might as yourself what will follow on this blog now?
    The answer is I don’t know either to be honest. ;)
    Going into programming at the moment (C++) especially Game Programming on Windows. I guess thats what this blog will be about and some other weird stuff :D

    Oh.. also I probably won’t post much in here for the next weeks/months.