Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 13 14 [15] 16 17 ... 72

Author Topic: The Roguelike Development Megathread  (Read 245803 times)

Fenrir

  • Bay Watcher
  • The Monstrous Wolf
    • View Profile
Re: The Roguelike Development Megathread
« Reply #210 on: January 31, 2009, 05:36:44 pm »

The Game class needs to have access to the creature class so it can populate the world. Since one must be defined before the other, that's a bit of a problem.
Logged

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Re: The Roguelike Development Megathread
« Reply #211 on: January 31, 2009, 05:43:21 pm »

Nope!

You'll have trouble if game.h includes creature.h, and creature.h includes game.h...

However, here's the fix.  At the top of game.h, say "class Creature;".  At the top of creature.h, say "class Game;".  Any Creature you declare in Game has to be a pointer, and vice versa, but you can do it.

(The .cpp file of course needs to #include both.)
Logged
Some things were made for one thing, for me / that one thing is the sea~
His servers are going to be powered by goat blood and moonlight.
Oh, a biomass/24 hour solar facility. How green!

Andir

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #212 on: January 31, 2009, 10:50:30 pm »

The elf doesn't really do anything yet, which is what I'm implementing now.

Creatures should update themselves, but then they don't have access to any information about the world around them. Should I pass a vector of all the world's objects to them, or maybe a pointer to my Game class?
Brainstorm idea: Why not have the Elf figure out what it's to do by giving the elf it's own viewport object on the world?  You don't have to render it.  Just give the elf a viewport of whatever size you want it to "know about" and have it move.  As far as items are concerned, it will see whatever items are in the immediate area and you can have the AI respond.
Logged
"Having faith" that the bridge will not fall, implies that the bridge itself isn't that trustworthy. It's not that different from "I pray that the bridge will hold my weight."

CapnMikey

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #213 on: January 31, 2009, 11:10:27 pm »

Good idea!  Viewport is a useful abstraction.  So basically World is like "here's everything in the game", and doesn't need to worry about who can see what from where or special senses or whatnot.  Viewport would provide a limited view of a part of the world.  Initially it might just limit range, but when you add line-of-sight or infravision or other senses, they could be handled in Viewport.
Logged

Andir

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #214 on: January 31, 2009, 11:43:18 pm »

Good idea!  Viewport is a useful abstraction.  So basically World is like "here's everything in the game", and doesn't need to worry about who can see what from where or special senses or whatnot.  Viewport would provide a limited view of a part of the world.  Initially it might just limit range, but when you add line-of-sight or infravision or other senses, they could be handled in Viewport.
I wouldn't put the LOS in the viewport.  Not everything that uses the viewport would need LOS calculations.  You could do LOS calcs on what viewport returns though.  If there were infinite amounts of CPU... then doing LOS in the viewport would make the game more realistic because you could hide from a mob behind a tree and other interesting things.  You could do LOS checks only on mobs in the immediate area to achieve the same thing.
Logged
"Having faith" that the bridge will not fall, implies that the bridge itself isn't that trustworthy. It's not that different from "I pray that the bridge will hold my weight."

EchoP

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #215 on: February 01, 2009, 01:29:26 am »

After discovering that libtcod>pygame, and struggling to get it to run for an ages:

Life Mk2!
Logged

chaoticag

  • Bay Watcher
  • All Natural Pengbean
    • View Profile
Re: The Roguelike Development Megathread
« Reply #216 on: February 01, 2009, 08:36:10 am »

I have a rudimentary inventory system working.


POWERGOAL:
The fight didn't go well: you lost your weapon and your clothes are in tatters. Caked in filth, you pass by two elves who begin to jeer at you. You quickly grasp one by the legs. Both victim and weapon scream as you slam one into the other.
Hehehehe, You should have the default name of your character Jason because in Terry Pratchet's Lords and Ladies he fights of a hoard of elves by grabbing the closest thing to him at the moment. Dare I say what it is?
Logged

Dasleah

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #217 on: February 01, 2009, 06:35:54 pm »



Still working away on mine. Rewriting the map generation functions. Before, I had things like makeGrass() and growTrees(), but now I'm moving over to implementing generic algorithms, so now I can go floodFill("grass") or randomWalk("lava", 5, 100) (which is what the above example uses - 5 being the number of seeds and 100 being the number of steps from each seed in a random direction)

Next up is finally implementing an Entity class for controlling / creating players, monsters, and items, which is making my head hurt.
Logged
Pokethulhu Orange: UPDATE 25
The Roguelike Development Megathread.

As well, all the posts i've seen you make are flame posts, barely if at all constructive.

deadlycairn

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #218 on: February 01, 2009, 07:14:40 pm »

... and I STILL can't get my attack function to work properly.

I tip my hat to all of your superior coding skills, Dasleah, Fenrir, Echo and anybody else who's made something better than me.
Logged
Quote from: Ampersand
Also, Xom finds people that chug unidentified fluids pleasing.
Quote from: Servant Corps
Ignorance of magic does not give scientists the power to resist fireballs.

mainiac

  • Bay Watcher
  • Na vazeal kwah-kai
    • View Profile
Re: The Roguelike Development Megathread
« Reply #219 on: February 01, 2009, 07:23:24 pm »

Hey man, you're worlds ahead of me.  I still can't get inputs working.
Logged
Ancient Babylonian god of RAEG
--------------
[CAN_INTERNET]
[PREFSTRING:google]
"Don't tell me what you value. Show me your budget and I will tell you what you value"
« Last Edit: February 10, 1988, 03:27:23 pm by UR MOM »
mainiac is always a little sarcastic, at least.

Fenrir

  • Bay Watcher
  • The Monstrous Wolf
    • View Profile
Re: The Roguelike Development Megathread
« Reply #220 on: February 01, 2009, 08:20:54 pm »

Should the Viewport calculate FOV? If it doesn't, I see little point in giving one to the elf, since FOV has the final say in what the creature actually sees.
Logged

Andir

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #221 on: February 01, 2009, 08:39:18 pm »

Should the Viewport calculate FOV? If it doesn't, I see little point in giving one to the elf, since FOV has the final say in what the creature actually sees.
Give the Elf a viewport of his own (unrendered, virtual) and calculate FOV from the limited world array returned.  In other words, let the viewport filter the world for you.
Logged
"Having faith" that the bridge will not fall, implies that the bridge itself isn't that trustworthy. It's not that different from "I pray that the bridge will hold my weight."

Fenrir

  • Bay Watcher
  • The Monstrous Wolf
    • View Profile
Re: The Roguelike Development Megathread
« Reply #222 on: February 01, 2009, 08:46:31 pm »

Oh, so I don't have to loop through every object in the world to determine which he sees.

EDIT:
Oh, wait. My Viewport class knows nothing of objects; it only handles terrain. Hmmm... It seems that I must store the objects in the individual tiles too, which means that my map can no longer be an array of integers and I'll need a tile class. I can't however have an array of objects unless I use a vector.
« Last Edit: February 01, 2009, 09:38:23 pm by Fenrir »
Logged

mainiac

  • Bay Watcher
  • Na vazeal kwah-kai
    • View Profile
Re: The Roguelike Development Megathread
« Reply #223 on: February 01, 2009, 09:38:37 pm »

Okay, this REALLY has me confused:

I'm backing up obsessively because I'm stumbling my way through C++ and mangling things as I learn.  So, when I make a mistake, I have a backup to refer to.  Well, I add a "cout" command that my program doesn't like and it stops compiling.  So I comment that line out but it still doesn't want to compile.  I just delete the line entirely and my code STILL won't compile, so I figure the problem is somewhere else and go to my backup.

My backup compiles fine.  I make a compiling copy of the backup and add the cout line in, doesn't compile, problem must be in the cout line.  I comment out the cout line, that doesn't compile.  I delete the cout line entirely, still doesn't compile.  This is the exact same code as the backup that compiles just fine!  I even try copypasta over my entire main file just to make sure it's exactly the same as in my backup.

So yeah, I think this bug is The One.  It can manipulate the C++ environment bend the rules of it's world.  It is one with the program.

It's too bad for Neo that I'll just revert to backup again and not rewrite him.

Edit:  Oh, crap!  Neo spread to my backup!  How?  Noooo!  My entire virtual world is collapsing! 
Okay, I'm going to my emergency backup.  If I don't give an update in 10 minutes, assume that the computer revolt has begun and tell them to nuke Philadelphia immediately.  I meddled with C++ beyond my comprehension.  May God have mercy on my soul.
« Last Edit: February 01, 2009, 09:45:26 pm by mainiac »
Logged
Ancient Babylonian god of RAEG
--------------
[CAN_INTERNET]
[PREFSTRING:google]
"Don't tell me what you value. Show me your budget and I will tell you what you value"
« Last Edit: February 10, 1988, 03:27:23 pm by UR MOM »
mainiac is always a little sarcastic, at least.

Fenrir

  • Bay Watcher
  • The Monstrous Wolf
    • View Profile
Re: The Roguelike Development Megathread
« Reply #224 on: February 01, 2009, 09:46:51 pm »

Does it give an error message when it doesn't compile?
Logged
Pages: 1 ... 13 14 [15] 16 17 ... 72