Reputation
1,165
Top tag
Next privilege 2,000 Rep.
Edit questions and answers
Badges
3 10
Newest
 Yearling
Impact
~34k people reached

Jan
12
comment Collision resolution when moving in two directions
i'm surprised you seem to re-locate the player at x-/+tileWidth or y-/+tileHeight except for the right where you relocate at x-playerWidth. Could you show what prints when there's the bug ?
Jan
11
comment Area attack collision resolving
If the hit is only considered when the projectile is entering the enemy's BBox / collision geometry, wouldn't it be ok ?
Jan
11
answered Collision resolution when moving in two directions
Jan
10
revised How To generate spiky terrain in 2D?
added 61 characters in body
Jan
10
answered How To generate spiky terrain in 2D?
Jan
7
comment Fixed Time Step Flutter
Ho yes, in the high fps case, i think anyway that one should skip frames ( == lower render rate ) to 60Hz, to avoid the computer heating / the fan going crazy. I once had such a display, and Javascript isn't just efficient enough, the noise/heat/power consumption (for a laptop) is far more annoying than the very little gain in smoothness, especially for a (simple) 2D game. After all, 120Hz is for pro-gamers playing fps mainly. (if i may i posted on codepen about the animation loop : codepen.io/gamealchemist/post/animationcanvas1 )
Jan
6
comment Fixed Time Step Flutter
!! Warning : be prepared to suffer !! : rAF is not synced on screen, it is a timer launched quite at the same time as a vsync, with quite the same duration as the screen fps.... !!!! That's why even with a browser alone on your computer, after a fresh restart, no other tabs, no draw mades, you might still miss a frame if that nasty stuff gets out of sync......
Jan
6
answered Fixed Time Step Flutter
Jan
6
comment Fixed Time Step Flutter
Show more code, it can't be that the updates are skipped 'for a while' : if you just made 2 updates sure you can skip one after maaaaayybe 2, but if it's more than 2 skipped there's an error somewhere.
Dec
23
comment How to avoid cost comparison each and every frame?
furthermore, ... if you update only the mask for the values that changed (see my edit), algorithm becomes not that much a brute force one, -after all, we only update, with one simple boolean operation, the buildables of the change ??? can we do less operations???- and now you divide the update time further down by like 10 or 20 (and near 0 when no change). We're talking a few nanoseconds average time now.
Dec
23
revised How to avoid cost comparison each and every frame?
added 288 characters in body
Dec
23
comment How to avoid cost comparison each and every frame?
See here : jsbin.com/xacetorice/edit?js,console ouput is : "time taken to update mask for 1000 buildables : 0.0849 ms "
Dec
23
revised How to avoid cost comparison each and every frame?
added 4 characters in body
Dec
23
revised How to avoid cost comparison each and every frame?
added 4 characters in body
Dec
23
comment How to avoid cost comparison each and every frame?
Yes, again, in js all this integer crushing will run in no time. Even with 10.000 buildables, i bet that it will run well below 0.1 ms. -problem solved-
Dec
23
answered How to avoid cost comparison each and every frame?
Nov
13
comment How can I scale up sprites but maintain visual quality?
despite all the pessimistic answers and comments, upscale algorithm like HQX or SAI can do a great job in getting big images from small ones, provided you like their somehow cartoonish effect. ( they are already coded here : code.google.com/p/2dimagefilter )
Oct
28
comment How can I calculate current level from total XP, when each level requires proportionally more XP?
'have a million iteration'... For a one-time computation... Done in O(ln(xp))... seriously...
Oct
28
comment How can I calculate current level from total XP, when each level requires proportionally more XP?
Most flexible solution. And since speed doesn't matter for a one-time computation, best one i guess.
Oct
18
comment Calculate angles between two other angles
I guess your problem is to find the objects that have angle segments that intersects with your view angle segment. In a second time you might want to optimize and not draw hidden objects => considering the distances ...