Mar
28
2008
0

Website Design

Despite being nearly four to six years since I did any website designed, I’m still surprised how quickly I adapt to new or changing languages.

My knowledge of PHP and MySQL seems to exponentially increasing with the more I do, and just by glancing at my housemates source code for the professional website he is developing for someone, I pick up so much more.

These two week Easter break have been a much wanted break from programming, learning someone new is quite fun, though would I ever want to get into the web design business again? hell no, I find making applications so much easier to make secure with techniques such as memory mirroring and xor’ing important variables.

But still, it is a nice escape, and good to work on my portfolio website.

Written by Kaluriel in: General | Tags: ,
Mar
27
2008
0

Legend of Bob: Snow

agt_9I decided to change the grass texture to a snow texture, and make the town a snowy scene. However it didn’t look right. So I decided to add a snow particle effect.

The snowflakes are additive and alpha blended, and so give a glow, and stop at ground level, this is ruining slightly with the river since it is just slightly less than ground level.

agt_13Also the fact that a vertex shader is being for the water to make it look like it is moving, the snow shouldn’t settle on it, but it does.

Unfortunately that is not much I can do about it, at some point I may go through and setup multiple emitters that bypass the areas that the snow has a problem with, or adjust it so that it stops at a different ground level.

Written by Kaluriel in: Legend of Bob | Tags: , ,
Mar
24
2008
0

Constructors, Avatars and Codecs

Redesigned the avatar which my friend Joey made for me a few years back. Cleaned up the edged, and changed the font.

While editing some videos last night, that I made of World of Warcraft last year (a 3-man Onyxia fight), I got thinking about designing a development codec. Since the files I recorded were at a stupidly high resolution of 1680×1050 at 30fps (about 30GB each), it was taking forever to do anything with them.

So I thought, how about a codec with the high quality bitstream data, but with a low quality editing stream to go with it. Big emphasis on random access and bidirectional seeking would be key to this my friend Gavin pointed out to me on IRC. Then when you’ve done editing using the low quality stream, it can be applied to the high quality when converting.

Would be nice if the C++ standard included constructors like PHP5 is introducing ( __construct() ), so whenever you change a class name, you don’t have to renamed the constructor(s) and destructor.

Written by Kaluriel in: General | Tags: , , ,
Mar
22
2008
0

New Website Design

Implemented a new website design thanks to my housemate Brian who is great at implementing CSS and strict HTML.

Starting to get the functionality up and running so I don’t have to do everything through the database manager.

Written by Kaluriel in: General | Tags: ,
Mar
22
2008
0

Legend of Bob: Playing Sound with FMOD

FMOD LogoA few month ago I gave up on the idea on using OpenAL for playing sound effect since trying to get MP3s to play with it was getting annoying. A friend recommended whilst in the Student Union to use FMOD, so I switched over and found it did everything I needed, plus there was plenty of documentation and examples.

So here is some basic code for getting audio playing using FMOD, as well as a few additional functions. I’ve only allocated blocks for playing 10 sounds (if more than 10 sounds are attempted to be loaded, LoadSoundByFile() returns -1).

Here is the header for my sound manager.

#ifndef SOUNDMANAGER_H_INCLUDED
#define SOUNDMANAGER_H_INCLUDED

// --- [ libraries ] ------------------------------------------
#pragma comment(lib, "fmodex_vc.lib")

// --- [ includes ] -------------------------------------------
#include <fmod.hpp>

// --- [ definitions ] ----------------------------------------
#define SOUND_LOOP_INFINITE -1
#define MAX_NUM_SOUNDS 10

// --- [ class ] ----------------------------------------------
class SoundManager
{
// Attributes
private
FMOD::System * m_pSystem;
FMOD::Sound * m_pSound[MAX_NUM_SOUNDS];

// Functions
public:
// Constructor
SoundManager();

// Destructor
~SoundManager();

// Load Sound from File
int LoadSoundFromFile( const char * inFilename );

// Free Sound
void FreeSound( const int inSoundId );

// Play Sound
void PlaySound( const int inSoundId );

// Set Position
void SetSoundPosition( const int inSoundId, const int inPositionInMilliseconds );

// Set Loop Count
void SetSoundLoopCount( const int inSoundId, const int inCount );

// Set Loop Points
void SetSoundLoopPoints( const int inSoundId, const int inStartInMilliseconds, const int inEndInMilliseconds );
};

#endif

For background music, I’ve also included code so that the sound can be looped forever, and since not all sounds will be looping from the beginning, I’ve added a function to set where the loop repeats from and begins again. When a sound is not being used anymore, FreeSound() should be called for the id returned by LoadSoundFromFile().

And finally the source file for my sound manager.

// --- [ includes ] -------------------------------------------
#include "SoundManager.h"

