Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 76 77 [78] 79 80 ... 796

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

kaijyuu

  • Bay Watcher
  • Hrm...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1155 on: February 02, 2012, 06:48:28 pm »

Personally I'd go with a linear scale, that way power boosts stay proportional. Boots of speed +1 given to a character with 10 speed would receive the same effective boost as a character with 100 speed getting boots of speed +10.

If you try to keep stuff giving the same boost at level 1 that it does at level 100, holy power creep batman.
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.

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #1156 on: February 02, 2012, 06:54:31 pm »

the simplest solution is to not make your minimum speed to be your base speed.

With a base of 10 or 20, the relative value of the first and second +5 is a lot closer than if you start from 1.
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.

Darvi

  • Bay Watcher
  • <Cript> Darvi is my wifi.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1157 on: February 02, 2012, 06:54:57 pm »

Yeah, I know that's how speed should work normally, but...
Let me put it this way: in a roguelike, the map is divided into discrete areas on a grid. So while speed 100 would normally be immediately and visibly faster than speed 95, on a roguelike map it's different.

In this case, it would mean that the two entities would move together for 19 spaces, then the slower of the two (95) would skip a turn while the faster would pull ahead. What this means in practice is that, if you have two entities with speed 1 and one of them finds +5 boots of swiftness, that one will immediately be six times faster than the other and leave it in the dust.

But with two 95s, we get the situation described above. That's my reasoning.
So you're looking for a speed system that isn't additive but multiplicative? You could use a logarithmic scale. Speed 2 is 2x as fast as speed 1, speed 3 is 2x as speed 2 et cetera. So if someone finds a +3 boots of speed, his speed is going to be 8 times as high, no mater what her base speed was (obviously you'll need to tweak the base to get sensible numbers)
That's actually exponential.
Logged

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1158 on: February 02, 2012, 07:53:49 pm »

It's called a logarithmic scale because plotting log(y) versus x yields a straight line. In an exponential scale, plotting e^y versus x would yield a straight line.
Logged

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1159 on: February 02, 2012, 07:56:21 pm »

I think I'm finally starting to understand C. In class today, I wrote a very simple program that would add, subtract, and multiply two user-input numbers, and didn't get a single error when building it. My best effort so far!  :)

Ok, it's not very impressive, but I certainly felt good about it!
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1160 on: February 02, 2012, 08:01:36 pm »

I think it is rather impressive. I mean here you are, taking the first steps on a very long journey, but you are making those steps. For many, the fundamental understanding of programming logic, and the idea that you need to tell the machine what to do, can be a bit much to tackle, so nice work!

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1161 on: February 02, 2012, 08:08:00 pm »

Very good, Sirus.  There's not much to get excited about in programming.  Your code compiling is definitely something to get excited about!  Understanding what's happening is a big step.
Logged

nenjin

  • Bay Watcher
  • Inscrubtable Exhortations of the Soul
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1162 on: February 02, 2012, 08:09:10 pm »

Question 'bout references.

When you've created a method that takes references as an argument, then call the function, has the reference initialization been handled in the function definition?

So:

Code: [Select]
void swap(int &x, int &y);

int main()
{
int x = 5, y = 10;

swap(x,y)

return 0;
}

void swap(int &rx, int &ry)
{

}

Have the references effectively been initialized to x and y via the "void swap (int &rx, int &ry)" statement? Versus putting "&r = x, &y = y" somewhere? This is one thing that has always thrown me about breaking up functions into prototypes and such. The arguments never read exactly the same and that confuses the hell out of me about what's being done.
« Last Edit: February 02, 2012, 08:12:53 pm by nenjin »
Logged
Cautivo del Milagro seamos, Penitente.
Quote from: Viktor Frankl
When we are no longer able to change a situation, we are challenged to change ourselves.
Quote from: Sindain
Its kinda silly to complain that a friendly NPC isn't a well designed boss fight.
Quote from: Eric Blank
How will I cheese now assholes?
Quote from: MrRoboto75
Always spaghetti, never forghetti

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1163 on: February 02, 2012, 08:11:02 pm »

Thanks for the words of confidence. The nice thing about this class is I was basically given Visual Studio 2010 for free. Legally! Now I can mess around with it at home as much as I want.
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

Gatleos

  • Bay Watcher
  • Mournhold... City of Light... City of MAGIC!
    • View Profile
    • Someone Sig This
Re: if self.isCoder(): post() #Programming Thread
« Reply #1164 on: February 02, 2012, 08:16:02 pm »

Have the references effectively been initialized to x and y via the "void swap (int &rx, int &ry)" statement? Versus putting "&r = x, &y = y" somewhere? This is one thing that has always thrown me about breaking up functions into prototypes and such. The arguments never read exactly the same and that confuses the hell out of me about what's being done.
The argument names in the prototype and definition of the function don't have to match, if that's what you're saying. All that has to match between the two is the function signature, consisting of the function name, argument types and return types.
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

nenjin

  • Bay Watcher
  • Inscrubtable Exhortations of the Soul
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1165 on: February 02, 2012, 08:21:34 pm »

Yeah, I knew that. It's just.....where have the references actually been declared in the code above? Int &x, Int &y say that references exist....but no where I can see have they actually been assigned to x and y. Does it just know that because x and y are passed to the function, and that because the function takes references, its working with references inside the function body?
« Last Edit: February 02, 2012, 08:23:15 pm by nenjin »
Logged
Cautivo del Milagro seamos, Penitente.
Quote from: Viktor Frankl
When we are no longer able to change a situation, we are challenged to change ourselves.
Quote from: Sindain
Its kinda silly to complain that a friendly NPC isn't a well designed boss fight.
Quote from: Eric Blank
How will I cheese now assholes?
Quote from: MrRoboto75
Always spaghetti, never forghetti

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1166 on: February 02, 2012, 08:22:06 pm »

Libtcod wants to do absolutely everything the hard way.  And I'm probably doing a lot of stupid shit, but I swear I'm ultimately saving myself time.

I just have to figure out when the right time to flush is.  Or however the Hell this works.
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 #1167 on: February 02, 2012, 08:25:25 pm »

Once at the end of your draw loop. Another good reason why you should separate your update and draw logic, it makes flushing a quick and simple process.
Also, now that MU is dead, anybody recommend a good upload site?

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1168 on: February 02, 2012, 08:33:02 pm »

Once at the end of your draw loop. Another good reason why you should separate your update and draw logic, it makes flushing a quick and simple process.
Also, now that MU is dead, anybody recommend a good upload site?

MediaFire, that's what I've been using.  Gets no love, and it's as good or better than MU was.  Not under investigation for racketeering either, as far as I know.

And actually, I'm keeping my drawing logic, in the Mainscreen class.  It adds some extra internal talking, but it simplifies writing the rest of the program for me, because I just pass it commands like MainScreen.WriteThis("Whatever", x, y, color) and it converts the color and writing into what the TCODConsole wants to hear and condenses the three or four different commands into one.  Dumb?  Maybe, I don't give up on old work easy.
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 #1169 on: February 02, 2012, 08:36:39 pm »

Yeah, I knew that. It's just.....where have the references actually been declared in the code above? Int &x, Int &y say that references exist....but no where I can see have they actually been assigned to x and y. Does it just know that because x and y are passed to the function, and that because the function takes references, its working with references inside the function body?
Well... yes. It would do the same with pointers. A reference to a variable can't exist unless it references something, so otherwise &x and &y would cause a compile error. And a function parameter is the declaration of a variable.
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
Pages: 1 ... 76 77 [78] 79 80 ... 796