Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 3 [4] 5 6 ... 72

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

deadlycairn

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #45 on: January 26, 2009, 06:39:42 pm »

I'm also having massive problems with my man. As far as i can tell, the two classes are working together to prevent me creating my man. Everything I tried to do was blocked by one or other of the classes - now i deleted all I changed and it STILL won't work. I'm gonna sift through it to see what i've missed later, but I've had enough coding for one day.
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.

Dasleah

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #46 on: January 26, 2009, 11:06:47 pm »

SIGNS AND PORTENTS



 ;)

Python and libtcodpy, for those who want to know.
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.

Servant Corps

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #47 on: January 26, 2009, 11:08:11 pm »

Meanwhile, still chugging along. I seem to have a good system. Decide how you want to boost your little Insurgent Group, then get given a Mission, either be thrown into the act of conquering a random city or thrown into aiding a random ally and gaining random assistance.
Logged
I have left Bay12Games to pursue a life of non-Bay12Games. If you need to talk to me, please email at me at igorhorst at gmail dot com.

JoshuaFH

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #48 on: January 26, 2009, 11:20:24 pm »

I'm assuming the black screen with white dots on it is a really impressive feat.
Logged

Mephisto

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #49 on: January 26, 2009, 11:29:09 pm »

I believe I've got linked list operations down pat, which should aid me greatly. Tell me if this is good.

There will be multiple linked lists of different classes:
  • Enemies
  • Weapons
  • Armor
  • Food
  • Wands/scrolls
etc, etc.

This way, when time comes to process everything before updating the screen, I only have to mess with two lists - enemies and food (if I want to do spoilage). Well, I'd probably have to do the player also,  but I could stick him in with the enemies.

A thought that I've been mulling over for a few days - would it be more or less system intensive to have every object contain the ASCII value of whatever floor tile it's on? That way, when something is moved, I just have to update where the thing was and where it is now instead of the full map? That's less time drawing, but potentially huge memory usage if there's a lot of things on a particular level.
Logged

Ampersand

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #50 on: January 27, 2009, 12:39:34 am »

This thread should be stickied. In addition, anyone interested in figuring out the inner workings of ruby with me? I always figure things out best when I can bounce ideas around.
Logged
!!&!!

Blacken

  • Bay Watcher
  • Orange Polar Bear
    • View Profile
Re: The Roguelike Development Megathread
« Reply #51 on: January 27, 2009, 12:58:22 am »

If you're using .NET (C#, VB.NET, whatever), I cannot recommend highly enough the libtcod-net libraries. They are top-notch (disclaimer: I've submitted some code patches to it).
« Last Edit: January 27, 2009, 01:00:52 am by Blacken »
Logged
"There's vermin fish, which fisherdwarves catch, and animal fish, which catch fisherdwarves." - Flame11235

deadlycairn

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #52 on: January 27, 2009, 03:17:22 am »

Ok, I fixed the prior problem, and am slowly going through my code, but I hit another problem. Anyone here with the experience to know what's going on?
I've copypasted the code, when I compile it, it tells me there's an expected primary-expression before the '.' token on line 46. Probably something stupid, but I can't figure it out. At the moment I'm trying to initialise the player and enemy, and if I get past this, I'll move onto moving them, which I have a fair idea of how to do.

Spoiler (click to show/hide)
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 #53 on: January 27, 2009, 03:24:36 am »

Line 46 of what you gave us appears to be an empty line to me...
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.

Alexhans

  • Bay Watcher
  • This is toodamn shortto write something meaningful
    • View Profile
    • Osteopatia y Neurotonia
Re: The Roguelike Development Megathread
« Reply #54 on: January 27, 2009, 06:03:42 am »

Hey, I was hoping to make my own lil' roguelike, but there's just one problem. Anyone know how to color text in C++? Or, more specifically, what would I need to add in to the console.cpp in the first post's C++ tutorial to make it so the drawing commands there could ask for RGB as parameters, and punch out colored characters using it? As I've never used drawing commands in C++ before I've no idea if coloring text is simple or complicated, but I can't imagine it being too hard to add it in to the pre-existing functions.