// --- [ constructor / destructor ] ---------------------------
SoundManager::SoundManager()
{
for( unsigned int i = 0; i < MAX_NUM_EFFECTS; ++i )
{
m_pSound[i] = 0;
}

// Create FMOD SoundSystem
FMOD::System_Create( &m_pSystem );

// Check FMOD Version
unsigned int fmodVersion;
m_pSystem->getVersion( &fmodVersion );
assert( fmodVersion >= FMOD_VERSION )

// Initialize FMOD SoundSystem
m_pSystem->init(32, FMOD_INIT_NORMAL, 0);
}

SoundManager::~SoundManager()
{
// Free FMOD Sounds
for( unsigned int i = 0; i < MAX_NUM_SOUNDS; ++i )
{
if( m_pSound[i] )
{
m_pSound[i]->release();
}
}

// Free FMOD SoundSystem
if( m_pSystem )
{
m_pSystem->close();
m_pSystem->release();
m_pSystem = 0;
}
}

// --- [ functions ] ------------------------------------------
int SoundManager::LoadSoundFromFile( const char * inFilename )
{
for( int i = 0; i < MAX_NUM_SOUNDS; ++i )
{
if( !m_pSound[i] )
{
m_pSystem->createSound( inFilename, FMOD_SOFTWARE, 0, &m_pSound[i] );
return i;
}
}

return -1;
}

void SoundManager::FreeSound( const int inSoundId )
{
assert( inSoundId >= 0 && inSoundId < MAX_NUM_SOUNDS );

if( m_pSound[inSoundId] )
{
m_pSound[inSoundId]->release();
m_pSound[inSoundId] = 0;
}
}

void SoundManager::PlaySound( const int inSoundId )
{
assert( inSoundId >= 0 && inSoundId < MAX_NUM_SOUNDS );

if( m_pSound[inSoundId] )
{
FMOD::Channel * channel;
m_pSystem->playSound( FMOD_CHANNEL_FREE, m_pSound[inSoundId], false, &channel );
}
}

void SetSoundPosition( const int inSoundId, const int inPositionInMilliseconds )
{
assert( inSoundId >= 0 && inSoundId < MAX_NUM_SOUNDS );

if( m_pSound[inSoundId] )
{
m_pSound[inSoundId]->setPosition( inPositionInMilliseconds, FMOD_TIMEUNIT_MS );
}
}

void SoundManager::SetSoundLoopCount( const int inSoundId, const int inCount )
{
assert( inSoundId >= 0 && inSoundId < MAX_NUM_SOUNDS );

if( m_pSound[inSoundId] )
{
m_pSound[inSoundId]->setLoopCount( inCount );
}
}

void SoundManager::SetSoundLoopPoints( const int inSoundId, const int inStartInMilliseconds, const int inEndInMilliseconds )
{
assert( inSoundId >= 0 && inSoundId < MAX_NUM_SOUNDS );

if( m_pSound[inSoundId] )
{
m_pSound[inSoundId]->setLoopPoints( inStartInMilliseconds, FMOD_TIMEUNIT_MS, inEndInMilliseconds, FMOD_TIMEUNIT_MS );
}
}

All timing in my code is in milliseconds, but it can be changed to another supported FMOD time unit.

Written by Kaluriel in: Code, Legend of Bob, Tutorials | Tags: , , ,
Mar
19
2008
0

The Most Evil Code Ever

I have just created quite possibly the most evil code to mankind, its an abomination. However it did double my FPS.

Basically, I thought to myself “a class is basically just a structure, and its functions are basically the same function but with a pointer to the class at the beginning, so why can’t I just have a pointer to a function within the class, and the class pointer and combine the to for function callbacks, but on a generic level, only have the base class structure known”. And so thats what I set out to do, to test if it would work.

Now instead of calling an OnEvent function that is pure virtual in the base class, I can call the functions directly, skipping the middleman. It compiles on g++ and visual studio 9.

//
//
#include 

//
//
class IBase
{
 public:
 IBase()
 {
 }

 virtual ~IBase()
 {
 }

 int testno( const int j )
 {
 return 3;
 }
};

//
//
class clsDerived : public IBase
{
 public:
 clsDerived()
 :
 IBase()
 {
 }

 int test( const int i )
 {
 return i;
 }
};

//
//
class clsMyDerive : public IBase
{
 public:
 clsMyDerive()
 :
 IBase()
 {
 }

 virtual ~clsMyDerive()
 {
 }

 virtual int tested( const int i )
 {
 return -i;
 }
};

//
//
class clsMyD : public clsMyDerive
{
 public:
 clsMyD()
 :
 clsMyDerive()
 {
 }

 int testy( const int i )
 {
 return ~i;
 }

 int tested( const int i )
 {
 return -1 + 1;
 }
};

