Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 9 10 [11] 12 13 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 905722 times)

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #150 on: January 08, 2012, 03:18:56 am »

I suppose we should consolidate these various threads, but this one is more general programming oriented.  While this is a game I'm making, this is definitely a serious program error that I do not know how to fix.

I've been working all day on a map generator function for my roguelike, and it's... well it technically works, after commenting out huge blocks of the code, but it is already exposing something bad.  How it essentially works is that it first generates certain-sized arrays of random booleans.  This is then handed to the generator that iterates through the array, interpreting the length of the array (given to it) as how many sections to divide the screen (four is quarters for example, dividing the array in half for top/bottom), using the boolean to decide if it should draw a room there, according to some randomizing functions and hard-coded parameters.  I've only designed it to work with four, six, and eight sections, and everything about my math says that everything fits and is arranged as it should be.

Now like I said, it does technically work, but only with the quarters-array.  The sixth and eighth ones do terrible terrible things to the console.

Spoiler: Observe. (click to show/hide)

Note that I did not tell it to draw the second map with a different character and color, it chose to do that on its own.  I'm totally knackered after being at this for the better part of twelve hours, so I have no clue why this is breaking so badly, and the code is kinda large to post here.  I'm still going through it, but if anyone has any ideas, I'm all ears.

Aaaaaand in the way of programming, I just realized why it's probably going all pear shaped.  This is like the sixth time today I was about to post a "OH GOD HELP" question before powering through my error, and I just did it again.
« Last Edit: January 08, 2012, 03:20:34 am by Aqizzar »
Logged
And here is where my beef pops up like a looming awkward boner.
Please amplify your relaxed states.
Quote from: PTTG??
The ancients built these quote pyramids to forever store vast quantities of rage.

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #151 on: January 08, 2012, 03:26:34 am »

You'll get that a lot while programming.  General rule is that all errors are trivial.  So trivial, that we just can't find them. :P

From the sound of things, you did find the problem, right?  Or should I still be looking into it for you?
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #152 on: January 08, 2012, 03:27:28 am »

a map generator function for my roguelike, and it's... well it technically works
You have a problem with your algorithm. I think you already knew that.
However, in my current state, with what you have told me, I can't help you without seeing your code. I can think of several ways to get the output you have described off the top of my head, and each requires a different solution, so unless I know how you did things I'm just shooting a BB gun into the universe and hoping I hit a penny that is light years away.

Having said that, let me go get a cup of tea and think about it. If you really don't want to post any code, you might be on your own, but the fact that it changes the way it prints might be a clue.

Although don't think you need to post every class. Often just the level gen script will be enough. If you name things well, you can just sort of assume that the black box of an unseen class works. I do it every day.

Edit:
Aaaaaand in the way of programming, I just realized why it's probably going all pear shaped.  This is like the sixth time today I was about to post a "OH GOD HELP" question before powering through my error, and I just did it again.

Oh cool.
Yea, sometimes not thinking about the problem solves it. You would not believe how many times I have been trying to get to sleep, but keep having to get up to fix problems with my code that I just realised what I  need to do.

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #153 on: January 08, 2012, 03:43:17 am »

happens to me a lot too.

there is a lot of our thinking process as coders that just doesn't map anywhere near the knowledge theories and cognitive studies of today.
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #154 on: January 08, 2012, 04:06:03 am »

*Bored*
*Trying out libtcod for c#*

Holy shit this is a pile of crap. It just threw an exception.
No, I mean an exception. That was it's type, not it's super class, it was just an exception. Not even so much as a description. Something went wrong, but it doesn't want me to know what.

Is there documentation for this POS?

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #155 on: January 08, 2012, 04:15:24 am »

Please do troubleshoot it as much as you can.  So that those of us who have no idea what we're doing don't have to.

From the sound of things, you did find the problem, right?  Or should I still be looking into it for you?

The problem was I was so sick of looking at ifs and for-loops, I made the drawing function compatible for the quarter-array and said, "I'll make it work for everything else later", and then spent like an hour troubleshooting the boolean-check function (still not working).  I'm honestly impressed it drew the larger arrays at all without actually crashing.
Logged
And here is where my beef pops up like a looming awkward boner.
Please amplify your relaxed states.
Quote from: PTTG??
The ancients built these quote pyramids to forever store vast quantities of rage.

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #156 on: January 08, 2012, 04:20:19 am »

That was the plan.   :P
I think I got it now, there is a little @ guy wandering around an infinite sadness, forever without friends, food, clothing or fire. He will never know light, or hope, or happiness, just the endless void of black tiles. He's descendants that come later will know these luxuries, but he will never see these no matter how far he wanders. No, he just waits for me to close the window, and destroy all he has ever known.

