Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 36 37 [38] 39 40 ... 796

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

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #555 on: January 14, 2012, 06:49:31 am »

That's a pretty ingenious method of room creation that I may have to steal at some point.  So, is the issue resolved?  I don't see where the problem would be coming in, if it manages to work at all.
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 #556 on: January 14, 2012, 06:51:55 am »

I don't see where the problem would be coming in

That is the problem.

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #557 on: January 14, 2012, 06:53:45 am »

I don't see where the problem would be coming in

That is the problem.

Yeah, welcome to the last three days of my life.  Throwing the offending code onto the web for others to examine worked gangbusters for me, you might as well give the thread a looksie.  I mean, I'm totally useless to you no matter what the situation is, but somebody else might see it.  Nothing helps untangle a programming not like an outsider's perspective, it's like any other art.
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 #558 on: January 14, 2012, 06:57:19 am »

Well all right, hold on a second.

A golden cookie to who ever can tell me where I broke the 'Don't talk to strangers' pattern! Yes it is in there, and I know I will need to fix it once lighting is involved.

EDIT:
Link

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #559 on: January 14, 2012, 09:26:20 am »

Code: [Select]
        public override int Height
        {
            get
            {
                return width;
            }
        }

        public override int Width
        {
            get
            {
                return height;
            }
        }

Are you really sure about this?
Logged

Mego

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

Code: [Select]
        public override int Height
        {
            get
            {
                return width;
            }
        }

        public override int Width
        {
            get
            {
                return height;
            }
        }

Are you really sure about this?

[insert lolwut.jpg here]

Yeah, I think that's a problem.

lordnincompoop

  • Bay Watcher
  • Allusionist
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #561 on: January 14, 2012, 12:29:46 pm »

If anybody is interested in just what I am trying to do, basically it starts by making a single large room, as shown
Spoiler (click to show/hide)
That room then splits itself along one of its axis at a random spot, and makes two smaller rooms on either side, with a wall going down the middle.
Spoiler (click to show/hide)
These two rooms then do the exact same thing, split into smaller rooms with another wall between them.
Spoiler (click to show/hide)
Keep going for a few more rooms, until it starts to look a bit like a level.
Spoiler (click to show/hide)
Then each room places a door randomly along its wall. It dosn't matter where the door is placed, because of the room structure each and every room will be accessible.
Spoiler (click to show/hide)

Problem: No corridors.
Logged

Darvi

  • Bay Watcher
  • <Cript> Darvi is my wifi.
    • View Profile
Logged

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #563 on: January 14, 2012, 12:30:50 pm »

Are you really sure about this?

[insert lolwut.jpg here]

Max is going to facepalm his skull out.  Well, we've all been there.

So, I'm suddenly thinking building, placing, controlling, and interacting with enemies is going to be ludicrously difficult.  Gotta break this down.
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.

Darvi

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

Ah, case sensitivity. Love it and hate it.

So, I'm suddenly thinking building, placing, controlling, and interacting with enemies is going to be ludicrously difficult.  Gotta break this down.
I think writing an enemy class would be a good start.
Logged

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #565 on: January 14, 2012, 04:08:18 pm »

Ah, case sensitivity. Love it and hate it.

I have a feeling that was not the problem.

Looking at my roguelike, I just realized one reason that the program might have such a long and stuttering lead time.  It's not so much C#'s fault (aside from the Console drawing), as that a left over bit of code from my original map generator implementation meant that when a new map was initialized at the start of the program, it wasn't generating a map.  It was generating 1239 of them.  While there is a performance improvement, I'm actually quite impressed at how little speed difference there was.


Okay, real issue this time, for anyone who knows C# standard objects.  I'm using the generic LinkedList<> construction, and I want to be able to call a specific object by its position in the list.  In lieu of an included method to do that (as I can't seem to find one), I'm trying the brute force way.
Code: [Select]
MobObject[] mobs = new MobObject[mobList.Count];
mobList.CopyTo(mobs);
return mobs[mobNumber].GetLocation();

Compiling this throws an error for the second line: "No overload for method 'CopyTo' takes 1 arguments (CS1501)".  Even though I have the exact same sort of construction (with an array of ints instead of objects) elsewhere in the code and it works fine.  (And yes, mobList is already initialized elsewhere in the code, before it hits this.)  What am I not doing right here?  And better question, is there a simpler way to do this that I haven't found in MSDN?

