Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 49 50 [51] 52 53 ... 796

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

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #750 on: January 21, 2012, 06:18:32 pm »

I figured the problem would be something like that - I'm redefining them, right?  Since it expects Methods to be defined in every subclass, I assumed it worked the same for values.

I can see how it works now.  I just have be sure of what I'm doing, cool.
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 #751 on: January 21, 2012, 06:23:59 pm »

Pretty much. You can also make abstract or virtual attributes, but only by virtue of c# doing the cool thing with the getters and setters.
Example:
Code: [Select]
    class Rectangle
    {
        private int width;
        private int height;

        public virtual int Width
        {
            get
            {
                return width;
            }
            set
            {
                this.width = value;
            }
        }
        public virtual int Height
        {
            get
            {
                return height;
            }
            set
            {
                this.height = value;
            }
        }
    }

    class Square : Rectangle
    {
        public override int Height
        {
            get
            {
                return Width;
            }
            set
            {
                this.Width = value;
            }
        }
    }

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #752 on: January 21, 2012, 06:40:30 pm »

FryMan's promises are LIES.

Give me any game concept (awesome is required)

Fix'd my post.
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #753 on: January 21, 2012, 10:03:12 pm »

I'll be interested in seeing your code some time Aqizzar. Know just how you are getting along, and if there is anything you are doing the hard way when there is a simple work around.

Aqizzar

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

I'll be interested in seeing your code some time Aqizzar. Know just how you are getting along, and if there is anything you are doing the hard way when there is a simple work around.

That's an interesting thing to proposition of your own accord.  I'll try to pack up a copy when I've cleaned up a few spots.

I've just moved into mobs "attacking" each other, which is an area that I have to fight myself tooth and nail to not let pre-designing for feature creep get in the way of actually writing it, and I know there's a few spots where I'm either making things too simple (and locking them off from future expansion without a serious rewrite), or places where I'm probably duplicating effort.  Not to mention buggy crap like my level generator.  I've actually been a bit distracted as my head of steam finally wears off, but I'll try to get the rest of the attack math actually working so mobs remove themselves or something, and then I'll give it a once over.

Stands to reason, now HP removal isn't working.  Hmm.
« Last Edit: January 21, 2012, 10:22:17 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.

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #755 on: January 21, 2012, 10:22:04 pm »

Well I am designing a library for a roguelike in c#, good to see how other people of all skill levels like to work, and what they might find useful beyond my own ideas.

Willfor

  • Bay Watcher
  • The great magmaman adventurer. I do it for hugs.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #756 on: January 21, 2012, 10:26:37 pm »

Well I am designing a library for a roguelike in c#, good to see how other people of all skill levels like to work, and what they might find useful beyond my own ideas.
Just don't make the same mistake as these guys did. That mistake being that they abandoned it.
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 /

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #757 on: January 21, 2012, 10:38:44 pm »

Well I am designing a library for a roguelike in c#, good to see how other people of all skill levels like to work, and what they might find useful beyond my own ideas.

In that case, I guess I might as well show you what I have going now, since that sounds like display stuff more than anything.  And maybe you'll see some glaring flaws I've overlooked.  For the record, I haven't started to implement your very helpful superclass/AI tutorial, since I'm still making the basic attack function work.

Hell, I'm having trouble making anything work here.  Every alteration seems to make something different start acting weird.
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 #758 on: January 22, 2012, 03:56:26 am »

Anybody here an old hat with SDL? Language is pretty irrelevant...

RulerOfNothing

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #759 on: January 22, 2012, 03:59:09 am »

Well, I think I am familiar enough with SDL, Max White. What do you need?
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #760 on: January 22, 2012, 04:05:40 am »

Working with surfaces.
Wait, surfaces are faster than sprites, right? I don't think I will require sprites, so keep it to a diet.
Anyway, I basically want a sort of pallet swap, but a little more complex. I will have a black, white and possibly all shades of grey in between surface and I want to pallet swap so that white becomes one color, black the second, and grey inbetween, relative to how dark or light it is.

kaijyuu

  • Bay Watcher
  • Hrm...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #761 on: January 22, 2012, 04:16:35 am »

Sprites ARE surfaces. Most anything you see in a SDL program is a surface.

As for palettes... honesty I never actually tried doing that. I moved on to opengl a while ago but I'm pretty sure there's no easy way to modify a palette for a SDL surface unless it's 8 bit color.

If you're modifying the surface dynamically, it's certainly possible, but that's going to be hellishly slow.

*looks things up*

Damn, I'm glad I switched to opengl when I did. SDL doesn't have RGB manipulation functions? I LIVE off those in my current project.

Maybe there's something I'm missing but I don't think there's a fast way to mess with the color of SDL surfaces. Your choices seem to be loading up multiple surfaces and switching between them, or doing some creative things with alpha.
Logged
Quote from: Chesterton
For, in order that men should resist injustice, something more is necessary than that they should think injustice unpleasant. They must think injustice absurd; above all, they must think it startling. They must retain the violence of a virgin astonishment. When the pessimist looks at any infamy, it is to him, after all, only a repetition of the infamy of existence. But the optimist sees injustice as something discordant and unexpected, and it stings him into action.

RulerOfNothing

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #762 on: January 22, 2012, 04:16:35 am »

I think one possibility is alpha-blending, so if you have all your greys having the same red,green and blue values then you can simply have the alpha channel to be 255-(other colour's channel), then simply blit the greyscale surface to a surface which is just one colour (the colour you want to have at various shades).By the way, my copy of the SDL documentation doesn't mention anything about sprites.
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #763 on: January 22, 2012, 04:21:53 am »

Sprites ARE surfaces. Most anything you see in a SDL program is a surface.
Then why can I declare either a sprite, or a surface? They might be similar in concept, but it seems that they have different implementation.

If you're modifying the surface dynamically, it's certainly possible, but that's going to be hellishly slow.
Hmm, I see. I wonder why it would be slow in SDL, but not OpenGL. It uses SDL does it not? What makes it so fast?

I think one possibility is alpha-blending, so if you have all your greys having the same red,green and blue values then you can simply have the alpha channel to be 255-(other colour's channel), then simply blit the greyscale surface to a surface which is just one colour (the colour you want to have at various shades).By the way, my copy of the SDL documentation doesn't mention anything about sprites.
Hmm, I could do that. Sounds like a bit of a bitch next to what I want, but meh.

So should I pack up shop and move to OpenGL before it is too late?

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #764 on: January 22, 2012, 04:23:21 am »

Boy, that sounds like some complicated stuff.

Anyway Max, if you still want it, here's the latest version of my experiment game.  I'm halfway through implementing attacks as an action, and for some reason mobs don't delete themselves like they're supposed to when they run out of HP, but don't worry about that.

As far as how it draws stuff to the console, that's mostly contained in the MainScreen class, with two main functions WriteAt and WriteThis, for single characters and line respectively - it takes in the character(s), start coordinates, and a color code.  Also, anything that moves or changes calls a function to redraw its own tile, so that the whole map isn't redrawn for every action.  This does mean mobs can blink when they move, but that's better than the whole map blinking.  I'm actually a lot more interested in a graphical library because C# console blows goats; the tiles don't seem to line up properly, so everything kinda draws one column over the tile next to it, makes walking around ugly as Hell because you leave vapor trails.

I'd be plenty happy to explain anything that you have a question about, although I tried to leave some actual greentext in to remind myself what everything is.  If you're on Steam, that'd make Q&A a lot easier.
« Last Edit: January 22, 2012, 04:25:23 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.
Pages: 1 ... 49 50 [51] 52 53 ... 796