As for as roguelike characters go, he is pretty well off.

Edit:
God.Damn(this);
I hate double handling. I wonder if I can just extend some of these things and...

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #157 on: January 08, 2012, 06:27:25 am »

double handling?
Logged

lordnincompoop

  • Bay Watcher
  • Allusionist
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #158 on: January 08, 2012, 06:59:40 am »

Libtcod is nice because it's got so many features that are directly relevant to roguelike developers, but the API (or whatever it's called) for C++ is an ugly bitch, and it doesn't seem to be very actively developed, either.

The last unstable version was released November 2010 (that's two years ago now!).
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #159 on: January 08, 2012, 07:04:59 am »

Imma getting there. You just gotta put things where they done need ta be!
Step 1. Make a game class.
Step 2. State patten on game class.

Fucking cleaned up that mess of interface options.

Willfor

  • Bay Watcher
  • The great magmaman adventurer. I do it for hugs.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #160 on: January 08, 2012, 10:43:59 am »

*Bored*
*Trying out libtcod for c#*

Holy shit this is a pile of crap. It just threw an exception.
No, I mean an exception. That was it's type, not it's super class, it was just an exception. Not even so much as a description. Something went wrong, but it doesn't want me to know what.

Is there documentation for this POS?
This is exactly what I was trying to say earlier. In older version of the C# wrapper they used to do the coding for it by hand, and it was still not the most easily understood library. [/understatement] Now they're porting it using some kind of automatic generator which only seems to exasperate the situation.

And the only good documentation I've been able to find is this: http://doryen.eptalys.net/data/libtcod/doc/1.5.1/index2.html?c=true&cpp=true&cs=true&py=true&lua=false
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 /

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #161 on: January 08, 2012, 12:33:36 pm »

*Bored*
*Trying out libtcod for c#*

Holy shit this is a pile of crap. It just threw an exception.
No, I mean an exception. That was it's type, not it's super class, it was just an exception. Not even so much as a description. Something went wrong, but it doesn't want me to know what.

Is there documentation for this POS?

I wish I had as much free time to kill as you.

Please do troubleshoot it as much as you can.  So that those of us who have no idea what we're doing don't have to.

From the sound of things, you did find the problem, right?  Or should I still be looking into it for you?

The problem was I was so sick of looking at ifs and for-loops, I made the drawing function compatible for the quarter-array and said, "I'll make it work for everything else later", and then spent like an hour troubleshooting the boolean-check function (still not working).  I'm honestly impressed it drew the larger arrays at all without actually crashing.

Glad you found the problem.  Ifs shouldn't be bad to look at, but if your loops are bothering you, you should consider whether whatever you're doing would be easier with recursion.  Anything and everything you can do with a loop, you can do with recursion.  Anything and everything you can do with recursion, you can do with a loop.  Typically, one is noticeably cleaner than the other.  Of course, in order to understand recursion, you must first understand recursion.

What is your boolean-check function doing versus what you want it doing?  Booleans usually aren't that bad to work with...

That was the plan.   :P
I think I got it now, there is a little @ guy wandering around an infinite sadness, forever without friends, food, clothing or fire. He will never know light, or hope, or happiness, just the endless void of black tiles. He's descendants that come later will know these luxuries, but he will never see these no matter how far he wanders. No, he just waits for me to close the window, and destroy all he has ever known.

As for as roguelike characters go, he is pretty well off.

Edit:
God.Damn(this);
I hate double handling. I wonder if I can just extend some of these things and...

Yeah, I hate doing that too.  That's why I can't stand jcurses or libjcsi.

In other news...

<twitch>
... ... ... must work on own project ... ... ...
<twitch>
... ... ... must play with C# ... ... ...
<twitch>
... ... ... must write more Java tutorial ... ... ...
<twitch>
... ... ... must fix twitch ... ... ...
<twitch>
Logged

Darvi

  • Bay Watcher
  • <Cript> Darvi is my wifi.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #162 on: January 08, 2012, 12:37:01 pm »

I have actually been prohibited to use recursion in my programming lessons. :V
Logged

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #163 on: January 08, 2012, 12:42:12 pm »

I have actually been prohibited to use recursion in my programming lessons. :V

By whom and why?  It's an incredibly useful technique that will crash the computer if you aren't careful with it.
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #164 on: January 08, 2012, 02:12:57 pm »

I have actually been prohibited to use recursion in my programming lessons. :V

By whom and why?  It's an incredibly useful technique that will crash the computer if you aren't careful with it.

That really describes any programming.

The first part of my C++ tutorial will follow this post.
Pages: 1 ... 9 10 [11] 12 13 ... 796