Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 29 30 [31] 32 33 ... 72

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

Rsugar

  • Bay Watcher
  • Newbie Programmer\Graphics Artist
    • View Profile
Re: The Roguelike Development Megathread
« Reply #450 on: July 18, 2009, 04:16:54 pm »

oh god, map generation is still a bitch. Right now I've just been working on a menu system, an in-game map "editor", which is more along the lines of placing walls or floor adjacent to the player, and fixing a ton of stuff that needed fixing, like infinite loops and re-iterations that shouldn't exist.

But when I took a look at all of the possible map generation implementations in the articles at roguebasin, my head couldn't quite process all of the math.

Right now I'm trying to go back to all of the math I learned in 11th grade, which was the last time I had a match class (Geometry+basic trig+algebra all in a Geometry class), which was two years ago.

Believe me when I tell you that coding is addicting and not being able to figure things out is really upsetting.
Logged
"Hey baby, Want to see my mine shaft?"
"oooh...is it long and rough?"

Zironic

  • Bay Watcher
  • [SDRAW_KCAB]
    • View Profile
Re: The Roguelike Development Megathread
« Reply #451 on: July 18, 2009, 05:15:36 pm »

I get mad. Stare at a wall. Then usually come to the conclusion: What I am doing is too complex.

Right now Im trying to figure out how to make characters move. It's upsetting to say the least. It's SMASH SMASH SMASH to say the most.
Logged

Rsugar

  • Bay Watcher
  • Newbie Programmer\Graphics Artist
    • View Profile
Re: The Roguelike Development Megathread
« Reply #452 on: July 18, 2009, 05:45:08 pm »

Zironic, feel free to post your code in the thread and ask for help. I'd be glad to assist you.
that is, if you're using c++.
Plus more coders working together means problems are solved more easily.
Logged
"Hey baby, Want to see my mine shaft?"
"oooh...is it long and rough?"

Willfor

  • Bay Watcher
  • The great magmaman adventurer. I do it for hugs.
    • View Profile
Re: The Roguelike Development Megathread
« Reply #453 on: July 18, 2009, 07:35:35 pm »

oh god, map generation is still a bitch. Right now I've just been working on a menu system, an in-game map "editor", which is more along the lines of placing walls or floor adjacent to the player, and fixing a ton of stuff that needed fixing, like infinite loops and re-iterations that shouldn't exist.

But when I took a look at all of the possible map generation implementations in the articles at roguebasin, my head couldn't quite process all of the math.

Right now I'm trying to go back to all of the math I learned in 11th grade, which was the last time I had a match class (Geometry+basic trig+algebra all in a Geometry class), which was two years ago.

Believe me when I tell you that coding is addicting and not being able to figure things out is really upsetting.

I feel your pain. Actually, it might be a little worse. I was homeschooled, and I consider the math portion of my education to be a little gimped in the first place. (not because of the curriculum, but because I was entirely unwilling to learn) Pretty much everything I know about geometry has been learned outside of school.

I guess the one advantage I gained is the ability to sit myself down and learn something if I am motivated to do it. Though a lot of people have that anyway.
Logged
In the wells of livestock vans with shells and garden sands /
Iron mixed with oxygen as per the laws of chemistry and chance /
A shape was roughly human, it was only roughly human /
Apparition eyes / Apparition eyes / Knock, apparition, knock / Eyes, apparition eyes /

Alexhans

  • Bay Watcher
  • This is toodamn shortto write something meaningful
    • View Profile
    • Osteopatia y Neurotonia
Re: The Roguelike Development Megathread
« Reply #454 on: July 19, 2009, 02:29:33 pm »

Rhodan... the pic looks awesome... how was the nebulae created?
Logged
“Eight years was awesome and I was famous and I was powerful" - George W. Bush.

Rhodan

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #455 on: July 20, 2009, 01:02:11 am »

I used perlin noise for those.  4 layers of it, even.  Might be doable with less.
This article gave me the idea to use nebulae and explains how to do it: http://aave.phatcode.net/ascii/?Infiniverse:Articles:Creating_nebulae

The latest version of the background has a 3 types of stars: a dot, an ore and a rough gem. (in DF symbols)  It gives a lot of extra depth and variation, I'm very happy with the result.  I also use a seeded generator so I can generate the same background when replaying a level.  Things like planets and background asteroids would be a nice addition.

I also managed to store the ships in a dynamic array so collision detection is almost there.  I think I can pull off localized damage, too!  Should make bosses a lot easier.

I use libtcod for all of this, by the way.  It provides a 32-bit colour console with a lot of handy stuff such as colour blending, printing to offscreen consoles and blitting them with a fade effect, random generators, noise generators, pathfinding, linedrawing, keyboard and mouse support and much more.  I love it.
« Last Edit: July 20, 2009, 07:46:42 am by Rhodan »
Logged

Singularity

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #456 on: July 20, 2009, 02:51:46 pm »

Hate to butt in here with a request for programming help, but I'm pretty stuck here. I'm using C++ and libtcod.

