• What Are You Working On? V13
    5,003 replies, posted
[QUOTE=ZeekyHBomb;25421640]In that screenshot he's posted, assuming this grid in the back is the quadtree (which it cannot be due to it being 20x20 cells, but whatever), then is the more populated areas the quadtree would reveal only around 20 bullets, as opposed to 250. True, it will raise the efficiency as much as it would with collision checks other than the player, but it's all of the optimizations I could with of.[/QUOTE] Ordering the object list into some kind of a structure requires calculation. You'd be recalculating the tile or tree branch of each bullet once per tick because they move. That's not going to cost any less than a collision check. A quadtree would be a good optimization for a static world, since you'd only need to order it upon creation.
[QUOTE=Mega1mpact;25421787]square root is the opisit of X^2 or X*X. it finds the value needed to do X*X so:[/QUOTE] 1x Bad Spelling Also, if the squareroot is the opposite of squaring, then was it the logarithmus dualis?[QUOTE=RyanDv3;25421903]Squareroot undoes squaring. Squaring undoes squareroot.[/QUOTE] In R0+, yes. manual merge: [QUOTE=ThePuska;25421922]Ordering the object list into some kind of a structure requires calculation. You'd be recalculating the tile or tree branch of each bullet once per tick because they move. That's not going to cost any less than a collision check. A quadtree would be a good optimization for a static world, since you'd only need to order it upon creation.[/QUOTE] :| makes sense; got 'cha Though not recalculating the tree, the objects could notify the tree themselves. You'd still do a collision check per object.
I figured out that the Pascal triangle is useful. Also, would someone suggest me something to implement in my ircbot (written in C with only standard + POSIX libraries) [editline]15th October 2010[/editline] [QUOTE=ZeekyHBomb;25421979]Also, if the squareroot is the opposite of squaring, then was it the logarithmus dualis? [/QUOTE] Logarithm is the opposite of the exponent function, whereas square root is the opposite of the square function or something? I don't get what you mean.
[QUOTE=ZeekyHBomb;25421916]Like I said, the squareroot thing was not directed at you :3[/QUOTE] Well, what should i do then? I'll probably not understand it but what the hell :nyoron:
Maybe you should take a break and learn some maths before starting on game programming. Also fail : sqrt(X)=X*X its : x = sqrt(x*x)
[QUOTE=esalaka;25421985]Logarithm is the opposite of the exponent function, whereas square root is the opposite of the square function or something? I don't get what you mean.[/QUOTE] If the logarithm naturalis is the opposite of the exponential function, then what is the root of degree e? manual merge: [QUOTE=Giraffen93;25422003]Well, what should i do then? I'll probably not understand it but what the hell :nyoron:[/QUOTE] Well, if you check whether each objects collides with each other, then a quadtree or kd-tree will help. If you just check whether they collide with one specific object, then I don't think there's much you can do as I presume the default implementation of hitTest is probably already quite efficient. You could try AS3, which I heard is significantly faster than AS2.
I started with game programming 2005, already got my first paycheck from ads (100$) and my library has 30+ games.
Let's not go down this road...
[QUOTE=Larikang;25421514]It's worth noting [i]why[/i] squaring is faster than square-root (on integers): the former always returns an integer, whereas the latter could return a float and so needs to perform higher-precision calculations.[/QUOTE] Wow I hope you're joking. Squaring is ONE calculation, finding the square root is many. Please don't post shit you know nothing about, some poor newb might actually believe it.
[QUOTE=Giraffen93;25422074]I started with game programming 2005, already got my first paycheck from ads (100$) and my library has 30+ games.[/QUOTE] Back down lads, we have a professional in the thread.
[QUOTE=ThePuska;25421513]If the bullets can only collide with the player, using a tree or a tile structure isn't going to improve performance significantly. Scanning through the list and checking for collision with a single object has O(n) complexity. Scanning through the list and calculating the tiles the bullets are occupying also has O(n) complexity. It'll only become worthwhile to start optimizing with different structures if the amount of collision checks doesn't increase linearly with bullet amount. That'd be the case if the bullets could collide with other bullets. It's also marginally faster to have a tile structure if the bullets aren't guaranteed to move each tick. But I find that unlikely because they're bullets.[/QUOTE] You don't have to check which tile it's in, so you're wrong. Spawn a bullet or player, divide location from cell size as x,y , access x, y in cell array, call function to add bullet to array. No iteration. Bullet or player moves, do the same thing. No iteration. Basically you do a ton less squarerooting, the slowest part of it all.
[QUOTE=Giraffen93;25422074]I started with game programming 2005, already got my first paycheck from ads (100$) and my library has 30+ games.[/QUOTE] If you don't know how to do basic maths then how the hell are you ever going to make a game other then a basic click on this buttonz to showz uz some pornz game
Not really, but it works. There are just a few projects i canceled because of my issues. Just google "mario snow 2". It's not the prettiest game in the world, but it works.
[QUOTE=Jawalt;25422155]You don't have to check which tile it's in, so you're wrong. Spawn a bullet or player, divide location from cell size as x,y , access x, y in cell array, call function to add bullet to array. No iteration. Bullet or player moves, do the same thing. No iteration. Basically you do a ton less squarerooting, the slowest part of it all.[/QUOTE] I tried formulating a response but I don't know how I could make it any more clear so I'll just quote my last post. [quote]Ordering the object list into some kind of a structure requires calculation. You'd be recalculating the tile or tree branch of each bullet once per tick because they move. That's not going to cost any less than a collision check.[/quote] A collision check requires no square roots. (player.x - object.x)*(player.x - object.x) + (player.y - object.y)*(player.y - object.y) < radiusSquared
You can find a square root with a power of the reciprocal of the power in two steps. For instance take the power 2. The reciprocal is 0.5 (1 / 2). Say we wanted to do the square root of 64. 64 ^ 0.5 = 8. Cube root of 125? Reciprocal is 0.33.. (1 / 3). 125 ^ 0.33... = 5.
[QUOTE=Unib5;25422450]You can find a square root with a power of the reciprocal of the power in two steps. For instance take the power 2. The reciprocal is 0.5 (1 / 2). Say we wanted to do the square root of 64. 64 ^ 0.5 = 8. Cube root of 125? Reciprocal is 0.33.. (1 / 3). 125 ^ 0.33... = 5.[/QUOTE] Solving one specific case of a problem is most of the time faster than solving the general problem. Well, in numerical analysis and with highly optimized algorithms anyway. Exponentiation of reals is slower than finding the square root of a real. 10^7 x Sqrt(2) : 328 ms 10^7 x Power(2, 1/2) : 1391 ms (edit: arguments were given as variables with the respective values)
[QUOTE=Unib5;25422450]You can find a square root with a power of the reciprocal of the power in two steps. For instance take the power 2. The reciprocal is 0.5 (1 / 2). Say we wanted to do the square root of 64. 64 ^ 0.5 = 8. Cube root of 125? Reciprocal is 0.33.. (1 / 3). 125 ^ 0.33... = 5.[/QUOTE] Yeah that's great, now do that any major language like C, C++, C# or Java There is no ^ in these languages. In languages like python where you can do stuff like this (AFAIK ** operator) it's doing multiplications and shit underneath anyway. So basically your solution isn't a solution, it's just stating the obvious which is not applicable to programming.
These languages do have power-functions in their respective standard-library. Using pow(n, 0.5) will very probably be slower then sqrt(n) though. If it wasn't sqrt(n) would have been implemented as pow(n, 0.5) by any sane person.
[QUOTE=ZeekyHBomb;25422708]These languages do have power-functions in their respective standard-library. Using pow(n, 0.5) will very probably be slower then sqrt(n) though. If it wasn't sqrt(n) would have been implemented as pow(n, 0.5) by any sane person.[/QUOTE] Yes but if you are using std library functions why would you use pow instead of sqrt if you wanted to find the square root? :S I get your point, I just think it kind of missed the point of mine. Basically my point was "suggesting using ^ to get the sqrt is not a solution in programming"
That's what I wanted to point out :P
Ah yes, I edited my post explaining my response to your response to my response to Unib5's response :smugdog:
Oh no, the WAYWO thread has broken out into an argument about maths. I'd better be leaving then.
Does anyone know a link to a website that has different themes for visual studios? I'm getting sick of the default one now.
[QUOTE=Jimmylaw;25423115]Does anyone know a link to a website that has different themes for visual studios? I'm getting sick of the default one now.[/QUOTE] [url]http://studiostyl.es/[/url] [editline]15th October 2010[/editline] Hahahaha just noticed this at the bottom: [url]http://vs2010wallpapers.com/[/url]
[QUOTE=Giraffen93;25422074]I started with game programming 2005, already got my first paycheck from ads (100$) and my library has 30+ games.[/QUOTE] So you've made about 3 dollars and 33 cents for each game you've made?
[QUOTE=Jimmylaw;25423115]Does anyone know a link to a website that has different themes for visual studios? I'm getting sick of the default one now.[/QUOTE] Tools > Options > Environment > Fonts and Colours Just grow your own and you end up with an awesome taylor made one like mine :smugdog: [url]http://dl.dropbox.com/u/5062494/forumpost/syntaxhighlightv2.png[/url] If you don't want to do it manually, this is great: [url]http://www.frickinsweet.com/tools/Theme.mvc.aspx[/url]
[QUOTE=ZeekyHBomb;25421355]It's about sqrt(y)² though, not sqrt(y²). sqrt(y²) is only equal to sqrt(y)² in R when y >= 0. Lucky you that in this specific case, y happens to be >= 0 (or NaN).[/QUOTE] Sqrt(-1) = i Squarerooting a negative number only gives an irreal number, so anyways you can only use R >= 0
[QUOTE=KmartSqrl;25423214]So you've made about 3 dollars and 33 cents for each game you've made?[/QUOTE] I only put ads in 2 of them. Right now i have 25$, 75 to go. Takes about 4 months for 20$ :v: It's something, i don't even need much money.
[QUOTE=Jallen;25423242]Tools > Options > Environment > Fonts and Colours Just grow your own and you end up with an awesome taylor made one like mine :smugdog: [url]http://dl.dropbox.com/u/5062494/forumpost/syntaxhighlightv2.png[/url] If you don't want to do it manually, this is great: [url]http://www.frickinsweet.com/tools/Theme.mvc.aspx[/url][/QUOTE] Yours is pretty sweet, would you be able to send me the file for it please?
Droid Sans Mono is a good interface font Bitstream Vera Sans Mono also
Sorry, you need to Log In to post a reply to this thread.