Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 52 53 [54] 55 56 ... 796

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

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #796 on: January 22, 2012, 08:47:59 pm »

Quote
@Stargrasper: I'm a firm believer in duct tape programming. I don't consider any programming practice inherently good or bad, as there are always both good and bad ways to use it. If it works, use it. If it doesn't, don't. Calling something "good" or "bad" is a sign of ignorance and close-minded refusal to accept that anything can be used both properly and improperly.
Mind you, there ARE considerations beyond "does it work" that a person can consider when thinking of something as good or bad. Other considerations:
If I look at it later, will I be able to easily follow how it works?
Does it work efficiently?
Will I be able to modify it later as requirements change?
Is it modular - will I be able to reuse when solving future problems?
Is it easy to test?
Does it have a consistent API?
Will it work on systems other than the one I built it on?

moherfucker
Mwahaha. Was that supposed to be difficult, though? Or was I not supposed to do it in Ruby? ;)
« Last Edit: January 22, 2012, 08:49:44 pm by GlyphGryph »
Logged

Mego

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

I'm mainly talking about built-in features. Third-party libraries are a whole different story.

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #798 on: January 22, 2012, 08:52:57 pm »

Trust me, things get different when more than one person is working on a project. Duct tape doesn't cut it.

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #799 on: January 22, 2012, 09:00:53 pm »

Spoiler (click to show/hide)

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #800 on: January 22, 2012, 09:03:47 pm »

That is what you get for not making your static methods thread safe.  :P

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #801 on: January 22, 2012, 10:10:04 pm »

Finally got a triangle wave to work and was able to implement it in and it didn't work as well as the sine wave version.
I guess the sine wave version is going to work.
I really shouldn't be wasting time with gradients when I don't really have a use for it.  and I'm only on lesson 4 of my sdl tutorials.
been working on it for like 6 hours now, all sorts of different gradients and tests and stuff.  there goes most of my day wasted as I got nothing of note done.
well I started off with notes in a notebook of an algorithm I wrote last night and was able to get it fully working in SDL so it wasn't a total loss.
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #802 on: January 22, 2012, 11:18:52 pm »

Time spent learning what doesn't work is time well spent.
Logged

SolarShado

  • Bay Watcher
  • Psi-Blade => Your Back
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #803 on: January 22, 2012, 11:48:24 pm »

Finally got a triangle wave to work and was able to implement it in and it didn't work as well as the sine wave version.
I guess the sine wave version is going to work.
I really shouldn't be wasting time with gradients when I don't really have a use for it.  and I'm only on lesson 4 of my sdl tutorials.
been working on it for like 6 hours now, all sorts of different gradients and tests and stuff.  there goes most of my day wasted as I got nothing of note done.
well I started off with notes in a notebook of an algorithm I wrote last night and was able to get it fully working in SDL so it wasn't a total loss.

For gradient generation, have you tried linear interpolation? SDL might even have a ready made implementation, it's pretty commonly used in graphics.
Logged
Avid (rabid?) Linux user. Preferred flavor: Arch

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #804 on: January 23, 2012, 01:16:18 am »

I'll take another look at gradients when I finally have a use for them,
I spent the rest of the day learning to implement keypresses,
and started working on my first real game that doesn't take place in the console.
working on alpha blending right now, and tomorrow I get to tackle sprites, and by then I should have the first playable version of my first game.
it's a robot juggling game called Robo-Juggler, (a game where you are a robot who juggles, not a person who juggles robots)
it's coming along nicely.

Just figured out how to alpha blend.
« Last Edit: January 23, 2012, 02:01:31 am by Valid_Dark »
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #805 on: January 23, 2012, 07:12:09 pm »

Okay, folks, riddle me this.  Take a look at this code:

Code: [Select]
if (attack > dodge)
{
if (DAM > BLK)
if (target.currentHP > DAM)
target.currentHP -= (byte)DAM;
else
if (target is MobObject)
RemoveMob(target.mobX, target.mobY);
else
if (target.currentHP > 1)
target.currentHP -= 1;
else
target.currentHP = 0;

Where all of the variables have been defined.  The Objects "attacker" and "target" are both members of a Superclass which contains both the Player and all NPCs.  "currentHP" is a variable that all members of that Superclass possess, as it is defined in the Superclass.  This method can be called by both the Player and NPCs.  In practice, it does work when an NPC calls the method and it reduces the Player's currentHP (since as of now, the NPCs only ever target the Player).  When the player calls it on NPCs, it triggers but the NPC's currentHP never changes.  Why the Hell would that happen?
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.

Gatleos

  • Bay Watcher
  • Mournhold... City of Light... City of MAGIC!
    • View Profile
    • Someone Sig This
Re: if self.isCoder(): post() #Programming Thread
« Reply #806 on: January 23, 2012, 07:15:12 pm »

Is the player a global object?

Maybe you passed a copy of the NPC in instead of the object itself.
Logged
Think of it like Sim City, except with rival mayors that seek to destroy your citizens by arming legions of homeless people and sending them to attack you.
Quote from: Moonshadow101
it would be funny to see babies spontaneously combust
Gat HQ (Sigtext)
++U+U++ // ,.,.@UUUUUUUU

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #807 on: January 23, 2012, 07:18:13 pm »

Okay, folks, riddle me this.  Take a look at this code:

Code: [Select]
if (attack > dodge)
{
if (DAM > BLK)
if (target.currentHP > DAM)
target.currentHP -= (byte)DAM;
else
if (target is MobObject)
RemoveMob(target.mobX, target.mobY);
else
if (target.currentHP > 1)
target.currentHP -= 1;
else
target.currentHP = 0;

Where all of the variables have been defined.  The Objects "attacker" and "target" are both members of a Superclass which contains both the Player and all NPCs.  "currentHP" is a variable that all members of that Superclass possess, as it is defined in the Superclass.  This method can be called by both the Player and NPCs.  In practice, it does work when an NPC calls the method and it reduces the Player's currentHP (since as of now, the NPCs only ever target the Player).  When the player calls it on NPCs, it triggers but the NPC's currentHP never changes.  Why the Hell would that happen?

I would need to see the code for the player, npc and superclass... But i have seen issues like this when a subclass has a member with the same name as the superclass.
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #808 on: January 23, 2012, 07:21:02 pm »

I can assure you that I did not do this.  The PlayerObject and MobObject are inheritors of the SuperMob class.  I believe anyway.  Max White might see something I don't, since he has a copy of the code I'm looking at.

Is the player a global object?

Maybe you passed a copy of the NPC in instead of the object itself.

The Player is an object, a member of the same Superclass as the NPCs.  The attack method itself is part of the "map object" class.  Every NPCs is constructed with a reference value for the Player and the map object it is contained in (with a List<>).  When the NPC acts, it calls on its map's attack method, passing itself in as the (SuperMob attacker) and the player as the (SuperMob target).  When the player acts, the static program body calls the attack method from the currently-in-use map object, passing in the Player object and the referenced target, respectively.

If anything is being copied instead of called, then all my nightmares about Object references are coming true.
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 #809 on: January 23, 2012, 07:26:06 pm »

Hold on, code diving now. Let's see what we can bring up.
Pages: 1 ... 52 53 [54] 55 56 ... 796