So I want a two-dimensional array to store my map.  However, I want this array in my Level class... and I want to pass the dimensions of the array in when I instantiate the class.  It won't compile when I try this, unfortunately.  Is it impossible to define array dimensions at runtime? Or am I missing something obvious here?  ???
Logged

Keiseth

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #457 on: July 20, 2009, 03:03:15 pm »

Huzzah.

It's been way too long since I used C++, so I don't want to say much in fear of leading you the wrong way... but in general I found two dimensional arrays to be kind of awkward. They're not truly two dimensional anyway, it's just sort of a mental and visual aid.

What I do (with no guarantee that this is the most efficient way) is declare a one dimensional array with functions or methods to access it in a way you can look at in two dimensions.

I can declare the array as "32 * 32" in length, then use a function that requires two coordinates and returns the position I want. Anything on the X axis is worth "1", and anything on the Y axis is worth the width of the map, say... 32. So (0, 1) is 32, (1, 1) is 33, and (1, 2) is 65. When done this way, past making the functions to do this, you never actually have to deal with your map in one dimension unless you choose to.

I say this only because I had some strange problems with two dimensional (or so) arrays in C++, and thought this was a more convenient solution (for myself, at least.) Hope it helped in some way.
Logged

Andir

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #458 on: July 20, 2009, 03:21:34 pm »

Huzzah.

It's been way too long since I used C++, so I don't want to say much in fear of leading you the wrong way... but in general I found two dimensional arrays to be kind of awkward. They're not truly two dimensional anyway, it's just sort of a mental and visual aid.

What I do (with no guarantee that this is the most efficient way) is declare a one dimensional array with functions or methods to access it in a way you can look at in two dimensions.

I can declare the array as "32 * 32" in length, then use a function that requires two coordinates and returns the position I want. Anything on the X axis is worth "1", and anything on the Y axis is worth the width of the map, say... 32. So (0, 1) is 32, (1, 1) is 33, and (1, 2) is 65. When done this way, past making the functions to do this, you never actually have to deal with your map in one dimension unless you choose to.

I say this only because I had some strange problems with two dimensional (or so) arrays in C++, and thought this was a more convenient solution (for myself, at least.) Hope it helped in some way.
That's essentially how all multi-dimensional arrays work anyway. ;)
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."

Rhodan

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #459 on: July 20, 2009, 04:07:39 pm »

There's two ways to have a dynamic 2-dimensional array.
The first one is a single dynamic array of size (cols * rows) and just use [x + (y * width)] to get a value from it.  You don't need any extra classes or functions to make this work, as it's easy enough once you understand it.  I use this to contain ship designs.  I'm guessing this also works for 3D arrays, using size (cols * rows * slices) and [x + (y * cols) + (z * slices)].

The second one is declaring a dynamic array of pointers to other dynamic arrays.  Which is very complicated and not as fast as the above method.  The only use for this is if you want to store a list of arrays of variable length, like an array of strings.

Even if you use fixed arrays, a 1D array is faster than a 2D array.  This mostly matters when using huge or frequently addressed arrays, of course.

Oh, and dynamic arrays work like this:
Code: [Select]
int *PointerToMyArray = NULL;
PointerToMyArray  = new int[size];
for(int i = 0;i < size;i ++) PointerToMyArray[î]  = 0;
Logged

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: The Roguelike Development Megathread
« Reply #460 on: July 20, 2009, 06:54:47 pm »

Unless you use the C method, malloc(), but then it's an even greater mess...
Logged
Eh?
Eh!

Zironic

  • Bay Watcher
  • [SDRAW_KCAB]
    • View Profile
Re: The Roguelike Development Megathread
« Reply #461 on: July 20, 2009, 07:07:59 pm »

Zironic, feel free to post your code in the thread and ask for help. I'd be glad to assist you.
that is, if you're using c++.
Plus more coders working together means problems are solved more easily.

The problem is, I was using a guide, so my product right now is semi following his instructions - and a little beyond. I just need to find out what resulting number Getch() gives for the arrow keys.
Logged

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: The Roguelike Development Megathread
« Reply #462 on: July 20, 2009, 09:39:58 pm »

while(1)cout << (int)getch();
Logged
Eh?
Eh!

Rhodan

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #463 on: July 21, 2009, 03:04:18 am »

Writing small tools to check keyboard input or test stuff is very useful and makes for good practice.

Anyways, gameplay concern:
How should I implement localized damage?  Since it's 2D, the ship would just get eaten away from the front, making it useful to put everything on the back of the ship and just put crap in front.
This makes for non-pretty ships.  Taking away some realism allows for greater creativity.

Perhaps bullets should hit a random spot along the length of the ship, so it gets hit from the sides?  I could also make shields more important, so you're already as good as dead when your bits get shot off.
Logged

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: The Roguelike Development Megathread
« Reply #464 on: July 21, 2009, 07:02:45 am »

How about each bit has a 50/50 chance of being hit, otherwise it goes on to the next?

Or maybe enemies coming from the sides, to force critical components inwards, like a real ship?

A hull piece that is reinforced by a massively power consuming object, but pushes the bullet up or down a row?

There are as many solutions as you can think of!
Logged
Eh?
Eh!
Pages: 1 ... 29 30 [31] 32 33 ... 72