|
Kekskiller
Guest
|
 |
« Reply #400 on: August 09, 2009, 12:04:46 PM » |
|
I'm grump grumpy because I don't know how to combine timer-based movements vectors with gravity without having unpredictable jump behaviour  Also, delta values suck ass.
|
|
|
|
|
Logged
|
|
|
|
|
Aquin
|
 |
« Reply #401 on: August 09, 2009, 04:40:54 PM » |
|
I'm grumpy because I just found this error in my code: true = false;
|
|
|
|
|
Logged
|
I'd write a devlog about my current game, but I'm too busy making it.
|
|
|
|
Schtee
|
 |
« Reply #402 on: August 10, 2009, 12:25:29 AM » |
|
That's quite the doozy.
|
|
|
|
|
Logged
|
|
|
|
|
Aquin
|
 |
« Reply #403 on: August 10, 2009, 12:47:24 AM » |
|
|
|
|
|
|
Logged
|
I'd write a devlog about my current game, but I'm too busy making it.
|
|
|
|
Draknek
|
 |
« Reply #404 on: August 10, 2009, 02:12:14 AM » |
|
I'm grump grumpy because I don't know how to combine timer-based movements vectors with gravity without having unpredictable jump behaviour  Also, delta values suck ass. The best/easiest solution is to have a fixed update framerate, but if your code looks like this: void update (float dt) { velocity += gravity * dt; position += velocity * dt; } Try changing it to this: void update (float dt) { velocity += gravity * dt; position += velocity * dt - 0.5f * gravity * dt * dt; } I'm grumpy because I just found this error in my code: true = false; And that compiled?
|
|
|
|
|
Logged
|
|
|
|
|
Kekskiller
Guest
|
 |
« Reply #405 on: August 10, 2009, 02:57:08 AM » |
|
I'm grump grumpy because I don't know how to combine timer-based movements vectors with gravity without having unpredictable jump behaviour  Also, delta values suck ass. The best/easiest solution is to have a fixed update framerate, but if your code looks like this: void update (float dt) { velocity += gravity * dt; position += velocity * dt; } Try changing it to this: void update (float dt) { velocity += gravity * dt; position += velocity * dt - 0.5f * gravity * dt * dt; } Nahh, that isn't the problem. I said timer-based because I have a specific update delay for a one-step movement on each axis. Every time I'm updating the physics, checking how many tiles the objects has passed since last call (plus movement of them, optional raytracing for distance longer 1 pixel). The problem is the system itself - Uint32 together with floats always fails. I tried to implement float-based delay and tricky rest delta but it doesn't work atm. But hey - maybe you're right? I have a tile-based world, every position is an Integer, no inbetweens. Yay, that's probably the reason. Random update may not suitable for such world, I guess  Thanks man, I'm so stupid 
|
|
|
|
|
Logged
|
|
|
|
|
|
|
Aquin
|
 |
« Reply #407 on: August 11, 2009, 10:09:57 AM » |
|
Huh that's weird. My sound isn't working. Why won't the sound effects in my game work?! The filenames are in the right place... it should be loading correctly... oh god, am I playing them correctly... IS THERE A MEMORY LEAK WHAT THE HELL Oh. My speakers are turned off. That...would do it.  You know this + my true = false debacle is making me look pretty stupid. It's like I'm FIVE YEARS OLD. 
|
|
|
|
|
Logged
|
I'd write a devlog about my current game, but I'm too busy making it.
|
|
|
|
Titch
|
 |
« Reply #408 on: August 12, 2009, 06:36:27 AM » |
|
Grumpy because I've just written what feels like the most redundant function ever. private function event_if ($item1:String, $compare_type:String, $item2:String) { var $val1:int = 0; var $val2:int = 0; var result:Boolean = false; var regExp:RegExp = /\w/ if (regExp.test($item1)) { $val1 = variable_index[$item1]; } else { $val1 = int($item1); } if (regExp.text($item2)) { $val2 = variable_index[$item2]; } else { $val2 = int($item2); } switch ($compare_type) { case "equal": case "==": result = $val1 == $val2; case "not equal": case "!=": result = $val1 != $val2; case "greater than": case ">": result = $val1 > $val2; case "less than": case "<": result = $val1 < $val2; case "greater or equal to": case ">=": result = $val1 >= $val2; break; case "less or equal to": case "<=": result = $val1 <= $val2; break; } if (result) loadBranch(0); }
So I can process stuff like this: <sound name="snd_level_down" /> <if var1="gems" is="greater than" var2="49"> <speak>Trade 50 gems to improve your relationship?</speak> <choice> <yes> <speak>Boy:"Something to say on yes"</speak> <emote>Boy:happy</emote> <alter var="gems" amount="-50"></alter> </yes> <no> <speak>Boy:"And a no case answer"</speak> <emote>Boy:unhappy</emote> </no> </choice> </if>
|
|
|
|
« Last Edit: August 12, 2009, 06:58:49 AM by Titch »
|
Logged
|
|
|
|
|
bateleur
|
 |
