Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 31 32 [33] 34 35 ... 795

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

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #480 on: January 12, 2012, 10:57:40 pm »

I got the number of rooms randomized like this:

Code: [Select]
public class RoomObject
{
int xLength;
int yLength;
MapTile[,] roomOut;

Random random; // just made it blank

public RoomObject(byte roomType, int xSize, int ySize, Random r) //added a Random parameter
{
xLength = xSize;
yLength = ySize;
roomOut = new MapTile[xSize,ySize];
random = r;  // assigned random here

DrawDefaultUndergroundRoom(xSize, ySize);
}
...

and then changing everything in MapGenerator to this:

Code: [Select]
roomIn = new RoomObject(0, xSize, ySize, random);
So essentially I'm just using the same old Random object that your map generator uses instead of making a new one for each Room.  This means the original random thing can keep its sequence of randomness going.


The doors seem to still be in the same relative locations, but I'm not sure if that was supposed to be that way.
« Last Edit: January 12, 2012, 11:01:06 pm by Levi »
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

Aqizzar

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

The doors seem to still be in the same relative locations, but I'm not sure if that was supposed to be that way.

No, if you can help it, because it looks really weird.  Is it at least placing different numbers of doors on different sides?  I really hope so.

I guess inheriting the Random was one thing I didn't try, because I didn't really know how that works, but it seems pretty obvious now.
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.

MaximumZero

  • Bay Watcher
  • Stare into the abyss.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #482 on: January 12, 2012, 11:12:09 pm »

Thanks all, I really appreciate all the advice. ^_^
Logged
  
Holy crap, why did I not start watching One Punch Man earlier? This is the best thing.
probably figured an autobiography wouldn't be interesting

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #483 on: January 12, 2012, 11:15:10 pm »

The doors seem to still be in the same relative locations, but I'm not sure if that was supposed to be that way.

No, if you can help it, because it looks really weird.  Is it at least placing different numbers of doors on different sides?  I really hope so.

Its putting between 0 and 1 doors on each side it seems.  I'll look a little further and see what I find.

Edit:  Oh wait, I think I see.
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #484 on: January 12, 2012, 11:19:01 pm »

Success!  Or probably close enough to success anyway.
Spoiler (click to show/hide)

I had forgotten to get rid of the other two
Code: [Select]
random = new Random(i); in AddDoors.   :P
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

Mego

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

Bravo, you spotted it before I did.

@Aqizzar: I'm under no obligation from you, yes, but I am under an obligation from my brain.

Stargrasper

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

Thanks all, I really appreciate all the advice. ^_^

And you decided what exactly?
Logged

Mego

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

I just took the time to read the summary of C++-11 features. The thing that stuck out to me the most is that C++ has a basic form of duck-typing through the auto keyword. Granted, that's not how it's supposed to be used, but screw that. I'll figure out a horrible abuse of auto and have some !!FUN!!.

fergus

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #488 on: January 13, 2012, 12:11:16 am »

I just took the time to read the summary of C++-11 features. The thing that stuck out to me the most is that C++ has a basic form of duck-typing through the auto keyword. Granted, that's not how it's supposed to be used, but screw that. I'll figure out a horrible abuse of auto and have some !!FUN!!.
How exactly? And isn't auto the default?
Logged
BY THE GODS! THIS QUOTE MADE MY SIG BOX HAVE A SCROLL BAR! HAPPY DAYS INDEED!
BY THE GODS! YOU HAVE TOO MANY SIGS!

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #489 on: January 13, 2012, 12:22:10 am »

Tired of being jerked around, I decided to look for other forms or reliable keyboard input, as libtcod does just not pull it's weight here.

Hey look, this seems good!
So why can't I access it? I try to add the reference to my project, but it isn't there! I can add a referance for 'System.Windows.Input.Manipulations;' but not just input, and as such the input namespace in empty for all but Manipulations. The fuck Microsoft?

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #490 on: January 13, 2012, 01:36:30 am »

Keep in mind, C++11's "auto" keyword is translated at compile time; using it won't slow down your program at all, though it will increase compile time a bit and make it more or less readable. Using it for 'int aNum;', less readable; using it for 'std::vector<std::map<std::string,myClass>>::iterator mapIterate', more readable.

@Max: If you can't include a reference directly to 'System.X.Y.Z' try adding a reference to 'System.X.Y' and work your way up the namespace chains until something works. Sometimes they want you to use something like System.Windows instead of System.Windows.Input.
If you do go the XNA route, it has its own keyboard input stuffs: http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.input.aspx

@MaximumZero: For graphics, there are multiple ways with C++, all of which I can guarantee you will learn a huge amount from but which may also be above the level of effort you want to put in.
First, there are C++ graphics APIs including DirectX, OpenGL, and SDL. From these, you will both fill in any gaps in your C++ knowledge, as they are pretty complex on that level, and you will get a really great understanding of the entire graphics programming pipeline. DirectX is Windows-only, but has a lot of really good tutorials, sample code, and msdn documentation. OpenGL is cross platform, though in my limited experience is rather difficult to learn simply because it has that sort of open source feel to it, where documentation is spread all over the place and there are a variety of very different versions and addons. I don't have any experience with SDL though.

The second option for C++ is learning managed C++ and using XNA through CLR. XNA is essentially a simplified wrapper for DirectX, primarily for C#. Managed C++, at its core, is C++ which does automated garbage collection. CLI/CLR is part of Microsoft's .NET framework which pretty much allows you to program in any of several different languages and have it compiled into your program. (not recommended; managed C++ is a pain in the rear, slow, and you would essentially be doing C# anyway)

Or if you are willing to learn another language for it, C# and XNA are a pretty good starting point, and I would recommend looking into those, as they let you get a foot in the door of more advanced stuff like DirectX without introducing conceptually complicated things like HLSL vertex and pixel shaders or the details of the rendering pipeline.

@MaximumZero AND Everyone else:
Awesome tutorials, particularly for DirectX graphics programming with C++ can be found at the link below, if you do choose to go down that road. Full source code and tutorials with a quality to which I have yet to find a worthy challenger.
http://www.rastertek.com/tutindex.html
« Last Edit: January 13, 2012, 01:57:39 am by alway »
Logged

MaximumZero

  • Bay Watcher
  • Stare into the abyss.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #491 on: January 13, 2012, 01:45:20 am »

Thanks all, I really appreciate all the advice. ^_^

And you decided what exactly?
To comb through all of it when I have more time and patience.
Logged
  
Holy crap, why did I not start watching One Punch Man earlier? This is the best thing.
probably figured an autobiography wouldn't be interesting

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #492 on: January 13, 2012, 04:46:50 am »

Ladies and gentlemen, I have had enough to drink that right now were it not for a spell checker, I would be fucked, as such...

How to program while dunk
Firstly, make a copy of your project before you make any changes.
Secondly, go for your life!

Let's see if I can make this really cool things with rooms work. If I can, I will post code. I know Aquizar has a use for this, and anybody else making a RL might have a vested interest. Seriously, you will drool over what I hope to give you.

MaximumZero

  • Bay Watcher
  • Stare into the abyss.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #493 on: January 13, 2012, 04:49:08 am »

You must be drunk. You spelled Aqizzar with a u and only one z. Even I never butchered it that badly.
Logged
  
Holy crap, why did I not start watching One Punch Man earlier? This is the best thing.
probably figured an autobiography wouldn't be interesting

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #494 on: January 13, 2012, 05:00:42 am »

Spell check doesn't handle names.


Protip: The above sentence contained four spelling errors before spell check.
Pages: 1 ... 31 32 [33] 34 35 ... 795