Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3

Author Topic: Roguelike Engine  (Read 7588 times)

Neonivek

  • Bay Watcher
    • View Profile
Re: Roguelike Engine
« Reply #15 on: July 21, 2011, 10:34:33 pm »

Quote
I was not aware

No problem I just wanted to say that your calling standard medieval fantasy cliche and inputting a different cliche (That oddly tends to make its way into standard medieval fantasy).
Logged

Angle

  • Bay Watcher
  • 39 Indigo Spear Questions the Poor
    • View Profile
    • Agora Forum Demo!
Re: Roguelike Engine
« Reply #16 on: September 18, 2011, 11:38:22 am »

Alright, so I've gotten this project to a point where I want to make a git repository for it. Only one problem. I've been using Code::Blocks, and so There isn't an easy way to use it with git. If I add the files to git, then there won't be a makefile, and so anyone who downloads it will have trouble. But I'm used to using Code::Blocks, and don't want to stop using it.

Hmm. It occurs to me that I could just maintain a makefile separately. Is there an easier way to do this though?

edit - meh whatever. I made a git repository, You'll need Code::Blocks to make use of the project though. That or write a makefile yourself.

https://github.com/Angular-Angel/Roguelike-Engine
« Last Edit: September 18, 2011, 10:11:43 pm by Angle »
Logged

Agora: open-source platform to facilitate complicated discussions between large numbers of people. Now with test site!

The Temple of the Elements: Quirky Dungeon Crawler

Gatleos

  • Bay Watcher
  • Mournhold... City of Light... City of MAGIC!
    • View Profile
    • Someone Sig This
Re: Roguelike Engine
« Reply #17 on: September 19, 2011, 01:44:47 am »

You may want to give CMake a try if you need to generate makefiles for multiple platforms. Anyway...

You have a class storing map data, and... there's a variable controlling rotation, and... maps keep track of bordering areas... I can't get it to build correctly on my machine, but I think I've got the gist of what you're trying to do here. It looks like you're making an engine that streams terrain onto the map and allows the map to rotate around the player...? I honestly have no idea.

Can you post a screenshot?
Logged
Think of it like Sim City, except with rival mayors that seek to destroy your citizens by arming legions of homeless people and sending them to attack you.
Quote from: Moonshadow101
it would be funny to see babies spontaneously combust
Gat HQ (Sigtext)
++U+U++ // ,.,.@UUUUUUUU

Angle

  • Bay Watcher
  • 39 Indigo Spear Questions the Poor
    • View Profile
    • Agora Forum Demo!
Re: Roguelike Engine
« Reply #18 on: September 19, 2011, 12:51:53 pm »

It uses ncurses, so it'll only work on systems that use linux. As for what it does, the LocalAreas store blocks of terrain. The border ares represent what other LocalAreas are next to a local are. I did it this way, instead of just having a large array or something, because this way I can bend space to my will. I can have a area lead back to itself, I can have a border be rotated, or flipped along either axis, I can have them on top of each other, like stairs, etc.

Spoiler: Screenshots! (click to show/hide)
Logged

Agora: open-source platform to facilitate complicated discussions between large numbers of people. Now with test site!

The Temple of the Elements: Quirky Dungeon Crawler

Gatleos

  • Bay Watcher
  • Mournhold... City of Light... City of MAGIC!
    • View Profile
    • Someone Sig This
Re: Roguelike Engine
« Reply #19 on: September 19, 2011, 02:47:17 pm »

Oh, I see. You're making a map system that stores the data of rooms individually, along with what rooms they're connected to. That way, they can be non-simply connected and you can make mind-fucking M.C. Escher architecture.

By the way, I think it would be worth it to switch to PDCurses. It'll compile on Windows and Unix platforms. That, and all the functions are exactly the same as ncurses, so you won't have to change any code.
Logged
Think of it like Sim City, except with rival mayors that seek to destroy your citizens by arming legions of homeless people and sending them to attack you.
Quote from: Moonshadow101
it would be funny to see babies spontaneously combust
Gat HQ (Sigtext)
++U+U++ // ,.,.@UUUUUUUU