//
//
typedef int (IBase::*_FN_CLSGAME)( const int );

//
//
int main()
{
 IBase * test = new clsDerived();
 IBase * test2 = new clsMyDerive();
 IBase * test3 = new clsMyD();
 _FN_CLSGAME q;

 q = reinterpret_cast<_FN_CLSGAME>( &clsDerived::test );
 std::cout << "Test 1: %d" << (test->*q)(12) << std::endl;

 q = reinterpret_cast<_FN_CLSGAME>( &clsMyDerive::tested );
 std::cout << "Test 2: %d" << (test2->*q)(12) << std::endl;

 q = reinterpret_cast<_FN_CLSGAME>( &clsMyDerive::tested );
 std::cout << "Test 3: %d" << (test3->*q)(12) << std::endl;

 return 0;
}
Written by Kaluriel in: Code | Tags: ,
Mar
16
2008
0

Legend of Bob: Trees, Fog and Smoke

agt_8Finally after a lot of effort, I got the tree model I had down to 40,000 faces, making it almost acceptable to put into the Totus Village Map in my AGT project. It still got that great, the game lags a lot around the camera is facing that direction, probably because it is being cel shaded.

agt_11I’ve also added a smoke particle effect, though I’m currently “borrowing” the smoke from Wind Waker.

At some point I’ll be creating a campfire model to place below the smoke, and a small particle effect for fire. One thing I’d like to add to the map eventually would be some street lamps.

agt_12One thing last thing I’m happy about getting into the game is fog, though it wasn’t needed it showed me how to do something I’ve been trying to figure out.

I was playing around with the values and different fog equations when I got distant objects to flatten to silhouettes like the landscape does in World of Warcraft.

Written by Kaluriel in: Legend of Bob | Tags: , ,
Mar
07
2008
0

Legend of Bob: GUI

agt_51After playing around a bit with Ogre3D, I decided making a 2D quad and rendering a GUI just wasn’t happening when I tried doing it manually, so I’ve decided to use the built in GUI, despite its limitations.

Before setting up a “.overlay” file for the GUI, I decided to manually enter the information into Ogre3D, and despite the texture coordinates being messed up, everything was fine.

agt_61Using C.E.G.U.I (Crazy Eddie’s Graphical User Interface), I setup an overlay file for the message box that would be displayed when talking to NPCs.

I brought in the edges slightly after a recommendation from one of my housemates, and then move the faceset image up slightly.

Written by Kaluriel in: Legend of Bob | Tags: , ,
Mar
03
2008
0

Guest Lecture: Thomas Hulvershorn from IPlay

Another guest lecture in Business of Computer Games today at the university.

So, apparently mobile game development is one of the fastest growing areas of the game industry, which quite frankley isn’t that impressive, it just means its starting up, other areas of the game industry won’t be growing that much when they’ve had 10-20 years to establish themselves.

I-Play is one of the companies out there developing for the mobile phone, using the “shotgun” technique (this meaning them release several games in the short space of time), which according to the lecturer, Thomas, 30 in the last two years.

The first part of the lecture was about developing for the mobile phone, something which interested me being a developer myself. When a game is decided to developed, the programmers are given a list of handsets that it must work on, and get to work on it. Whether or not they use the same source and just use precompiler states for different platforms wasn’t mentioned  though.

Thomas also pointed out the differences in mobile phone development, like the restrictions of memory, keypad size, screen size, etc, and how on some phones, music is limited to midi output, and all this must be taken into consideration. As well as what to do if there is a phone call, or the battery is getting low.

One thing I noticed when it came to the porting of games to different phones was that the same game was the same price even when it had worse graphics, which I suppose when I gets down to the cost of $5, I could let it fly as long as if I upgrade my phonem I have access to the other phone version as well.

The second part of the lecture was about the Quality Assurance (QA), Thomas’ specialist field, revealing to us some of the terms they use such as ‘black box’, which means testing a game to make sure if it says it has something, it is there. Or ‘white box’, the complete opposite, which is about checking the code rather than the functionality.

After the lecture I was kind of left with a sense of emptiness, when we were told to bring our mobile phones in I expected we might get a free game to try from them, or possible some kind of fun exercise to find a bug, or even maybe a sign up sheet for QA, but it seemed more like free market research.

However the lecture wasn’t a complete loss, there was a lot of information into the workings of the testing environment for mobile phones.

The main question now is whether or not we’ll get someone to talk to us about starting your own game company. I’ve heard rumors about there was supposed to be someone but they didn’t turn up, which would be nice.

It would also be nice to maybe get someone from Blizzard to talk about being a GM for their MMORPG World of Warcraft or game development for them.

Written by Kaluriel in: University | Tags: , , ,

Theme: TheBuckmaker.com Blog Themes | The best Webhosting Plans, Eigenes Internet Radio