Nevermind, screw it.  I was actually using the List<> class before, not LinkedList<>.  Holy crap, why is that even a concern?  Still, List<> doesn't seem to generate its own numbering either, so I'm still using the brute force array-conversion method.  There's probably a better way to do this.
« Last Edit: January 14, 2012, 04:56:36 pm 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.

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #566 on: January 14, 2012, 04:57:10 pm »

I'm using the generic LinkedList<> construction, and I want to be able to call a specific object by its position in the list.
Use a vector instead? This is not what lists are for... And the position is never guaranteed: if one earlier is deleted, the position of an element is altered. Don't do eeet! What you could do is just loop the list with a counter and an iterator?
Code: [Select]
while (i != mobNumber) { i++; mob = mobListIterator.next(); }

DLL hell evaded: I had updated my compiler but not the DLL. *phew*
Now I'm procrastinating on writing mesh management and shapefinder. Maybe I'll just add that database I always wanted.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Derekristow

  • Bay Watcher
    • View Profile
    • Steam ID
Re: if self.isCoder(): post() #Programming Thread
« Reply #567 on: January 14, 2012, 06:18:26 pm »

You can access a specific position in a List in the same way you would an array: MyList[element#].  LinkedList doesn't have this ability though.  The main strength of a linked list is that you can add and remove objects from arbitrary positions in the list easily.  If you frequently need to access the data in the linked list out-of order, a List would be better.

This is where I got my information from, they say it better.
Logged
So my crundles are staying intact unless they're newly spawned... until they are exposed to anything that isn't at room temperature.  This mostly seems to mean blood, specifically, their own.  Then they go poof very quickly.

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #568 on: January 14, 2012, 08:55:50 pm »

Code: [Select]
        public override int Height
        {
            get
            {
                return width;
            }
        }

        public override int Width
        {
            get
            {
                return height;
            }
        }

Are you really sure about this?
Nice find, and I thank you, but this was not the cause of my headaches. No, this was more of a place holder anyway while I try to got it to work... Originally it was

Code: [Select]
        public override int Height
        {
            get
            {
                return room1.Height+ room1.Height;
            }
        }

        public override int Width
        {
            get
            {
                return room1.Width + room1.Width;
            }
        }

Still, thank you for the find.

Okay, real issue this time, for anyone who knows C# standard objects.  I'm using the generic LinkedList<> construction, and I want to be able to call a specific object by its position in the list.  In lieu of an included method to do that (as I can't seem to find one), I'm trying the brute force way.
Code: [Select]
MobObject[] mobs = new MobObject[mobList.Count];
mobList.CopyTo(mobs);
return mobs[mobNumber].GetLocation();

Compiling this throws an error for the second line: "No overload for method 'CopyTo' takes 1 arguments (CS1501)".  Even though I have the exact same sort of construction (with an array of ints instead of objects) elsewhere in the code and it works fine.  (And yes, mobList is already initialized elsewhere in the code, before it hits this.)  What am I not doing right here?  And better question, is there a simpler way to do this that I haven't found in MSDN?

Nevermind, screw it.  I was actually using the List<> class before, not LinkedList<>.  Holy crap, why is that even a concern?  Still, List<> doesn't seem to generate its own numbering either, so I'm still using the brute force array-conversion method.  There's probably a better way to do this.

If you ever feel the need for an array, then on both LinkedLists and Lists you can call a method called .ToArray() that will return an array of objects the right size.

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #569 on: January 14, 2012, 10:47:18 pm »

Thanks for the tip, that'll at least make my code look a little better.  I would like to at least appear to know what I'm doing.


The real confusion comes from having to shuttle information in and out of the main program body, through the map object and it's list of objects in the map, and then turn that information back around and send it to the Console, all without refreshing the screen every cycle.

I suppose the sensible thing to do next would be to eliminate them from the lists and update the screen.  Then make the guys move around.  Then make them only move when I take a valid action.  Then I can move onto more high level reactions.  Perhaps the most critical lesson in programming, besides inspect every goddamn letter, is to take nothing for granted.  There is no such thing as a small task, and you must inform the program of every single meticulous step involved in every single action.  You must become one with the machine.
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.
Pages: 1 ... 36 37 [38] 39 40 ... 796