Angle

  • Bay Watcher
  • 39 Indigo Spear Questions the Poor
    • View Profile
    • Agora Forum Demo!
Re: Roguelike Engine
« Reply #20 on: September 19, 2011, 03:34:04 pm »

Oh, I see. You're making a map system that stores the data of rooms individually, along with what rooms they're connected to. That way, they can be non-simply connected and you can make mind-fucking M.C. Escher architecture.
Yes, Exactly!

By the way, I think it would be worth it to switch to PDCurses. It'll compile on Windows and Unix platforms. That, and all the functions are exactly the same as ncurses, so you won't have to change any code.
Hmm, maybe. I'll look into it.
Logged

Agora: open-source platform to facilitate complicated discussions between large numbers of people. Now with test site!

The Temple of the Elements: Quirky Dungeon Crawler

nenjin

  • Bay Watcher
  • Inscrubtable Exhortations of the Soul
    • View Profile
Re: Roguelike Engine
« Reply #21 on: September 20, 2011, 06:32:54 am »

I'm just starting into C++ with the end goal of making a game, and reading all this has been really helpful for me to get a structural sense of how to set things up. Granted it's your way of setting it up and when I know more I may find other ways to do it. But as a documented example for someone who is starting to be able to read code, it's really useful for getting an idea of, for example, what the main.ccp of a functional game looks like.

So good luck and thanks for posting your code!
Logged
Cautivo del Milagro seamos, Penitente.
Quote from: Viktor Frankl
When we are no longer able to change a situation, we are challenged to change ourselves.
Quote from: Sindain
Its kinda silly to complain that a friendly NPC isn't a well designed boss fight.
Quote from: Eric Blank
How will I cheese now assholes?
Quote from: MrRoboto75
Always spaghetti, never forghetti

Angle

  • Bay Watcher
  • 39 Indigo Spear Questions the Poor
    • View Profile
    • Agora Forum Demo!
Re: Roguelike Engine
« Reply #22 on: September 20, 2011, 01:52:45 pm »

Well, the main.cpp is actually very different from what it will look like when finished. right now, it handles the content directly, when finished, it will mkostly just call other functions. this is just for testing right now. also, get the stuff from the github. the other stuff kinda sucks.
Logged

Agora: open-source platform to facilitate complicated discussions between large numbers of people. Now with test site!

The Temple of the Elements: Quirky Dungeon Crawler

nenjin

  • Bay Watcher
  • Inscrubtable Exhortations of the Soul
    • View Profile
Re: Roguelike Engine
« Reply #23 on: September 21, 2011, 05:04:04 am »

My bar for "functional" is pretty low at this point since I haven't written anything yet in C++ that is functional. So getting an idea how to logically arrange a guy that moves in a defined space, ect... very useful to me.
Logged
Cautivo del Milagro seamos, Penitente.
Quote from: Viktor Frankl
When we are no longer able to change a situation, we are challenged to change ourselves.
Quote from: Sindain
Its kinda silly to complain that a friendly NPC isn't a well designed boss fight.
Quote from: Eric Blank
How will I cheese now assholes?
Quote from: MrRoboto75
Always spaghetti, never forghetti

Angle

  • Bay Watcher
  • 39 Indigo Spear Questions the Poor
    • View Profile
    • Agora Forum Demo!
Re: Roguelike Engine
« Reply #24 on: January 02, 2012, 11:16:59 pm »

Alright, so I've ade a github repository and stuff. Right now, though, I'm stuck on line of sight. I'm not sure exactly what I'm doing wrong, so can someone Tell me? I think the problem is in Line.cpp, but I'm not certain. More general Constructive criticism is also appreciated. Also advice on how to go about debugging.
Logged

Agora: open-source platform to facilitate complicated discussions between large numbers of people. Now with test site!

The Temple of the Elements: Quirky Dungeon Crawler

Xegeth

  • Bay Watcher
    • View Profile
