Dragon Warrior 1 3D Remake using irrWizard...
area51 -- that's a very good observation! I dont' know why I put that PlaySound() function inside the game loop. I've moved it to the init(). Thanks! The FMOD classes that I made are really rough. It took me a while to get it in the engine. So, I'll stick with FMOD for now. Thanks for the offer to add back Audiere.
Okay, I've just uploaded a video walkthrough of DW 1 3D to rapidshare.
This video is better than uploading the current build of DW 1 3D since it can't screw up/cause problems because of different computer configuration. There's not much to see. Yes, I haven't implemented water yet. So, in the video I walk right over the water.
Anyways, I used Fraps! to capture the initial video then used windows movie maker to shrink it down to "video on lan (1.5 Mbps)" encoding. This compressed the video from 502,987,360 bytes to 8,958,052 bytes!
Several "bugs" where discovered while making this video. The sound dropped out before the video demo ends. Which I need to setup FMOD to loop the sound. Also, the title screen music kept playing even after entering the game. I need to fix that (i.e. switch out the title screen music with brecconary town music).
http://rapidshare.de/files/12050986/DW1 ... d.wmv.html
I hope you like it! Now, back to that font issue.
Okay, I've just uploaded a video walkthrough of DW 1 3D to rapidshare.
This video is better than uploading the current build of DW 1 3D since it can't screw up/cause problems because of different computer configuration. There's not much to see. Yes, I haven't implemented water yet. So, in the video I walk right over the water.
Anyways, I used Fraps! to capture the initial video then used windows movie maker to shrink it down to "video on lan (1.5 Mbps)" encoding. This compressed the video from 502,987,360 bytes to 8,958,052 bytes!
Several "bugs" where discovered while making this video. The sound dropped out before the video demo ends. Which I need to setup FMOD to loop the sound. Also, the title screen music kept playing even after entering the game. I need to fix that (i.e. switch out the title screen music with brecconary town music).
http://rapidshare.de/files/12050986/DW1 ... d.wmv.html
I hope you like it! Now, back to that font issue.
Well, I've shelved the font classes for now and turned back to modeling.
Witness all to the star of the game, Erdrick in all his 3D glory!
Erdrick:
http://i11.photobucket.com/albums/a175/ ... ick_2d.jpg
Erdrick 3D model:
http://i11.photobucket.com/albums/a175/ ... _model.jpg
Gray Soldier with Shield:
http://i11.photobucket.com/albums/a175/ ... shield.jpg
Gray Soldier with Shield 3D model:
http://i11.photobucket.com/albums/a175/ ... _model.jpg
That completes the denizens of brecconary town. I'm off to work on a 3rd person/birds eye view camera.
Here's the current font class (very basic) header:
Here's the font class .cpp file (also, very basic...on the verge of remedial):
Initialized here:
Called here:
Witness all to the star of the game, Erdrick in all his 3D glory!
Erdrick:
http://i11.photobucket.com/albums/a175/ ... ick_2d.jpg
Erdrick 3D model:
http://i11.photobucket.com/albums/a175/ ... _model.jpg
Gray Soldier with Shield:
http://i11.photobucket.com/albums/a175/ ... shield.jpg
Gray Soldier with Shield 3D model:
http://i11.photobucket.com/albums/a175/ ... _model.jpg
That completes the denizens of brecconary town. I'm off to work on a 3rd person/birds eye view camera.
Here's the current font class (very basic) header:
Code: Select all
#pragma once
#include <irrlicht.h>
using namespace irr;
class GameFont
{
private:
gui::IGUIFont* font;
public:
GameFont(IrrlichtDevice*,int);
~GameFont(void);
void DisplayText(const wchar_t *,s32, s32);
};
Code: Select all
#include "GameFont.h"
GameFont::GameFont(IrrlichtDevice* irr_device, int size)
{
if (size == 10)
{
font = irr_device->getGUIEnvironment()->getFont("media/dw1_font_256_normal_10_pts.bmp");
}
else if (size == 12)
{
font = irr_device->getGUIEnvironment()->getFont("media/dw1_font_256_normal_12_pts.bmp");
}
else if (size == 16)
{
font = irr_device->getGUIEnvironment()->getFont("media/dw1_font_256_normal_16_pts.bmp");
}
else if (size == 20)
{
font = irr_device->getGUIEnvironment()->getFont("media/dw1_font_256_normal_20_pts.bmp");
}
}
GameFont::~GameFont(void)
{
}
void
GameFont::DisplayText(const wchar_t * text, s32 leftEdge, s32 topEdge)
{
s32 rightEdge = leftEdge + 1024;
s32 bottomEdge = topEdge + 768;
font->draw(text,
core::rect<s32>(leftEdge,topEdge,rightEdge,bottomEdge),
video::SColor(255,255,255,255));
}
Code: Select all
//! Initialise CreditsState
void CGameCreditsState::Init(CGameManager* pManager)
{
// setup DW font
m_pDW_credits_text = new GameFont(pManager->getDevice(),20);
m_pCreditsImage = pManager->getGUIEnvironment()->addImage(irr::core::rect< irr::s32 >(256,0,1024,768));
m_pCreditsImage->setImage(pManager->getDriver()->getTexture("media/credits.jpg"));
addCredits(pManager);
CGameState::FadeInOut(pManager);
}
Code: Select all
//! Update GUI Elements required for Credits state
void CGameCreditsState::Update(CGameManager * pManager)
{
pManager->getDriver()->beginScene(true, true, video::SColor(0,0,0,0));
pManager->getGUIEnvironment()->drawAll();
scrollCredits(pManager);
m_pDW_credits_text->DisplayText(L"Dragon Warrior 1 3D by jclins",256,5);
pManager->getDriver()->endScene();
}
ErUs - Thanks! In hindsight, I may have swinged the camera too much/too quick in that video. I hope nobody got sick/vertigo while watching it! That is one of my goal of this project is to keep it as faithful to the original as possible. Once I get far enough, I'll add an option to enable enhanced mode. But it's way too early to even think about that.
I've finally found out what was causing my runtime access violation errors. My implemention of FMOD! It would work one day without any errors then this morning, every time I exited back to the title screen, it gives me a runtime access violation error. So, I'm currently working on a solution to this problem. Until then, I've disabled sound.
It's amazing how the complexity of your program increases exponentially after adding a mere class. Well, for me at least.
I've finally found out what was causing my runtime access violation errors. My implemention of FMOD! It would work one day without any errors then this morning, every time I exited back to the title screen, it gives me a runtime access violation error. So, I'm currently working on a solution to this problem. Until then, I've disabled sound.
It's amazing how the complexity of your program increases exponentially after adding a mere class. Well, for me at least.
Yes! I have fixed the sound problem/runtime access violation error.
For those who uses irrWizard, I've moved the pointer to FMOD into CGamerManger class. So now it's more like the other irrlicht calls.
Many things I did wrong the first time incorporating FMOD sound system.
1. I did not properly clean up after using sound resources.
2. I broke the irrWizard hierarchy/scheme by adding it down too low in the inheritance tree.
Anyway, once I fixed the problem, it is now much easier than ever to init/start/clean sound/music.
As a test, I went ahead and added a different music to the credit screen and when in the town (well, you can't really leave town yet). I switched between the credit/title/game screen many times until I was satisfied that I've squashed the bug for good.
Unfortunately, I wasn't able to make FMOD play the music when it's inside a zip file. I made several attempts to make it so, but failed. So for now, the music files reside outside of the media.zip file.
updated .h (added error logging to a file):
updated .cpp (reworked the constructor and init function):
loop:
cleanup (I did not do this the first time around -- bad, bad!):
For those who uses irrWizard, I've moved the pointer to FMOD into CGamerManger class. So now it's more like the other irrlicht calls.
Many things I did wrong the first time incorporating FMOD sound system.
1. I did not properly clean up after using sound resources.
2. I broke the irrWizard hierarchy/scheme by adding it down too low in the inheritance tree.
Anyway, once I fixed the problem, it is now much easier than ever to init/start/clean sound/music.
As a test, I went ahead and added a different music to the credit screen and when in the town (well, you can't really leave town yet). I switched between the credit/title/game screen many times until I was satisfied that I've squashed the bug for good.
Unfortunately, I wasn't able to make FMOD play the music when it's inside a zip file. I made several attempts to make it so, but failed. So for now, the music files reside outside of the media.zip file.
updated .h (added error logging to a file):
Code: Select all
#pragma once
#include <fmod.hpp>
#include <fmod_errors.h>
#include <stdio.h>
#pragma comment(lib, "fmodex_vc.lib")
using namespace FMOD;
class FMODSoundSystem
{
private:
FMOD::System *system;
FMOD::Sound *sound;
FMOD::Channel *channel;
FMOD_RESULT result;
unsigned int version;
char m_cErrorLog[255];
FILE *logError;
public:
FMODSoundSystem(void);
~FMODSoundSystem(void);
void PlaySound(void);
void Init(const char *,FMOD_INITFLAGS);
void Update(void);
void Clear(void);
void ERRCHECK(FMOD_RESULT result);
};
init:
#include "FMODSoundSystem.h"
#include <iostream>
void FMODSoundSystem::ERRCHECK(FMOD_RESULT result)
{
if (result != FMOD_OK)
{
sprintf(m_cErrorLog,
"FMOD error! (%d) %s\n", result, FMOD_ErrorString(result));
fputs(m_cErrorLog,logError);
exit(-1);
}
}
FMODSoundSystem::FMODSoundSystem()
{
channel = 0;
// set the max number of virtual voices -- This is nothing to do with
// how many hardware voices the soundcard may have, or how many
// software mixed voices there may be available.
int maxchannels = 100;
// Setup error log file
logError = fopen("error_log.txt","a");
// Create a system object
result = System_Create(&system);
ERRCHECK(result);
// Determine FMOD version
result = system->getVersion(&version);
ERRCHECK(result);
if (version < FMOD_VERSION)
{
printf("Error! You are using an old version of FMOD %08x. This program requires %08x\n", version, FMOD_VERSION);
}
// Initialize FMOD System
result = system->init(maxchannels, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
}
FMODSoundSystem::~FMODSoundSystem(void)
{
// shut down sound
result = sound->release();
ERRCHECK(result);
}
void
FMODSoundSystem::Init(const char *name_or_data, FMOD_INITFLAGS flags)
{
// Create Sound
result = system->createSound(name_or_data, flags, 0, &sound);
ERRCHECK(result);
// Set Sound Mode
result = sound->setMode(FMOD_LOOP_NORMAL);
ERRCHECK(result);
}
void
FMODSoundSystem::Clear(void)
{
// shut down sound
result = sound->release();
ERRCHECK(result);
}
void
FMODSoundSystem::PlaySound(void)
{
result = system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
ERRCHECK(result);
}
void
FMODSoundSystem::Update(void)
{
result = system->update();
ERRCHECK(result);
unsigned int ms = 0;
unsigned int lenms = 0;
bool playing = 0;
bool paused = 0;
int channelsplaying = 0;
if (channel)
{
FMOD::Sound *currentsound = 0;
result = channel->isPlaying(&playing);
if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
{
ERRCHECK(result);
}
result = channel->getPaused(&paused);
if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
{
ERRCHECK(result);
}
result = channel->getPosition(&ms, FMOD_TIMEUNIT_MS);
if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
{
ERRCHECK(result);
}
channel->getCurrentSound(¤tsound);
if (currentsound)
{
result = currentsound->getLength(&lenms, FMOD_TIMEUNIT_MS);
if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
{
ERRCHECK(result);
}
}
}
system->getChannelsPlaying(&channelsplaying);
}
Code: Select all
//! Init resources needed for the CMenuState state, menu buttons etc
void CGameMenuState::Init(CGameManager * pManager)
{
// initialise from parent
CGameState::Init(pManager);
...
pManager->getFMODSoundSystem()->Init("media/dw1_title_sound.wav",FMOD_SOFTWARE);
pManager->getFMODSoundSystem()->PlaySound();
CGameState::FadeInOut(pManager);
}
Code: Select all
//! Update, game loop for intro state
void CGameMenuState::Update(CGameManager * pManager)
{
pManager->getDriver()->beginScene(true, true, video::SColor(0,0,0,0));
pManager->getGUIEnvironment()->drawAll();
pManager->getFMODSoundSystem()->Update();
MouseOver(pManager);
DisplayMouse(pManager);
pManager->getDriver()->endScene();
}
Code: Select all
void CGameMenuState::Clear(CGameManager * pManager)
{
// tidy up code here
if(m_pIntroImage) m_pIntroImage->remove();
if(m_pPlayButtonImage) m_pPlayButtonImage->remove();
if(m_pPlayButtonHighImage) m_pPlayButtonHighImage->remove();
if(m_pOptionsButtonImage) m_pOptionsButtonImage->remove();
if(m_pOptionsButtonHighImage) m_pOptionsButtonHighImage->remove();
if(m_pCreditsButtonImage) m_pCreditsButtonImage->remove();
if(m_pCreditsButtonHighImage) m_pCreditsButtonHighImage->remove();
if(m_pExitButtonImage) m_pExitButtonImage->remove();
if(m_pExitButtonHighImage) m_pExitButtonHighImage->remove();
if(pManager->getFMODSoundSystem()) pManager->getFMODSoundSystem()->Clear();
}
You seem to be making excellent progress with FMOD, looking much better now.
________
Oregon marijuana dispensary
________
Oregon marijuana dispensary
Last edited by area51 on Thu Feb 24, 2011 11:55 pm, edited 1 time in total.
area51 -- Thanks. I really appreciate it when people post responses/feedback. It really motivates me.
I stumbled upon another hurtle that I like to share with everyone:
If it's not one thing, it's another thing. Another reason why it takes so long to make your own game.
I started displaying the DW1 truetype font that I posted about earlier in this thread in-game (or more specifically in-engine, since I used a heavy modified irrlicht example 05 UserInterface for the test).
Here's what I discovered. When using the IrrFontTool to convert truetype font to bitmap, I noticed it looked like there were some sort of jaggies in-game:
http://i11.photobucket.com/albums/a175/ ... dified.jpg
After magnifying the bitmap font image 800%, I soon realize the reason why. Somewhere in the process, additional "filler" colors where added around the letters/numbers/symbols that make up the font bitmap. I manually cleaned the font bitmap one letter/number/symbol at a time (it took about an hour and a half). Here's a side-by-side comparison (left one in the image is the cleaned one):
http://i11.photobucket.com/albums/a175/ ... arison.jpg
After cleaning, it looked a lot better in-game:
http://i11.photobucket.com/albums/a175/ ... leaned.jpg
Geez. I feel like a programmer, designer, artist, modeller, movie dude, and who-knows-what-else wrapped into one. I can't believe how much effort it takes to put together a game by oneself. I truely appreciate everyone out there who have created their own game. I salute you!
I stumbled upon another hurtle that I like to share with everyone:
If it's not one thing, it's another thing. Another reason why it takes so long to make your own game.
I started displaying the DW1 truetype font that I posted about earlier in this thread in-game (or more specifically in-engine, since I used a heavy modified irrlicht example 05 UserInterface for the test).
Here's what I discovered. When using the IrrFontTool to convert truetype font to bitmap, I noticed it looked like there were some sort of jaggies in-game:
http://i11.photobucket.com/albums/a175/ ... dified.jpg
After magnifying the bitmap font image 800%, I soon realize the reason why. Somewhere in the process, additional "filler" colors where added around the letters/numbers/symbols that make up the font bitmap. I manually cleaned the font bitmap one letter/number/symbol at a time (it took about an hour and a half). Here's a side-by-side comparison (left one in the image is the cleaned one):
http://i11.photobucket.com/albums/a175/ ... arison.jpg
After cleaning, it looked a lot better in-game:
http://i11.photobucket.com/albums/a175/ ... leaned.jpg
Geez. I feel like a programmer, designer, artist, modeller, movie dude, and who-knows-what-else wrapped into one. I can't believe how much effort it takes to put together a game by oneself. I truely appreciate everyone out there who have created their own game. I salute you!
Hi all!
I've just completed putting together a rough version of the options menu.
I couldn't have done it without consulting this forum's vast knowledge archive.
At who, here's a pic of the main options screen:
http://i11.photobucket.com/albums/a175/ ... een_v1.jpg
Here's a sub-window once you click an option (I know in the original NES DW 1, you move up and down with gamepad then use button on gamepad to select the option; but I haven't got gamepad support in yet, so only mouse is supported -- that's why they're GUI buttons):
http://i11.photobucket.com/albums/a175/ ... window.jpg
It looks better in motion.
Here's a video demo of options screen in action (only 445,680 bytes; used to be 33,899,328 bytes before I encoded with Windows Movie Maker):
http://rapidshare.de/files/12148056/DW1 ... o.wmv.html
But that's not all, here's the heavily modified irrlicht example 5 that I used to test out the options screen:
As you can see, I had to think of something clever to work around not being able to make the inner part of the background image transparent. I ended up cutting up the image into four pieces. Then moving each to the correct coordinates.
Also, I added the button and background image to the sub-window "node" as children so that when the sub-window closes, it removes the buttons and background images. Pretty neat, huh?
...going to bed now -- good night everyone.
I've just completed putting together a rough version of the options menu.
I couldn't have done it without consulting this forum's vast knowledge archive.
At who, here's a pic of the main options screen:
http://i11.photobucket.com/albums/a175/ ... een_v1.jpg
Here's a sub-window once you click an option (I know in the original NES DW 1, you move up and down with gamepad then use button on gamepad to select the option; but I haven't got gamepad support in yet, so only mouse is supported -- that's why they're GUI buttons):
http://i11.photobucket.com/albums/a175/ ... window.jpg
It looks better in motion.
Here's a video demo of options screen in action (only 445,680 bytes; used to be 33,899,328 bytes before I encoded with Windows Movie Maker):
http://rapidshare.de/files/12148056/DW1 ... o.wmv.html
But that's not all, here's the heavily modified irrlicht example 5 that I used to test out the options screen:
Code: Select all
#include <irrlicht.h>
#include <iostream>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#pragma comment(lib, "Irrlicht.lib")
IrrlichtDevice *device = 0;
video::IVideoDriver* driver = 0;
// globals for CHANGE MESSAGE SPEED menu option
s32 window_102_closeButtonId = 0;
IGUIWindow* window102;
IGUIButton* button106;
// Event Receiver
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
IGUIEnvironment* env = device->getGUIEnvironment();
switch(event.GUIEvent.EventType)
{
// decide what to do when a button is clicked
case EGET_BUTTON_CLICKED:
// CONTINUE A QUEST menu option
if (id == 101)
{
// TODO
return true;
}
// CHANGE MESSAGE SPEED menu option
if (id == 102)
{
// create window
window102 = env->addWindow(rect<s32>(280,370,835,400),
true,
L"Select Saved Game"); // unable to see text
//// add bitmap background to window
IGUISkin* window102Skin = env->getSkin();
// define black color and fully transparent
SColor window102BlackColor(255,0,0,0);
// draw 3D window, set background to transparent
window102Skin->draw3DWindowBackground(window102,
false,
window102BlackColor,
rect<s32>(280,370,835,400));
// load window background top image of the frame)
IGUIImage* window102BackGroundTop = env->addImage(driver->getTexture("media/single_adventure_window_border_top.bmp"),
position2d<int>(400,360));
// load window background bottom image of the frame)
IGUIImage* window102BackGroundBottom = env->addImage(driver->getTexture("media/single_adventure_window_border_bottom.bmp"),
position2d<int>(400,415));
// load window background left image of the frame)
IGUIImage* window102BackGroundLeft = env->addImage(driver->getTexture("media/single_adventure_window_border_left.bmp"),
position2d<int>(400,365));
// load window background right image of the frame)
IGUIImage* window102BackGroundRight = env->addImage(driver->getTexture("media/single_adventure_window_border_right.bmp"),
position2d<int>(775,365));
// add button to represent saved game
button106 = env->addButton(rect<s32>(280,370,820,400),
0,
106,
L"ADVENTURE LOG 1: Jcln");
// assign button to this window (so that it can be removed when window is closed)
window102->addChild(button106);
window102->addChild(window102BackGroundTop);
window102->addChild(window102BackGroundLeft);
window102->addChild(window102BackGroundRight);
window102->addChild(window102BackGroundBottom);
return true;
}
// BEGIN A NEW QUEST menu option
if (id == 103)
{
// TODO
return true;
}
// COPY A QUEST menu option
if (id == 104)
{
// TODO
return true;
}
// ERASE A QUEST menu option
if (id == 105)
{
// TODO
return true;
}
break;
}
}
return false;
}
};
int main()
{
// create device and exit if creation failed
device = createDevice(video::EDT_DIRECT3D9, core::dimension2d<s32>(1024, 768));
// could not create selected driver.
if (device == 0) return 1;
// setup the event receiver
MyEventReceiver receiver;
device->setEventReceiver(&receiver);
// set windows caption
device->setWindowCaption(L"DW 1 3D -- Options Menu Test");
// setup video driver
driver = device->getVideoDriver();
// setup and gui environment
IGUIEnvironment* env = device->getGUIEnvironment();
// define white color
SColor color(255,255,255,255);
// change button text to white color
env->getSkin()->setColor(EGDC_BUTTON_TEXT,color);
// define black color
SColor black_color(255,0,0,0);
// set all GUI colors for buttons to black up to button text
for (s32 i=0; i<8; ++i)
{
env->getSkin()->setColor((EGUI_DEFAULT_COLOR)i,black_color);
}
// set all GUI colors for buttons to black after button text
for (s32 i=9; i<EGDC_COUNT; ++i)
{
env->getSkin()->setColor((EGUI_DEFAULT_COLOR)i,black_color);
}
// add buttons to represent options choices
env->addButton(rect<s32>(250,210,790,240), 0, 101, L"CONTINUE A QUEST");
env->addButton(rect<s32>(280,250,820,280), 0, 102, L"CHANGE MESSAGE SPEED");
env->addButton(rect<s32>(255,290,795,320), 0, 103, L"BEGIN A NEW QUEST");
env->addButton(rect<s32>(220,330,760,360), 0, 104, L"COPY A QUEST");
env->addButton(rect<s32>(227,370,767,400), 0, 105, L"ERASE A QUEST");
// set button text to "cleaned" DW 1 font
IGUISkin* skin = env->getSkin();
IGUIFont* font = env->getFont("media/dw1_font_256_normal_20_pts_cleaned.bmp");
if (font) skin->setFont(font);
// execute game loop
while(device->run() && driver)
if (device->isWindowActive())
{
// set scene background to black
driver->beginScene(true, true, SColor(0,0,0,0));
env->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
Also, I added the button and background image to the sub-window "node" as children so that when the sub-window closes, it removes the buttons and background images. Pretty neat, huh?
...going to bed now -- good night everyone.
Spintz -- hey, what an idea! Thanks.
I've been digging through the irrlicht documentation on how to add debug info on-screen in the game. Hopefully, when I'm done, it'll be as easy as pressing a key to turn on debug info and off.
On top of that, I guess I can add different rendering model, wireframe view, etc.
I've been digging through the irrlicht documentation on how to add debug info on-screen in the game. Hopefully, when I'm done, it'll be as easy as pressing a key to turn on debug info and off.
On top of that, I guess I can add different rendering model, wireframe view, etc.
I've been playing around with Yellow's RTS style camera code. You can see the two classes that I made in the thread Yellow created:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=11154
I had to make some changes to irrWizard to incorporate the BirdsEyeCam class. I added the pointers/accessor to CGManager.
I initialized it here "CGamePlayState::Init":
Then called it in "CGamePlayState::Update":
Heh, I'm getting pretty good at adding new classes to irrWizard. That's a testament to how well the OO design area51 laid out for irrWizard. Thanks, area51!
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=11154
I had to make some changes to irrWizard to incorporate the BirdsEyeCam class. I added the pointers/accessor to CGManager.
I initialized it here "CGamePlayState::Init":
Code: Select all
//! Initialisation, loads data required for state. Generic game play
//! initialisation performed here, level specific initialisation should
//! be performed by the sub-classed level
void CGamePlayState::Init(CGameManager* pManager)
{
// text position and colour
m_pPlayStateText = pManager->getGUIEnvironment()->addStaticText(L"ESC Quit\n F1 Credits\n F2 Introduction",
rect<int>(10,30,200,160), false);
m_statusText = pManager->getGUIEnvironment()->addStaticText(L"",
rect<int>(10,10,200,30), false);
m_statusText->setOverrideColor(video::SColor(255,255,255,255));
m_pPlayStateText->setOverrideColor(video::SColor(255,255,0,0));
// load cross hair
m_pCrossHair = pManager->getDriver()->getTexture("media/crosshair.bmp");
pManager->getDriver()->makeColorKeyTexture(m_pCrossHair,core::position2d<s32>(0,0));
// load health bar
m_pHealthBar = pManager->getDriver()->getTexture("media/healthbar.jpg");
pManager->getDriver()->makeColorKeyTexture(m_pHealthBar,core::position2d<s32>(0,0));
// load mini stats bar
m_pQuickStat = pManager->getDriver()->getTexture("media/quick_stat.bmp");
pManager->getDriver()->makeColorKeyTexture(m_pQuickStat,core::position2d<s32>(0,0));
// init camera
m_pCamera = pManager->getICameraSceneNode();
}
Code: Select all
//! Update, moves and renders screen. Generic game play updates performed here,
//! level specific updates should be performed by the sub-classed level.
void CGamePlayState::Update(CGameManager * pManager)
{
// overide in child class
pManager->getDriver()->beginScene(true, true, video::SColor(0,100,100,100));
pManager->getSceneManager()->drawAll();
pManager->getBirdsEyeCAM()->Update(m_pCamera,pManager->getDevice(),pManager->getDriver());
displayCrossHair(pManager);
//displayHealthBar(pManager, pManager->getPlayer()->getHealth());
displayMiniStatScreen(pManager, pManager->getPlayer()->getHealth());
pManager->getGUIEnvironment()->drawAll();
pManager->getDriver()->endScene();
}
Thanks for the positive feedback, the cheque's in the post
A cool thing about this approach is that you can create pluggable components.
In Dungeon Tech, I had an IPluggableManager interface with forced you to create an About(), Init(),Update() and Clear() functions. They can then be compiled to a DLL and then coded against. I?ll add this back into IrrWizard I think.
The About() would just contain info on the component like version, author, description etc. Then you could have a whole army of people running around creating these things, swapping, trading, sharing across projects. Pluggable game components, that?s the way to go.
You could even create a loader and have them as dynamic DLL?s initialised by a script.
Anyway, looks like you?re on fire so I?ll let you get on. Keep up the good work.
________
Nighthawk
A cool thing about this approach is that you can create pluggable components.
In Dungeon Tech, I had an IPluggableManager interface with forced you to create an About(), Init(),Update() and Clear() functions. They can then be compiled to a DLL and then coded against. I?ll add this back into IrrWizard I think.
The About() would just contain info on the component like version, author, description etc. Then you could have a whole army of people running around creating these things, swapping, trading, sharing across projects. Pluggable game components, that?s the way to go.
You could even create a loader and have them as dynamic DLL?s initialised by a script.
Anyway, looks like you?re on fire so I?ll let you get on. Keep up the good work.
________
Nighthawk
Last edited by area51 on Thu Feb 24, 2011 11:56 pm, edited 1 time in total.
Nah, you deserve it the complement. It's a damn good design. Other people should download and learn from it. I know I learned a lot about game programming by figuring out how everything in irrWizard works. Sometimes, it takes me several hours but after I figure it out/do it once or twice -- I'm set.area51 wrote:Thanks for the positive feedback, the cheque's in the post
A cool thing about this approach is that you can create pluggable components.
In Dungeon Tech, I had an IPluggableManager interface with forced you to create an About(), Init(),Update() and Clear() functions. They can then be compiled to a DLL and then coded against. I’ll add this back into IrrWizard I think.
The About() would just contain info on the component like version, author, description etc. Then you could have a whole army of people running around creating these things, swapping, trading, sharing across projects. Pluggable game components, that’s the way to go.
You could even create a loader and have them as dynamic DLL’s initialised by a script.
Anyway, looks like you’re on fire so I’ll let you get on. Keep up the good work.
Say, I downloaded Dungeon Tech a couple of days ago. I couldn't get it to run on my machine for some reason. So, I started looking for the source code. It didn't come with any. I went to the web site for it and it shows the classes document, but I did not see a link for source download. I guess I'm just curious if you had released a version with source code. The D&D d20 references in the documentation got me all excited.
Ugh. I've been stuck trying to figure out how to get around the following runtime error message:
runtime error R6025 Pure Virtual Function Call
I'm been trying to add the options test code that I made external to the DW1 project. The "virtual bool OnEvent(SEvent event)" operation is kicking my rear.
I've tried inheritance, association, multiple inheritance, etc. Nothing seems to be working for me. I did managed to get it compile and running using multiple inheritance but the mouse and keyboard would not work properly (I click on the button but no reaction/response back from button -- which means something is up with mr. virtual bool OnEvent().
If anybody has any suggestions or have experienced this issue before, please post.
runtime error R6025 Pure Virtual Function Call
I'm been trying to add the options test code that I made external to the DW1 project. The "virtual bool OnEvent(SEvent event)" operation is kicking my rear.
I've tried inheritance, association, multiple inheritance, etc. Nothing seems to be working for me. I did managed to get it compile and running using multiple inheritance but the mouse and keyboard would not work properly (I click on the button but no reaction/response back from button -- which means something is up with mr. virtual bool OnEvent().
If anybody has any suggestions or have experienced this issue before, please post.
It's somehow trying to call the IEventReciver::OnEvent() function and not the implemented class's OnEvent() function, normally the compiler would stop that though.
In an unmodified IrrWizard situation you would create a GameState then add your 'test options' code to that state, using the MouseEvent() and KeyBoardEvent() functions to detect when the user clickes/presses things.
CGameManager controls the OnEvent handling and passes control down the the State.
If your test class implements IEventReciever, then you can rip that bit out as its not needed.
CGameManager might not have initialised correctly, if your experimenting with creating a NULL or SOFTWARE device to give the user options on changing the device type. Maybe somethings got mixed up there? not too sure.
I've checked out the source for Dungeon Tech, and the D20 bit doesn't seem to have been developed enough to make it of any use. If I do create anything of any use then I'll disclose the source, no worries.
________
Lamborghini Silhouette
In an unmodified IrrWizard situation you would create a GameState then add your 'test options' code to that state, using the MouseEvent() and KeyBoardEvent() functions to detect when the user clickes/presses things.
CGameManager controls the OnEvent handling and passes control down the the State.
If your test class implements IEventReciever, then you can rip that bit out as its not needed.
CGameManager might not have initialised correctly, if your experimenting with creating a NULL or SOFTWARE device to give the user options on changing the device type. Maybe somethings got mixed up there? not too sure.
I've checked out the source for Dungeon Tech, and the D20 bit doesn't seem to have been developed enough to make it of any use. If I do create anything of any use then I'll disclose the source, no worries.
________
Lamborghini Silhouette
Last edited by area51 on Thu Feb 24, 2011 11:56 pm, edited 1 time in total.