If you don't want to use curses (I strongly recommend using it though, it has other features than color that make everything simpler) you could read about this console tutorial...
Working with Windows Consoles A multi part tutorial demostrating features of Win32 Console Applications or "DOS boxes".
http://www.adrianxw.dk/SoftwareSite/index.html
Part 4 covers colour
http://www.adrianxw.dk/SoftwareSite/Consoles/Consoles4.html




« Last Edit: January 27, 2009, 08:30:19 am by Alexhans »
Logged
“Eight years was awesome and I was famous and I was powerful" - George W. Bush.

Vaiolis

  • Bay Watcher
  • I Am Penguin!
    • View Profile
Re: The Roguelike Development Megathread
« Reply #55 on: January 27, 2009, 01:37:37 pm »

That worked! I'll have to edit out a bunch of things to get those functions in, to make it look neater, and it might be a bit more complicated, but it's far better than not having any color at all! Thank you very much :)
Logged
Today's Toady Tip: 3 and 4 are not the same number.
How borgly is your borgle's borgle?
The Minister of BEEEES! and of The Great Charter for the Toady Protectorate!

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: The Roguelike Development Megathread
« Reply #56 on: January 27, 2009, 01:56:03 pm »

Ok, I fixed the prior problem, and am slowly going through my code, but I hit another problem. Anyone here with the experience to know what's going on?
I've copypasted the code, when I compile it, it tells me there's an expected primary-expression before the '.' token on line 46. Probably something stupid, but I can't figure it out. At the moment I'm trying to initialise the player and enemy, and if I get past this, I'll move onto moving them, which I have a fair idea of how to do.

Spoiler (click to show/hide)


Assuming you're following the tutorial on making a rougelike in C++, I've found a few problems:
First of all, in line 49, you're calling the initialisation function of your character. But you havn't created a character yet! You've only defined one, but that's not the same as actualy creating one. This means there's no object to call the initiation from. a way to fix it is by adding
Code: [Select]
Character Player; on the line before it and then replace that line with
Code: [Select]
Player.playerInit(11,11, PlayerASCII);that way you'll creatte a character object named player and then call the code from that object instead of trying to call the code from an object that doesn't exist.
Do note that since you're now creating a character within a room object, each time you're creating a room you'll also create a character. Another option would be to move line 49 to within the main function and then create a character object on the line prior to that. that way you'll only make 1 character instead of 1 per room. Do take care to keep those lines out of the loop, or you'll get some weird effects ;)
Secondly, but you probably know this, your character doesn't have a draw methode, so you won't see it yet. But I'll leave it to you to fix that ;)
Last but not least the function you're using to define your character object takes a location and a character, but it does't take a setting for health. There's also no definition of the amount of health within the class itself. This means that your character will have a completely random amount of health. This might cause a splitting headache when yuo start working on combat. the initialisation function also doesn't take an argument for your character's name, which is fine ofcourse, since you're not using names yet, but you'll probably want to refere to the player and enemies by name later on ;). When you start to assinge names, do note that char only takes single characters. So you'll either need to implement strings in the apropriate places, or start using character arrays. The first methode is simpler, but you'll need to mess with the headers a bit.
« Last Edit: January 27, 2009, 02:08:21 pm by Virex »
Logged

Granite26

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #57 on: January 27, 2009, 02:14:19 pm »

I believe I've got linked list operations down pat, which should aid me greatly. Tell me if this is good.

There will be multiple linked lists of different classes:
  • Enemies
  • Weapons
  • Armor
  • Food
  • Wands/scrolls
etc, etc.

This way, when time comes to process everything before updating the screen, I only have to mess with two lists - enemies and food (if I want to do spoilage). Well, I'd probably have to do the player also,  but I could stick him in with the enemies.

A thought that I've been mulling over for a few days - would it be more or less system intensive to have every object contain the ASCII value of whatever floor tile it's on? That way, when something is moved, I just have to update where the thing was and where it is now instead of the full map? That's less time drawing, but potentially huge memory usage if there's a lot of things on a particular level.

