Search found 223 matches

by dreadkillz
Mon Nov 19, 2012 2:16 pm
Forum: General
Topic: Love performance comparison/question.
Replies: 9
Views: 6597

Re: Love performance comparison/question.

Was this benchmark done with LuaJIT? It probably would help boost the score by a lot but I'd imagine we still end up last.
by dreadkillz
Sat Nov 17, 2012 5:27 pm
Forum: Libraries and Tools
Topic: [snippet] Box-segment intersection
Replies: 4
Views: 3437

Re: [snippet] Box-segment intersection

It's good. Hopefully this will be the first thing people see when they search on how to do line box intersection test.
by dreadkillz
Sat Nov 17, 2012 12:06 am
Forum: Libraries and Tools
Topic: [Snippet] Generic raycasting/line + demo! *1.0*
Replies: 2
Views: 1921

Re: [Snippet] Generic raycasting/line algorithm

I didn't really care enough to write a demo. Just wanted to share some code that people might find useful. Raycasting is technically the correct term I'm using. Raycasting involves shooting one ray and returning whatever hits it. Raytracing involves graphics and shooting "many" rays to cr...
by dreadkillz
Fri Nov 16, 2012 6:26 pm
Forum: Support and Development
Topic: get class name as string.
Replies: 5
Views: 2911

Re: get class name as string.

Oh I see. You can just have your exit table passed as an argument to your class method. Store the class name of each table under className or something similar. Any argument you pass to your instance function are passed to your class function through __index event (if the instance doesn't have that ...
by dreadkillz
Fri Nov 16, 2012 5:38 pm
Forum: Support and Development
Topic: get class name as string.
Replies: 5
Views: 2911

Re: get class name as string.

Code: Select all

t = setmetatable({},{__tostring = function() return 'hi' end})
print(t)
http://lua-users.org/wiki/MetatableEvents
by dreadkillz
Fri Nov 16, 2012 1:34 pm
Forum: General
Topic: Correct way to play sounds?
Replies: 17
Views: 8561

Re: Correct way to play sounds?

Being able to stop a sound is also equally important. With repeatable calls to the same object, how would one be able to stop a specific instance of that sound? Playing a sound would need to return a generated id which you can use to stop a sound.
by dreadkillz
Fri Nov 16, 2012 1:26 pm
Forum: General
Topic: 2D Collissions algorithms performance
Replies: 6
Views: 1901

Re: 2D Collissions algorithms performance

There is no free lunch. What cycle time you save using a collision pruning algorithm will more than make up what you lose doing it. For 1000 object pair brute force checking will require 1000^2/2 checks! If you're worried about performance lost with cell based collision pruning, don't. Go for the ce...
by dreadkillz
Fri Nov 16, 2012 12:36 am
Forum: Support and Development
Topic: Help me with some ray-tracing math
Replies: 21
Views: 10958

Re: Help me with some ray-tracing math

I can't seem to break it now. I'm swinging my mouse everywhere. I don't know what you mean by up 6 right 2. Can you give an exact origin and end point? I'll try to debug some more. At least the horizontal problem is fixed. I honestly can't see anything else wrong with your code. EDIT: It needs to be...
by dreadkillz
Fri Nov 16, 2012 12:11 am
Forum: Support and Development
Topic: Help me with some ray-tracing math
Replies: 21
Views: 10958

Re: Help me with some ray-tracing math

Try this: function gridSegment(cellSize, x1,y1, x2,y2) local x, y = toGrid(cellSize, x1,y1) local ox, oy = toGrid(cellSize, x2,y2) local vx, vy = x2 - x1, y2 - y1 local stepX, stepY = sign(vx), sign(vy) local deltaX, deltaY = abs(cellSize / vx), abs(cellSize / vy) local maxX = ((x + (vx > 0 and 0 or...
by dreadkillz
Thu Nov 15, 2012 8:07 pm
Forum: Support and Development
Topic: Help me with some ray-tracing math
Replies: 21
Views: 10958

Re: Help me with some ray-tracing math

I'm not at my home computer right now. I'll check again and post corrections in a couple of hours.