Pages: [1] 2 3
  Print  
Author Topic: Umbra  (Read 2080 times)
mingos
Master
****
Posts: 400



View Profile WWW
« on: October 27, 2009, 10:42:14 pm »

I have recently started to write a generic engine for libtcod-powered games, called Umbra. It is supposed to be the engine behind Umbrarum Regnum, which is on hold until Umbra is ready. You may check UR site at http://umbrarumregnum.110mb.com from time to time to see whether there are any news regarding Umbra. The source code is available at all times, under the BSD licence, at the project's semi-private SVN repository. You can check it out at https://doryen.eptalys.net/svn-umbra/trunk.

The project is at a very early stage right now (it's still a "Hello world" program), but development should be relatively rapid. I hope you like the engine!
Logged

(15:56:14) jice: oh and teach your dog to code roguelikes too Cheesy
(16:00:11) mingos: OMFG
jonoerik
Champion
***
Posts: 196



View Profile
« Reply #1 on: October 28, 2009, 09:46:36 pm »

From what I've seen of Umbrarum Regnum, this could be quite amazing.  I'll have a look at the source for the new engine.  Keep us updated with any news.
Logged
mingos
Master
****
Posts: 400



View Profile WWW
« Reply #2 on: October 28, 2009, 11:14:16 pm »

The news is that I've just teamed up with Jice. His experience is invaluable as his current project used a similar engine. A common effort will be a boon to everyone, as the engine will be suited for both turn based games like UR and real time like TCOD, with necessities of at least two developers taken into account. When it can be actually used to power a simple game, I'll set up a page about it on UR site.
Logged

(15:56:14) jice: oh and teach your dog to code roguelikes too Cheesy
(16:00:11) mingos: OMFG
jonoerik
Champion
***
Posts: 196



View Profile
« Reply #3 on: October 29, 2009, 06:10:31 am »

So UR and TCOD are going to be based on the same engine?
Sounds good.  I eagerly anticipate the games!
Logged
mingos
Master
****
Posts: 400



View Profile WWW
« Reply #4 on: October 29, 2009, 05:43:43 pm »

Yeah, that's the plan Smiley. Hope it works out Cheesy
Logged

(15:56:14) jice: oh and teach your dog to code roguelikes too Cheesy
(16:00:11) mingos: OMFG
jice
Administrator
Master
*****
Posts: 942


View Profile WWW
« Reply #5 on: November 01, 2009, 01:48:52 am »

In case you wonder if Umbra is already usable, I've just ported my next prototype, based on pyromancer! code to Umbra.
That means Umbra, as light as it is currently, can already power a game like pyromancer!
Logged
jice
Administrator
Master
*****
Posts: 942


View Profile WWW
« Reply #6 on: November 01, 2009, 02:23:31 am »

To see more precisely what is the point using Umbra, check this source code and see how Umbra simplifies the game initialisation and the main game loop.
Version without Umbra (basically, it's a part of pyromancer's main.cpp file).

Code:
static void initGameWindow() {
char tmp[128];
int fontSize=userPref.fontSize;
sprintf(tmp,"data/img/font%dx%d.png",fontSize,fontSize);
TCODConsole::setCustomFont(tmp,TCOD_FONT_LAYOUT_TCOD|TCOD_FONT_TYPE_GRAYSCALE);
TCODConsole::initRoot(CON_W,CON_H,"The cave "VERSION, userPref.fullScreen);
TCODConsole::mapAsciiCodeToFont(TCOD_CHAR_PROGRESSBAR,0,5);
TCODSystem::setFps(25);
TCODMouse::showCursor(true);
PowerupGraph::instance->setFontSize(fontSize);
}

int main (int argc, char *argv[]) {

...

float timeScale=Config::getFloat("config.gameplay.timeScale");
bool endCredits=false;
bool endGame=false;
// render and update current screen
while (!endGame && ! TCODConsole::isWindowClosed()) {
// read keyboard
TCOD_key_t k=TCODConsole::checkForKeypress(TCOD_KEY_PRESSED|TCOD_KEY_RELEASED);
TCOD_mouse_t mouse=TCODMouse::getStatus();
if ( k.vk == TCODK_PRINTSCREEN ) {
// PRINTSCREEN : take a screenshot
if (! k.pressed ) TCODSystem::saveScreenshot(NULL);
k.vk=TCODK_NONE;
} else if ( k.lalt && (k.vk == TCODK_ENTER || k.vk == TCODK_KPENTER) ) {
// ALT-ENTER : switch fullscreen
if (! k.pressed ) TCODConsole::setFullscreen(!TCODConsole::isFullscreen());
k.vk=TCODK_NONE;
} else if (k.vk == TCODK_PAGEUP && userPref.fontSize < 12 ) {
// PAGEUP : increase font size
if( ! k.pressed ) {
userPref.fontSize+=2;
delete TCODConsole::root;
TCODConsole::root=NULL;
userPref.save();
initGameWindow();
TCODConsole::root->flush();
}
k.vk=TCODK_NONE;
} else if (k.vk == TCODK_PAGEDOWN && userPref.fontSize > 8 ) {
// PAGEDOWN : decrease font size
if( ! k.pressed ) {
userPref.fontSize-=2;
delete TCODConsole::root;
TCODConsole::root=NULL;
userPref.save();
initGameWindow();
TCODConsole::root->flush();
}
k.vk=TCODK_NONE;
}
// update the game
if (!engine.update(TCODSystem::getLastFrameLength()*timeScale,k,mouse)) endGame=true;

// render the game screen
engine.render();
// render libtcod credits
if (! endCredits ) endCredits = TCODConsole::renderCredits(65,42,true);
// flush updates to screen
TCODConsole::root->flush();
}
return 1;
}

Version with Umbra :

Code:
int main (int argc, char *argv[]) {

...

    engine.setWindowTitle("The cave "VERSION);
    // register the fonts
    engine.registerFont(32,8,"data/img/font8x8.png",TCOD_FONT_LAYOUT_TCOD|TCOD_FONT_TYPE_GRAYSCALE);
    engine.registerFont(32,8,"data/img/font10x10.png",TCOD_FONT_LAYOUT_TCOD|TCOD_FONT_TYPE_GRAYSCALE);
    engine.registerFont(32,8,"data/img/font12x12.png",TCOD_FONT_LAYOUT_TCOD|TCOD_FONT_TYPE_GRAYSCALE);

...

    if (engine.initialise()) {
        TCODConsole::mapAsciiCodeToFont(TCOD_CHAR_PROGRESSBAR,0,5);
        TCODSystem::setFps(25);
        TCODMouse::showCursor(true);
    PowerupGraph::instance->setFontSize(fontSize);
return engine.run();
}
return 1;
}

Both version have the same features (fullscreen switch, dynamic font size selection, screenshots automatically saved to disk).

Logged
Jotaf
Master
****
Posts: 685


View Profile
« Reply #7 on: November 01, 2009, 04:36:06 pm »

Very nice. But where I think this could really shine is the object system. What are your plans on that front?
Logged
jice
Administrator
Master
*****
Posts: 942


View Profile WWW
« Reply #8 on: November 02, 2009, 12:51:39 am »

Very nice. But where I think this could really shine is the object system. What are your plans on that front?

You mean items ? or OOP ?
We're currently working on screen transitions (built-in and custom) and some built-in modules (like a speed-o-meter you can use to display framerates in a single line of code).
Logged
Jotaf
Master
****
Posts: 685


View Profile
« Reply #9 on: November 02, 2009, 02:36:50 am »

I meant in-game objects in general: a class to handle items, monsters, the player, chests and altars... Something along the lines of your component-based system for TCOD Smiley Screen transitions are certainly a nice addition!
Logged
jice
Administrator
Master
*****
Posts: 942


View Profile WWW
« Reply #10 on: November 02, 2009, 10:28:25 am »

I meant in-game objects in general: a class to handle items, monsters, the player, chests and altars... Something along the lines of your component-based system for TCOD Smiley Screen transitions are certainly a nice addition!

Well we're working on generic utilities for the time being, not roguelike specific stuff. Once we're satisfied with the foundations, we'll be able to put higher level stuff on it. I think we need a solid widget system before thinking about items and chests. I don't know how far Mingos wants to push Umbra, but a framework like the one you're describing represents a huge amount of work and it would suck both of our lifes out of UR and TCOD... I'm not sure I want to be involved in such an ambitious project. My primary goal is still to release TCOD some day... Wink
Logged
mingos
Master
****
Posts: 400



View Profile WWW
« Reply #11 on: November 02, 2009, 07:43:38 pm »

I like to view Umbra as a tool that gives the developer unlimited possibilities and implementing code for what you're describing would inevitably negate the freedom I'd like the developer to have by introducing certain restrictions. It's more of a module loader than anything else, a tool that handles basic I/O involved in a program and introduces some bottom-up management so that the developer can focus on a more comfortable top-down perspective. You know, sort of "hey, I've got a great idea, let's see how it looks on the screen" instead of "hey, I've a great idea, but I have to leave it in the TODO list until I know how o make it appear on the screen".
Logged

(15:56:14) jice: oh and teach your dog to code roguelikes too Cheesy
(16:00:11) mingos: OMFG
Jotaf
Master
****
Posts: 685


View Profile
« Reply #12 on: November 03, 2009, 02:13:39 am »

Ah, yes, I get the idea. It's likely I'll use it when it's released, especially for the GUI and transitions! I'm not disappointed that you're not coding a component system because then I'd miss out on the fun of trying to code one myself Cheesy

I sort of did it in C++, it was a bit clunky but better than some examples I downloaded off the net (I managed to do away with some casts and stuff). I'm curious to see what I can come up with in python...
Logged
jice
Administrator
Master
*****
Posts: 942


View Profile WWW
« Reply #13 on: November 03, 2009, 09:58:00 am »

Concerning the game objects (items and so on), I had a astronaut architect generic Item class in TCOD with embeddable features (you could create a sword that produce light, a candle that deal damages...) but I'm not sure it's the right way to do it. In "The cave", I'm using a much more pragmatic approach.We'll see if it's more successful...
Logged
bernard
Protector
****
Posts: 44


View Profile
« Reply #14 on: November 04, 2009, 01:46:01 pm »

Concerning the game objects (items and so on), I had a astronaut architect generic Item class in TCOD with embeddable features (you could create a sword that produce light, a candle that deal damages...) but I'm not sure it's the right way to do it. In "The cave", I'm using a much more pragmatic approach.We'll see if it's more successful...

Indeed. Tarn Adams (of Dwarf Fortress fame) seems to do alright with the 'completely customizable/architecture astronaut' stuff, but the man has a work ethic like no other. For the rest of us mere mortals, YAGNI is a good principle.

On topic; I think Umbra will shine best if it allows a lot of room for freedom. If you specify too much, too specifically, you'll get an engine that is good at making one game. But there's a balance between 'playGame()' and 'mov $1, %eax', and the hard part is finding it.

And jice? I want to play TCOD some day. =p
Logged
Pages: [1] 2 3
  Print  
 
Jump to: