Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 239 240 [241] 242 243 ... 796

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

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3600 on: December 10, 2012, 01:36:53 pm »

Isn't D&D the game where there's a DM who says "And now all traps are powered by gremlins and work the way I want to instead of the rulebook" all the time? It's not MTG...

But I might be mistaken, last ruleset I played was from before WotC.
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))

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3601 on: December 10, 2012, 02:22:11 pm »

Isn't D&D the game where there's a DM who says "And now all traps are powered by gremlins and work the way I want to instead of the rulebook" all the time? It's not MTG...

But I might be mistaken, last ruleset I played was from before WotC.

Nope, that's entirely accurate.

Soadreqm

  • Bay Watcher
  • I'm okay with this. I'm okay with a lot of things.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3602 on: December 13, 2012, 04:00:18 pm »

This is kind of a theory question, and might even belong in the math thread. I'm trying to work something out for Dungeons and Dragons shenanigans, so obeying physical laws isn't strictly necessary (we're allowed to have stuff happen instantaneously, for instance, rather than having a minimum length of time).

If you have a recursive operation with no base case, instantaneous (or, in other words, length 0 time) execution of each iteration of that operation, and a finite amount of time over which it is executed (6 seconds in this case, but it should be unnecessary to specify), how many iterations execute by the end of that time?

Expanding on MadocComadrin's answer, if the casting happens and repeats instantaneously, in length zero time, you will reach infinity iterations in any nonzero time. This has some rather interesting implications. For starters, the mage hand triggering of the second trap probably involves some manner of movement, yes? I don't know how mage hands work, but I'm picturing an ethereal glowing hand moving up and down on a lever like it's trying to start a wank fire. Well, it DOES start a wank fire, and a big one at that. Since the hand is triggering the trap INFINITY times per second, it is necessarily moving infinitely fast, thus creating an infinite amount of friction, feeding an infinite amount of thermal energy into the system. What this would mean in real-world physics is something of a mystery, but it would presumably increase the temperature of the trigger so high that the concept of "temperature" would no longer exist, and the traps, the dungeon and the adventurers would all be broken into whatever particle-equivalents could exist at such energy levels.

Each of these particles, lets call them "doomlets", would have infinite energy, and they would expand in a sphere at the speed of light, never slowing down. Every particle of mundane matter they interact with, assuming some form of particle interaction is possible, would turn into more infinite-energy doomlets, thus destroying the entire Prime Material Plane, and everything connected to it in a manner that allows the passage of doomlets.

It's also quite possible that our doomlets will not be able to interact with normal matter. In this case, the trap's operational parts will simply vanish from existence, with or without a fireball of unknown size. Who knows.

This would also happen if the spell itself outputs any amount of energy. Does it form a physical bolt of some kind, that displaces matter or glows even slightly? Does it make even the faintest of sounds? That's also infinite energy. If the magic leaves some kind of trace that does not affect the physical world in any way but is detectable by other wizards, this trace is multiplied infinifold. I doubt the true nature of magic in DnD is clear enough for the results of this to be defined, but plausible effects might include:
  • Total destruction of multiverse, as before
  • Magic completely disappearing from multiverse
  • Every magic user in the multiverse suddenly dying
  • Every creature in the multiverse suddenly dying
  • Every creature in the multiverse gaining the casting ability of a level infinity sorcerer
  • Anything else. It's MAGIC for Mystra's sake!
So, before making things happen infinity times per turn, you should remember that the GM has many ways to screw you over if he so wishes. You'll only have yourself to blame for the resulting total party kill of cosmic proportions. :)
Logged

MadocComadrin

  • Bay Watcher
  • A mysterious laboratory goblin!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3603 on: December 13, 2012, 04:29:13 pm »

Screw the Higgs Boson; I'm going to go take over the LHC and start looking for some doomlets!
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3604 on: December 13, 2012, 05:57:41 pm »

So, before making things happen infinity times per turn, you should remember that the GM has many ways to screw you over if he so wishes. You'll only have yourself to blame for the resulting total party kill of cosmic proportions. :)

I'm pretty sure that a giant fireball of doomlets that destroy everything in existence still counts as a victory for the party, even especially if it results in a TPK.

Also this would be a good question for "XKCD What If?".

Soadreqm

  • Bay Watcher
  • I'm okay with this. I'm okay with a lot of things.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3605 on: December 13, 2012, 06:02:09 pm »

I admit, you'd probably get MAD experience for destroying the entire multiverse.
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3606 on: December 16, 2012, 10:04:55 pm »

Anybody know any good articles/tutorials/papers/otherwise on generating different types of noise, be it perlin, simplex, wavelet or otherwise. Basically I am trying to generate land mass and oceans, but right now things look pretty much like this:
Spoiler (click to show/hide)
Not exactly realistic is it?
So, anybody know how god did it?

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3607 on: December 16, 2012, 10:15:31 pm »

Toady actually talked about that in his recent interview. He says that you need to do some "massaging"--start with the noise, then do finer noise, and so on until you have something good as a result. Have some parameters for rejection and BAM, worlds.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #3608 on: December 16, 2012, 10:24:57 pm »

Search for libnoise: it had a pretty okay-looking guide for generating rndom terrain, even if you don't use that library.

Anyone here use Gwen (GUI) for Allegro? I'm trying toget it work, but while following the sample's code, my IDE colors Gwen::Skin::TextureBase as a non-existing member of Gwen::Skin. I have a soft but still existent deadline, and would appreciate it if anyone can point me towards somewhere I could get help, or tell me the problem >_<
Might have to look at the source...
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3609 on: December 16, 2012, 11:00:24 pm »

Toady actually talked about that in his recent interview. He says that you need to do some "massaging"--start with the noise, then do finer noise, and so on until you have something good as a result. Have some parameters for rejection and BAM, worlds.
Interesting stuff! I never knew DF actually had winds!
Cool that he doesn't even use a noise function...

Search for libnoise: it had a pretty okay-looking guide for generating rndom terrain, even if you don't use that library.

Anyone here use Gwen (GUI) for Allegro? I'm trying toget it work, but while following the sample's code, my IDE colors Gwen::Skin::TextureBase as a non-existing member of Gwen::Skin. I have a soft but still existent deadline, and would appreciate it if anyone can point me towards somewhere I could get help, or tell me the problem >_<
Might have to look at the source...
Hmm, looks like it might be useful...

MadocComadrin

  • Bay Watcher
  • A mysterious laboratory goblin!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3610 on: December 17, 2012, 02:47:08 pm »

Also this would be a good question for "XKCD What If?".

I'm pretty sure firey balls of doomlets have appeared in at least two of them so far.
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3611 on: December 19, 2012, 11:19:45 pm »

Ok, so with my current understanding of interpolating colors, the quick and easy way for two colors and a coef is
red = color1.red + (color2.red - color1.red) * coef
green = color1.green + (color2.green - color1.green ) * coef
blue = color1.blue + (color2.blue - color1.blue ) * coef

This seems to work out pretty damn well, but now I need to interpolate multiple colors, each with their own weight. Anybody know the fastest way to do this?

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3612 on: December 20, 2012, 12:29:48 am »

Ok, so with my current understanding of interpolating colors, the quick and easy way for two colors and a coef is
red = color1.red + (color2.red - color1.red) * coef
green = color1.green + (color2.green - color1.green ) * coef
blue = color1.blue + (color2.blue - color1.blue ) * coef

This seems to work out pretty damn well, but now I need to interpolate multiple colors, each with their own weight. Anybody know the fastest way to do this?

Bilinear interpolation is probably your friend here. Use one variable as your value for the given RGB channel, and the other as the weight of that point. A quick Google search will get you all the theory and algorithms you need.

GalenEvil

  • Bay Watcher
    • View Profile
    • Mac-Man Games
Re: if self.isCoder(): post() #Programming Thread
« Reply #3613 on: December 20, 2012, 12:57:05 am »

Max White: If you are just trying to do a linear interpolation then you might be able to do something like: Interpolate(Color a, Color b, float coefficient) with coefficient being between 0 and 1 which represents the percentage to take from Color b with 1-coefficient being the amount to take from Color a. It should return a Color.

In C#
Code: [Select]
public Color Interpolate(Color a, Color b, float coefficient){
     Color returnCol = Color.White; // just set a temporary color that will get manipulated and then returned

     returnCol.r = (a.r * (1-coefficient)) + (b.r * (coefficient));
     returnCol.g = (a.g * (1 - coefficient)) + (b.g * (coefficient));
     returnCol.b = (a.b * (1 - coefficient)) + (b.b * (coefficient));

     return returnCol;
}

I haven't tested to see if that would work. But it 'should' work. For dealing with multiple blendings of color you can pick pairs of colors and do interpolation between those, and then interpolate the returned colors from those. For 4 colors you could do:

Color blendedColor = Interpolate(Interpolate(ColorA, ColorB, someWeightingA), Interpolate(ColorC, ColorD, someWeightingB), someWeightingC);

That would be a bit of a mess to put all in one line though (hehe) so you would probably want to separate into separate statements. Hope this helps some! :D

NinjaEdit!
I like Mego's suggestion, but will keep this as is so in case my understanding of Linear Interpolation is flawed then someone can correct me :D

Pre-Post edit:
Would a simplistic weighted averaging work? IE: get a total weight for the system then multiply each color by its contribution to the total weight (weight/totalWeight) and then just add the resulting reduced colors.
Logged
Fun is Fun......Done is Done... or is that Done is !!FUN!!?
Quote from: Mr Frog
Digging's a lot like surgery, see -- you grab the sharp thing and then drive the sharp end of the sharp thing in as hard as you can and then stuff goes flying and then stuff falls out and then there's a big hole and you're done. I kinda wish there was more screaming, but rocks don't hurt so I guess it can't be helped.

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3614 on: December 20, 2012, 01:32:47 am »

Well, the issue with linear interpolation is that it requires the points to be colinear. If they're not, either you can do some complicated stuff with regression (which I was messing around with earlier to no avail), or you can use another method, like bilinear interpolation or polynomial interpolation.
Pages: 1 ... 239 240 [241] 242 243 ... 796