« Reply #409 on: August 12, 2009, 07:59:44 AM » |
|
You know this + my true = false debacle is making me look pretty stupid. It's like I'm FIVE YEARS OLD. Not at all. Five year olds are extremely alert and don't make those kinds of errors much. It's more like you're 105. 
|
|
|
|
|
Logged
|
|
|
|
|
Kekskiller
Guest
|
 |
« Reply #410 on: August 12, 2009, 09:59:11 AM » |
|
You know this + my true = false debacle is making me look pretty stupid. It's like I'm FIVE YEARS OLD. Not at all. Five year olds are extremely alert and don't make those kinds of errors much. It's more like you're 105.  This proves he's old enough to know that it works in real life.
|
|
|
|
|
Logged
|
|
|
|
|
Aquin
|
 |
« Reply #411 on: August 12, 2009, 11:35:23 AM » |
|
Um... when I was 5 and writing BASIC, I made mistakes like that all the time. Of course I was an inquisitive child.
"What do you mean true can't equal false? Says who? Why not? Why is the sky blue? Yada yada yada..."
|
|
|
|
|
Logged
|
I'd write a devlog about my current game, but I'm too busy making it.
|
|
|
|
team_q
|
 |
« Reply #412 on: August 12, 2009, 02:00:29 PM » |
|
I know its bad form but I just do it like this: bool booly;
if (booly) funstuff(); else if (!booly) notfunstuff();
I was also told that writing it like this: if (true == booly) dostuff();
makes it easier to catch doing this: if (true = booly)//doesn't compile dostuff();
if (booly= true )//totally compiles dostuff();
|
|
|
|
|
Logged
|
|
|
|
|
Average Software
|
 |
« Reply #413 on: August 12, 2009, 05:23:09 PM » |
|
I know its bad form but I just do it like this: bool booly;
if (booly) funstuff(); else if (!booly) notfunstuff();
Why are you testing a boolean twice? There's no need for the second test. bool booly;
if (booly) funstuff(); else notfunstuff();
That will work just fine. if (true == booly) dostuff();
Try comparing a boolean to true or false in a job interview and you'll get laughed out of the room. That is extremely bad form. Not having to do that is the whole point behind a boolean data type.
|
|
|
|
|
Logged
|
|
|
|
|
Aquin
|
 |
« Reply #414 on: August 12, 2009, 05:27:44 PM » |
|
Yeah, I've even been known to treat ints as booleans.. if(numTimes) then blah blah I've never done a == true or such. As for other data types, I rarely make the "this = that" mistake. I also catch it really quickly when I do. It's never been an issue for me. 
|
|
|
|
|
Logged
|
I'd write a devlog about my current game, but I'm too busy making it.
|
|
|
|
Mr. Yes
|
 |
« Reply #415 on: August 12, 2009, 05:34:37 PM » |
|
Heh. I make that mistake regularly. And it always takes me so long to notice. You would think that, by now, I wouldn't be making such a simple mistake so often.
|
|
|
|
|
Logged
|
|
|
|
|
team_q
|
 |
« Reply #416 on: August 12, 2009, 06:03:28 PM » |
|
Why are you testing a boolean twice? There's no need for the second test.
I know, it was just to show the (!booly). Try comparing a boolean to true or false in a job interview and you'll get laughed out of the room. That is extremely bad form. Not having to do that is the whole point behind a boolean data type.
I guess I should've done the example with ints.
|
|
|
|
|
Logged
|
|
|
|
|
nihilocrat
|
 |
« Reply #417 on: August 12, 2009, 06:09:12 PM » |
|
Try comparing a boolean to true or false in a job interview and you'll get laughed out of the room. That is extremely bad form. Not having to do that is the whole point behind a boolean data type.
I guess I should've done the example with ints. It seems the professionals you know have serious cases of Asperger's. Bad form? Seriously, who gives a crap?
|
|
|
|
|
Logged
|
|
|
|
|
William Laub
|
 |
« Reply #418 on: August 12, 2009, 06:54:41 PM » |
|
The ability to control computers makes gods out of ordinary human beings, but there's a limit to how many gods we can have walking around, so there has to be an additional qualification. Only the ones who can control computers the right way get to be gods ( allman style is a good start).
|
|
|
|
|
Logged
|
|
|
|
|
bateleur
|
 |
« Reply #419 on: August 12, 2009, 10:23:45 PM » |
|
Try comparing a boolean to true or false in a job interview and you'll get laughed out of the room. That is extremely bad form. Not having to do that is the whole point behind a boolean data type. If I saw someone had done that I'd most likely hire them (unless there was something wrong with the rest of their code). It may be less elegant than using the boolean value directly in the test, but at least it deviates from that in the direction of increased clarity. That's a good fault to have.
|
|
|
|
|
Logged
|
|
|
|
|