Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1075755 Posts in 44140 Topics- by 36110 Members - Latest Member: kilsnus

December 28, 2014, 11:29:49 PM
  Show Posts
Pages: 1 ... 18 19 [20] 21 22 ... 128
381  Developer / Technical / Re: What are you programming RIGHT NOW? on: November 04, 2011, 11:25:29 AM
writing a command line tool to remove the white halos from photoshop-saved PNGs


edit: here we are
http://code.google.com/p/png-halo-remove/
382  Player / Games / Re: League of Legends on: November 02, 2011, 07:27:43 PM
EVERY fucking support champion is boring

none of sonas spells except her ult even require targeting, and her heal automatically chooses the lowest health allies to heal
383  Player / Games / Re: League of Legends on: November 02, 2011, 05:57:59 PM
omg sona is so fucking boring
384  Player / Games / Re: League of Legends on: October 30, 2011, 01:26:37 PM
is the tigskirmish gonna happen?
385  Developer / Technical / Re: General Computer Problems on: October 28, 2011, 07:58:24 PM
I get that this could fall under the "technical" label, but this forum is about programming and math and stuff, so I feel like this should be in general instead

i'll move it if people agree


(there's already like 4 general purpose "chat" threads in this forum anyway)
386  Developer / Technical / Re: The happy programmer room on: October 28, 2011, 12:48:45 PM
to add something to the sin debate; i usually write a function for sin/cos that when it uses a value, it stores the result, so if it is needed again, it looks it up instead of working it out again. saves time for multiple calls, but gets slower the more different values you check. not benchmarked it properly yet.

if you really want to use a table, just use a table...

Code:
const float gla::sin_table[256] = {0, 0.0245412, 0.0490677, 0.0735646, 0.0980171, 0.122411, 0.14673, 0.170962, 0.19509, 0.219101, 0.24298, 0.266713, 0.290285, 0.313682, 0.33689, 0.359895, 0.382683, 0.405241, 0.427555, 0.449611, 0.471397, 0.492898, 0.514103, 0.534998, 0.55557, 0.575808, 0.595699, 0.615232, 0.634393, 0.653173, 0.671559, 0.689541, 0.707107, 0.724247, 0.740951, 0.757209, 0.77301, 0.788346, 0.803208, 0.817585, 0.83147, 0.844854, 0.857729, 0.870087, 0.881921, 0.893224, 0.903989, 0.91421, 0.92388, 0.932993, 0.941544, 0.949528, 0.95694, 0.963776, 0.970031, 0.975702, 0.980785, 0.985278, 0.989177, 0.99248, 0.995185, 0.99729, 0.998795, 0.999699, 1, 0.999699, 0.998795, 0.99729, 0.995185, 0.99248, 0.989177, 0.985278, 0.980785, 0.975702, 0.970031, 0.963776, 0.95694, 0.949528, 0.941544, 0.932993, 0.92388, 0.91421, 0.903989, 0.893224, 0.881921, 0.870087, 0.857729, 0.844854, 0.83147, 0.817585, 0.803208, 0.788346, 0.77301, 0.757209, 0.740951, 0.724247, 0.707107, 0.689541, 0.671559, 0.653173, 0.634393, 0.615232, 0.595699, 0.575808, 0.55557, 0.534998, 0.514103, 0.492898, 0.471397, 0.449611, 0.427555, 0.405241, 0.382683, 0.359895, 0.33689, 0.313682, 0.290285, 0.266713, 0.24298, 0.219101, 0.19509, 0.170962, 0.14673, 0.122411, 0.0980171, 0.0735646, 0.0490677, 0.0245412, 1.22465e-016, -0.0245412, -0.0490677, -0.0735646, -0.0980171, -0.122411, -0.14673, -0.170962, -0.19509, -0.219101, -0.24298, -0.266713, -0.290285, -0.313682, -0.33689, -0.359895, -0.382683, -0.405241, -0.427555, -0.449611, -0.471397, -0.492898, -0.514103, -0.534998, -0.55557, -0.575808, -0.595699, -0.615232, -0.634393, -0.653173, -0.671559, -0.689541, -0.707107, -0.724247, -0.740951, -0.757209, -0.77301, -0.788346, -0.803208, -0.817585, -0.83147, -0.844854, -0.857729, -0.870087, -0.881921, -0.893224, -0.903989, -0.91421, -0.92388, -0.932993, -0.941544, -0.949528, -0.95694, -0.963776, -0.970031, -0.975702, -0.980785, -0.985278, -0.989177, -0.99248, -0.995185, -0.99729, -0.998795, -0.999699, -1, -0.999699, -0.998795, -0.99729, -0.995185, -0.99248, -0.989177, -0.985278, -0.980785, -0.975702, -0.970031, -0.963776, -0.95694, -0.949528, -0.941544, -0.932993, -0.92388, -0.91421, -0.903989, -0.893224, -0.881921, -0.870087, -0.857729, -0.844854, -0.83147, -0.817585, -0.803208, -0.788346, -0.77301, -0.757209, -0.740951, -0.724247, -0.707107, -0.689541, -0.671559, -0.653173, -0.634393, -0.615232, -0.595699, -0.575808, -0.55557, -0.534998, -0.514103, -0.492898, -0.471397, -0.449611, -0.427555, -0.405241, -0.382683, -0.359895, -0.33689, -0.313682, -0.290285, -0.266713, -0.24298, -0.219101, -0.19509, -0.170962, -0.14673, -0.122411, -0.0980171, -0.0735646, -0.0490677, -0.0245412};
const float gla::cos_table[256] = {1, 0.999699, 0.998795, 0.99729, 0.995185, 0.99248, 0.989177, 0.985278, 0.980785, 0.975702, 0.970031, 0.963776, 0.95694, 0.949528, 0.941544, 0.932993, 0.92388, 0.91421, 0.903989, 0.893224, 0.881921, 0.870087, 0.857729, 0.844854, 0.83147, 0.817585, 0.803208, 0.788346, 0.77301, 0.757209, 0.740951, 0.724247, 0.707107, 0.689541, 0.671559, 0.653173, 0.634393, 0.615232, 0.595699, 0.575808, 0.55557, 0.534998, 0.514103, 0.492898, 0.471397, 0.449611, 0.427555, 0.405241, 0.382683, 0.359895, 0.33689, 0.313682, 0.290285, 0.266713, 0.24298, 0.219101, 0.19509, 0.170962, 0.14673, 0.122411, 0.0980171, 0.0735646, 0.0490677, 0.0245412, 6.12323e-017, -0.0245412, -0.0490677, -0.0735646, -0.0980171, -0.122411, -0.14673, -0.170962, -0.19509, -0.219101, -0.24298, -0.266713, -0.290285, -0.313682, -0.33689, -0.359895, -0.382683, -0.405241, -0.427555, -0.449611, -0.471397, -0.492898, -0.514103, -0.534998, -0.55557, -0.575808, -0.595699, -0.615232, -0.634393, -0.653173, -0.671559, -0.689541, -0.707107, -0.724247, -0.740951, -0.757209, -0.77301, -0.788346, -0.803208, -0.817585, -0.83147, -0.844854, -0.857729, -0.870087, -0.881921, -0.893224, -0.903989, -0.91421, -0.92388, -0.932993, -0.941544, -0.949528, -0.95694, -0.963776, -0.970031, -0.975702, -0.980785, -0.985278, -0.989177, -0.99248, -0.995185, -0.99729, -0.998795, -0.999699, -1, -0.999699, -0.998795, -0.99729, -0.995185, -0.99248, -0.989177, -0.985278, -0.980785, -0.975702, -0.970031, -0.963776, -0.95694, -0.949528, -0.941544, -0.932993, -0.92388, -0.91421, -0.903989, -0.893224, -0.881921, -0.870087, -0.857729, -0.844854, -0.83147, -0.817585, -0.803208, -0.788346, -0.77301, -0.757209, -0.740951, -0.724247, -0.707107, -0.689541, -0.671559, -0.653173, -0.634393, -0.615232, -0.595699, -0.575808, -0.55557, -0.534998, -0.514103, -0.492898, -0.471397, -0.449611, -0.427555, -0.405241, -0.382683, -0.359895, -0.33689, -0.313682, -0.290285, -0.266713, -0.24298, -0.219101, -0.19509, -0.170962, -0.14673, -0.122411, -0.0980171, -0.0735646, -0.0490677, -0.0245412, -1.83697e-016, 0.0245412, 0.0490677, 0.0735646, 0.0980171, 0.122411, 0.14673, 0.170962, 0.19509, 0.219101, 0.24298, 0.266713, 0.290285, 0.313682, 0.33689, 0.359895, 0.382683, 0.405241, 0.427555, 0.449611, 0.471397, 0.492898, 0.514103, 0.534998, 0.55557, 0.575808, 0.595699, 0.615232, 0.634393, 0.653173, 0.671559, 0.689541, 0.707107, 0.724247, 0.740951, 0.757209, 0.77301, 0.788346, 0.803208, 0.817585, 0.83147, 0.844854, 0.857729, 0.870087, 0.881921, 0.893224, 0.903989, 0.91421, 0.92388, 0.932993, 0.941544, 0.949528, 0.95694, 0.963776, 0.970031, 0.975702, 0.980785, 0.985278, 0.989177, 0.99248, 0.995185, 0.99729, 0.998795, 0.999699};

namespace gla {
  #define CONVERSION (256.0f/(2.0f*PI))

  inline float sin(float x){
    x *= CONVERSION;
    int X = x;

    unsigned char index = X;
    float a = sin_table[index];
    return a+(x-X)*(sin_table[++index]-a);
  }

  inline float cos(float x){
    x *= CONVERSION;
    int X = x;

    unsigned char index = X;
    float a = cos_table[index];
    return a+(x-X)*(cos_table[++index]-a);
  }

  inline void sincos(float x, float& s, float& c){
    x *= CONVERSION;
    int X = x;

    unsigned char index = X;
    s=sin_table[index]; c=cos_table[index];
    s=s+(x-X)*(sin_table[++index]-s);
    c=c+(x-X)*(cos_table[index]-c);
  }
}


table size of 256 so converting to unsigned char intrinsically handles wrapping / periodicity without having to do bound checks, does a simple linear interpolation between table entires, its about 2-3x faster than standard sin for small numbers, and 10-20x faster for large numbers on PC with all optimization on for both tests.
387  Player / General / Re: IGF Thread 2012 on: October 26, 2011, 01:14:05 PM
the IGF is not about the money, the money isn't that much, if you need a grant/funding to finish your game, check your government, try kickstarter, etc.
388  Player / Games / Re: League of Legends on: October 25, 2011, 03:41:26 PM
draft pick
389  Player / Games / Re: League of Legends on: October 25, 2011, 03:33:46 PM
i'll do it
390  Player / General / Re: IGF Thread 2012 on: October 25, 2011, 02:28:41 PM
The truth is that Fez, as we know it today, wouldn't have existed had it not won an IGF award. This is an undeniable fact, and nothing short of going back in time and changing history could disprove it.

it's an unfalsifiable fact not an undeniable fact, I don't think the igf is the sole reason FEZ is where its at today, hell I think the game wouldn't be that different if it didn't. It got a lot of hype, more than other IGF games usually do even, and I blame that on the merits of the game, the screenshots, and the novelty of the concept moreso than the fact that it won an award 5 years ago.

I don't think it should have be re-entered though
391  Player / General / Re: IGF Thread 2012 on: October 25, 2011, 02:23:23 PM
FRACT won the student igf last year and is re-entered this year


just fyi
392  Player / Games / Re: League of Legends on: October 23, 2011, 08:15:00 PM

its good for LOW armor targets, it only takes off what 30-40 armor i forget


correct me if I'm wrong, but doesn't the math for that work out to be the same % increase in damage for all targets regardless of initial armor?
393  Player / Games / Re: League of Legends on: October 23, 2011, 04:12:22 PM
so... irelia's still pretty good it seems
394  Developer / Technical / Re: The happy programmer room on: October 23, 2011, 02:37:40 PM
Dude. Just use sin and cos

or this
http://en.wikipedia.org/wiki/Midpoint_circle_algorithm

which looks closer to what he already has than sin/cos (sin/cos are also expensive if performance matters)

especially if you're calculating sin/cos for EVERY POINT, you can/should do it once (with delta_theta which is 2*pi / points) and then do [copypasta from my own circle iteration]

Code:
gla::sincos((PI/2.0)/seg, sind, cosd); //sincos sets sind to sin(theta) and cosd to cos(thets), slight optimization in my implimentation to do both at the same time rather than one at a time
Vec2D edge = Vec2D::UP; //vector is (0, -1), scale it by radius if needed
  
for(int i = 0; i<=seg; i++){
  edge.rotate(sind, cosd);
  //circle point is edge.x, edge.y
}

...
...
...

void Vec2D::rotate(float sina, float cosa){
  float tx = x*cosa-y*sina;
  float ty = x*sina+y*cosa;
  x = tx;
  y = ty;
}

395  Developer / Technical / Re: Rotate a sine wave on: October 22, 2011, 10:37:24 AM
Go learn everything there is to learn about vector math

edit: the reason I'm saying this and not just giving you the code here is that vector math is extremely important in game design, and it will benefit you to learn it.

learn:
what a vector is
what adding / subtracting vectors means
the relationship between a vector and a point

length of vector
normalization of vector

dot product
cross product
how to get the angle between 2 vectors

how to rotate a vector
  - in more general terms this is applying a matrix transformation (linear transformation) to a vector, but for most 2D purposes you can separate into rotate/scale/translate and be just fine


for a sine wave bullet, you have its initial direction as a vector, D, then you do
position += D
rotate D by 10*sin(a)
a+=whatever
396  Developer / Technical / Re: The happy programmer room on: October 21, 2011, 03:47:38 PM
Nah, dx and dy are used to construct the detection polygon. I even drew a debugging shape during testing.

I'm pretty sure it's a matter of the object meeting the interface shape (magnet).

When using a decreasing constant my brain is probably telling me that it's moving up at the same rate, because it meets the magnet with the same amount of push.

But it's got to decelerate as soon as it hits the magnet, otherwise it goes straight through it. So I'm probably seeing an optical illusion based on what I'd like to see (the objects lifting nicely into the magnet so I can drag them off, but without disturbing the magnet).

So yeah, I'm wrong, but it plays right  Durr...?

I'll fix my comments in my build so I don't confuse the poor bastard who's going to have to do the iPhone port.

oh so you're saying you wanted the restitution on the magnet to be a constant?
397  Player / General / Re: So I hit a deer on: October 21, 2011, 12:37:56 PM
hire a lawyer, that deer's family's gonna sue.
398  Player / Games / Re: League of Legends on: October 21, 2011, 12:33:19 PM
I tried xerath yesterday, he can harass like fucking crazy in lane but I don't really know what to do with him later on since his damage doesn't scale that well it seems and his stun is hard to land right, and he has too much range to act as a tank
399  Developer / Technical / Re: AS3 ByteArray / Int Weirdness on: October 21, 2011, 12:27:06 PM
I suppose I could always do 1 byte for length and 1 byte for angle. That would allow me to get up 255 pixels in any direction with an error margin of 1.4 degrees. Not sure if anyone would really notice that.

no, you don't want error margins if you're doing deltas since they'll build up over time.


the method I described is good if your 127 bit offsets are less than one in three

if its more than one in three, you need to do some bit encoding. Like, first bit in the byte says whether to read 1 byte or 2 bytes, downside is now since one byte needs to store this info your range for one byte offsets is -64 to +63, but if it goes over that then for 2 bytes you get a range of -16384 to +16383

not gonna explain how to do this its a lot harder and not worth the effort really, and you won't gain much from it after doing bytearray.compress anyway
400  Player / Games / Re: League of Legends on: October 21, 2011, 12:03:26 PM
Opinions on AP Kog? His range and burst is pretty crazy. I guess the lack of hard CC hurts him though.

kog does shitloads of magic damage even without AP, so going ap just makes it easy to itemize against. Oh hit + AS + late game AD is the way to go (I go doransblade-bezerkers-malady-madreds-frozen mallet-black cleaver-bloodthirster]
Pages: 1 ... 18 19 [20] 21 22 ... 128
Theme orange-lt created by panic