• What Are You Working On? V13
    5,003 replies, posted
[QUOTE=Overv;25916799]What's up with them randomly teleporting even when you're not picking up the block?[/QUOTE] I think it's just the video hard-cutting.
[QUOTE=Soda;25916708]yeah except magnets don't calculate their angle to the other magnet and decide where to aim their weapon it's AI, even if it is basic. if you think different you are just wrong tbh.[/QUOTE] Yeah that's the right way to argue. Tell them they're wrong no matter what. I think there should at least be some kind of decision that's made for it to be called "intelligence". I understand it's a line drawn in sand, but I don't consider forced attraction intelligence. If the enemy just evaluated its possibilities and chose to follow the player, that'd be intelligence - even if following the player was the only option given to it. The end result would be no different but the fact that there was a process via which it came to the conclusion to follow the player would make it an intelligent decision. [editline]7th November 2010[/editline] [QUOTE=CarlBooth;25916828]I think it's just the video hard-cutting.[/QUOTE] Looks like a way to make the particles de-clump so that they don't become too easy to dodge
[QUOTE=Overv;25916799]What's up with them randomly teleporting even when you're not picking up the block?[/QUOTE] [QUOTE=ThePuska;25916831] Looks like a way to make the particles de-clump so that they don't become too easy to dodge[/QUOTE]
-Snip- Apparently I was on the second to last page D:
[QUOTE=ThePuska;25916831] Looks like a way to make the particles de-clump so that they don't become too easy to dodge[/QUOTE] If it was a real AI, this wouldn't happen. They'd camp near the goal and actually have intelligence.
[QUOTE=bromvlieg;25915089][media]http://www.youtube.com/watch?v=Itn_tpyTquQ[/media] :smug: Nice simie![/QUOTE] So yeah, I'm watching this, and my girlfriend is behind me and she's all like "What's that guy doing copying your DOTS game?" I just laughed. I'm glad I could inspire someone. :v: ...ARCADIA!
[QUOTE=xAustechx;25917112]So yeah, I'm watching this, and my girlfriend is behind me and she's all like "What's that guy doing copying your DOTS game?" I just laughed. I'm glad I could inspire someone. :v: ...ARCADIA![/QUOTE] Any idea what it's going to turn into?
[QUOTE=thelinx;25917029]If it was a real AI, this wouldn't happen. They'd camp near the goal and actually have intelligence.[/QUOTE] Just... If you was real then you would be quiet.
[QUOTE=BlkDucky;25917157]Any idea what it's going to turn into?[/QUOTE] Nope. But I'm thinking of adding grids to Dots.
Because I'm so incredibly original I'm making a Minecraft map renderer again. This time I'm using OpenGL though: [media]http://www.youtube.com/watch?v=IBLafMuGUY0[/media]
[QUOTE=likesoursugar;25915899]My AI is cooler than your baaaaalllzzz "/[/QUOTE] [media]http://www.youtube.com/watch?v=u4JUemLXqHw[/media] You were saying? NVM the video being stuck in the beggining it's this louzy recorder.
Just watched the Social Network. It [i]IS[/i] a good movie. I wish it were longer.
[QUOTE=DeadKiller987;25918068]Just watched the Social Network. It [i]IS[/i] a good movie. I wish it were longer.[/QUOTE] Whoa! That has everything to do with programming!
[QUOTE=AzLaN;25917897] You were saying? [/QUOTE] who gave you that idea? :Ooooooo But nice work.
[QUOTE=leontodd;25918249]Whoa! That has everything to do with programming![/QUOTE] That's why he's a programming king brah.
[QUOTE=DeadKiller987;25918068]Just watched the Social Network. It [i]IS[/i] a good movie. I wish it were longer.[/QUOTE]I think you're in the wrong thread..:confused: AzLaN disagrees
Dusting off my old stereoscopic thing on my PSP. I found that it was spending a lot of its time on the trig during the rotations, so I was looking for a way to use something like trig tables without losing accuracy. I tripped [B]actual balls[/B] when I started reading up on metatables. [code]math.tsin = {}[/code]This is my sine table. It's empty right now. but, instead of computing everything ahead of time, leading to a loss of accuracy, I do this [code]setmetatable(math.tsin, { __index = function(t, k) t[k] = math.sin(k) return t[k] end })[/code]Which means that every time I try to access a key that doesn't exist, __index is called which calculates the sine function of the index, stores it and returns it. Every time I then do math.tsin[index] on that index, it simply retrieves it from the table instead of calculating it again. Pretty big performance gain - a large model went from ~15 fps to ~20. Is... is this love? :3:
[QUOTE=r0b0tsquid;25919158]Dusting off my old stereoscopic thing on my PSP. I found that it was spending a lot of its time on the trig during the rotations, so I was looking for a way to use something like trig tables without losing accuracy. I tripped [b]actual balls[/b] when I started reading up on metatables. [code]math.tsin = {}[/code] This is my sine table. It's empty right now. but, instead of computing everything ahead of time, leading to a loss of accuracy, I do this [code]setmetatable(math.tsin, { __index = function(t, k) t[k] = math.sin(k) return t[k] end })[/code] Which means that every time I try to access a key that doesn't exist, __index is called which calculates the sine function of the index, stores it and returns it. Every time I then do math.tsin[index] on that index, it simply retrieves it for the table instead of calculating it again. Pretty big performance gain - a large model went from ~15 fps to ~20. Is... is this love? :3:[/QUOTE] Isn't that how memcahe works for databases?
Possibly - I wouldn't know tbh. What I find awesome about this is that I'm accessing keys that [B]don't exist[/B], and they're created by [B]magic! [/B]
[QUOTE=r0b0tsquid;25919384]Possibly - I wouldn't know tbh. What I find awesome about this is that I'm acessing keys that [B]don't exist[/B], and they're created by [B]magic! [/B][/QUOTE] Oh the wonders of Lua.
Last time I got frustrated with the slowness of sine and cosine, I wrote an approximation with Taylor polynomials [img]http://www.codecogs.com/gif.latex?%20\sin{x}%20=%20x%20-%20{{x^3}\over{3!}}%20+%20{{x^5}\over{5!}}%20-%20{{x^7}\over{7!}}%20+%20...[/img] [img]http://www.codecogs.com/gif.latex?%20\cos{x}%20=%201%20-%20{{x^2}\over{2!}}%20+%20{{x^4}\over{4!}}%20-%20{{x^6}\over{6!}}%20+%20...[/img] Works very well for -1 < x < 1 [code]procedure SinCos(var sin, cos: single; const x: single); const d0 = 1/6; d1 = 1/120; d2 = 1/5040; d3 = 1/362880; e0 = 1/2; e1 = 1/24; e2 = 1/720; e3 = 1/40320; var x2, x4, x8: single; begin x2 := x*x; x4 := x2*x2; x8 := x4*x4; sin := x*(1 - d0*x2 + d1*x4 - d2*x4*x2 + d3*x8); cos := 1 - e0*x2 + e1*x4 - e2*x4*x2 + e3*x8; end;[/code] of course that's only in radians
[QUOTE=r0b0tsquid;25919158]Dusting off my old stereoscopic thing on my PSP. I found that it was spending a lot of its time on the trig during the rotations, so I was looking for a way to use something like trig tables without losing accuracy. I tripped [B]actual balls[/B] when I started reading up on metatables. [code]math.tsin = {}[/code]This is my sine table. It's empty right now. but, instead of computing everything ahead of time, leading to a loss of accuracy, I do this [code]setmetatable(math.tsin, { __index = function(t, k) t[k] = math.sin(k) return t[k] end })[/code]Which means that every time I try to access a key that doesn't exist, __index is called which calculates the sine function of the index, stores it and returns it. Every time I then do math.tsin[index] on that index, it simply retrieves it from the table instead of calculating it again. Pretty big performance gain - a large model went from ~15 fps to ~20. Is... is this love? :3:[/QUOTE] Hoooowww does that work
[QUOTE=r4nk_;25919668]Hoooowww does that work[/QUOTE] If the index is not found in the table, __index is called on the table's metatable. So it's not finding the index in that table and going to __index which then sets the table's key to be the value of sin and returns it.
[QUOTE=Jawalt;25919876]If the index is not found in the table, __index is called on the table's metatable. So it's not finding the index in that table and going to __index which then sets the table's key to be the value of sin and returns it.[/QUOTE] Adding to this, every time after the first index the cached result will be returned instead of recalculating each time.
[QUOTE=MakeR;25919896]Adding to this: every time after the first index, the cached result will be returned instead of recalculating each time.[/QUOTE] Well yeah, I touched on that with the "if the index is not found part" :P
When Lua tries to access a nonexistent key in a table, it checks for the metafield __index; if it does not find this, it returns nil. __index can be either a table or a function. If it is a table, Lua will index that table with the key and return the result; this is usually how inheritance is implemented in Lua. If __index is a function, Lua will return the result of that function. In the case above, __index is a function that uses the standard math.sin function to calculate the value, stores it in the table and returns it. [editline]7th November 2010[/editline] rate me clocks :argh:
Thanks guys that's pretty handy. What I didn't understand was that __index is called whenever you try to access a key that doesn't exist. But I get it now.
[QUOTE=r0b0tsquid;25919158]Is... is this love? :3:[/QUOTE] No. It is called Memoization (and no I did not forget an 'r' in there). [sp]Some people wax poetic. I wax pedantic[/sp] :smugdog: Pretty cool though :buddy:
NEVER EVER DO THIS [code] while(1) { int *a = new int[1000]; } [/code] I can hardly type this and I need to restart my computer.
[QUOTE=likesoursugar;25920846]NEVER EVER DO THIS [code] while(1) { int *a = new int[1000]; } [/code] I can hardly type this and I need to restart my computer.[/QUOTE] You know by a strange coincidence, I was just planning to write some code to do exactly that! Thank you for this warn, otherwise I would have had to perform a highly inconvenient restart operation!
Sorry, you need to Log In to post a reply to this thread.