I would recomend EVERY 'thing' inheriting from a 'thing' class that impliments 'timepasses'.  The default should do nothing, but overwrite it to do time stuff (like food decaying, spells wearing off, whatever)  It'll save you heartache down the road (Hey, this should do this over time?  Oh, but I'd have to rewrite:( )

Physics might be a different story.

I'd imagine the 'MobileUnits' class (including you and the bad guys and NPCs and anything else that 'acts') would have a separate list.  Separate the AI from the game rules from the character sheet.

Linked lists are... work... I'm using .net, and have thrown out all my lists in favor of dictionary(of string, objecttype).  That way I can get any object by name, list of names, or list of values.  (for instance, it's sprite based, so the items store the name of their sprite and there's an ImageServer that returns images based on the name).  It also handles all the overhead a linked list does.  It's bulky and lazy, but memory is cheap and you aren't storing more than a few thousand items...

What are you trying to run this on that optimizing the mapload is an issue?

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Re: The Roguelike Development Megathread
« Reply #58 on: January 27, 2009, 02:46:52 pm »

Yeah, with subclasses there's no real reason to put 'food' and 'weapons' in different lists.  If you're worried about calling a 'timePasses' on a lot of uninteresting objects, you could do something clever like...build a linked list of only objects that are affected by time.  So when you instantiate a lantern (that can burn out), a flaming sword (ditto), food, monsters, etc, put them in the 'needs to get prodded every turn' list...but mundane leather armor, no.

A thought that I've been mulling over for a few days - would it be more or less system intensive to have every object contain the ASCII value of whatever floor tile it's on? That way, when something is moved, I just have to update where the thing was and where it is now instead of the full map? That's less time drawing, but potentially huge memory usage if there's a lot of things on a particular level.

You're thinking along the right track, and this is a design decision that is very good--just a little misguided.  You're definately thinking about the right ideas though!  This is a problem you have to solve or your game is going to run way too slow.  You don't want to redraw every tile.  You only want to redraw the tiles that have changed.  So what do you do?...

Well, I can tell you what I just did in my game, and what I think most games do.  Each tile on the map has a list of the items it contains, and the map has a 'draw(x, y)' or, you know, something similar.  When you draw a specific map tile, you look at the list of items on that square:  If there's anything, draw the top item on the pile.  If there's nothing, draw the character of the floor there instead.  Each item also keeps track of its coordinates on the map.  Sounds redundant, but it'll make more sense:

When you have a goblin and it moves north, after verifying that it can go there, it says, "What's my current location?  Okay.  Remove me from that map tile, and then redraw that map tile.  What's the next place I'm going?  Okay.  Put me on that map tile's list...then redraw that map tile."

The goblin never draws itself.  It just changes which map tile it's on, and tells its origin and destination map tiles to redraw.  Quick and easy.

If you want to be way too clever--and this is a bigger deal in graphical games, not so much in ASCII ones but it does still matter--you can choose not to redraw each tile right away.  Instead, keep a set of coordinates that need redrawing--a 'dirty' list--and then redraw them all right before the player's turn...or at the end of whatever you're doing.  This is a user interface decision, and there's reasons to do and to not do it.  But if you do it this way, you don't redraw the same tile twice in one turn if one goblin leaves it, then another goblin steps in.  Also, graphics are frequently faster if you do all your drawing in one go, instead of spreading it out.

(When used in that last paragraph, 'set' is a specific storage class.  If you put the same coordinate into the set twice, there will still only be one copy.  It's very fast.)
« Last Edit: January 27, 2009, 02:52:34 pm by Sowelu »
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!

deadlycairn

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #59 on: January 27, 2009, 03:35:33 pm »

Virex, you were wrong, but helped me figure out what the problem was anyway ;D

For initiating the character, I was putting the class name before the function instead of the object name. Part of your post mentioned it, and I realised what I'd done. Also, thanks about the health - I'd had it in before but removed it and forgot to replace it.
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.
Pages: 1 2 3 [4] 5 6 ... 72