Re: Roguelike Engine
« Reply #25 on: January 07, 2012, 08:41:40 am »

I've had a look at your code and found a couple of bugs. The main problem you're having is in Line.ccp lines 55 and 76. If you remove the semicolon after the if statements, it should be able to actually add points to the line.

Secondly, you still have error checking code in Line::getX and Line::getY. You need to remove cerr and getch.

The third and final problem is the fact that Line::getX and Line::getY appear to sometimes return an absolute value of x and y, and sometimes return index which appears to be relative to the player. Unfortunately, even after fixing these, the game didn't seem to be working properly, but at least it seems to be a step closer.
« Last Edit: January 07, 2012, 08:44:46 am by Xegeth »
Logged

Angle

  • Bay Watcher
  • 39 Indigo Spear Questions the Poor
    • View Profile
    • Agora Forum Demo!
Re: Roguelike Engine
« Reply #26 on: January 07, 2012, 12:46:33 pm »

Semicolons after if statements? *Facepalm*

alright, lets see here...

Line::getX and Line::getY return index when it is determined that every step is going to move forward along their axis.

I think I forgot to add a bit of code to the other loop, though.
« Last Edit: January 07, 2012, 12:59:00 pm by Angle »
Logged

Agora: open-source platform to facilitate complicated discussions between large numbers of people. Now with test site!

The Temple of the Elements: Quirky Dungeon Crawler

Xegeth

  • Bay Watcher
    • View Profile
Re: Roguelike Engine
« Reply #27 on: January 07, 2012, 04:27:54 pm »

Line::getX and Line::getY return index when it is determined that every step is going to move forward along their axis.

That would be fine if it was consistent, but at the moment you are using both relative and absolute coordinates. If, as an example, the player is at (2,2) and you draw a line to (2,6), then using getX for each point returns 0, 1, 2, 3 and 4. On the other hand, in this example getY always returns the actual y coordinate of the player, 2. This is a problem because in Body::visionLine you use the sum "line.getY(i) + getLocation().getY()" so you end up drawing at twice the Y value you expect, but you get the expected results when you calculate X.

If you want to observe this for yourself, replace Body::getVision with this simplified version. The only two lines are a working diagonal line, and a broken horizontal line. The diagonal line uses index exclusively, but the horizontal line only uses index for x.

Code: [Select]
CharRaster Body::getVision(int width, int height)
{
    CharRaster vision(width, height);

    visionLine(vision, Line(location, location.getX() - getSightRange(), location.getY() - 4));
    visionLine(vision, Line(location, location.getX() - getSightRange(), location.getY()));

    vision.setCharAttr(getLocation().getX(), getLocation().getY(), getCharAttr(), getSymbol());
    return vision;
}
Logged

Angle

  • Bay Watcher
  • 39 Indigo Spear Questions the Poor
    • View Profile
    • Agora Forum Demo!
Re: Roguelike Engine
« Reply #28 on: January 07, 2012, 10:45:14 pm »

>_<

oh dammit. I'm going to have to go over every inch of that code with a magnifying glass, aren't I? arrrrgh.

Well, alright. In the morning.
Logged

Agora: open-source platform to facilitate complicated discussions between large numbers of people. Now with test site!

The Temple of the Elements: Quirky Dungeon Crawler

Gatleos

  • Bay Watcher
  • Mournhold... City of Light... City of MAGIC!
    • View Profile
    • Someone Sig This
Re: Roguelike Engine
« Reply #29 on: January 08, 2012, 05:06:37 pm »

You wouldn't happen to be making a Portal roguelike, would you Angle?

Because that's exactly the kind of game this engine would be useful for.
Logged
Think of it like Sim City, except with rival mayors that seek to destroy your citizens by arming legions of homeless people and sending them to attack you.
Quote from: Moonshadow101
it would be funny to see babies spontaneously combust
Gat HQ (Sigtext)
++U+U++ // ,.,.@UUUUUUUU
Pages: 1 [2] 3