Search found 1818 matches

by pgimeno
Fri Sep 20, 2019 11:05 pm
Forum: Support and Development
Topic: a super fast AABB collision detection ( Minkowski Sums )
Replies: 13
Views: 1194

Re: a super fast AABB collision detection ( Minkowski Sums )

My main problem that our project needed a 3D collision detection. So I had to add extra checks for another dimension. Now I made some funcs to check all collisions of combinations of dimensions I need. Our game has not much entities. I even split enemy batches. So the simple approach looks more cle...
by pgimeno
Wed Sep 18, 2019 11:26 pm
Forum: General
Topic: Concatenation and garbage
Replies: 5
Views: 439

Re: Concatenation and garbage

LuaJIT is the one we're interested in here. I've shown that it generates bytecode consistent with right associativity and that it has an opcode that joins several strings at once, like Lua does. I don't need to check the LuaJIT source code in order to infer that Mike Pall realized that this optimiza...
by pgimeno
Wed Sep 18, 2019 11:09 pm
Forum: Support and Development
Topic: a super fast AABB collision detection ( Minkowski Sums )
Replies: 13
Views: 1194

Re: a super fast AABB collision detection ( Minkowski Sums )

The Minkowski difference reduces rectangle-rectangle interaction to point-rectangle interaction, which IMO is easier to process and reason through. It helps, for example, with swept collision checking, as you only have to check a line segment against each box, rather than a moving box.
by pgimeno
Wed Sep 18, 2019 1:07 pm
Forum: Support and Development
Topic: a super fast AABB collision detection ( Minkowski Sums )
Replies: 13
Views: 1194

Re: a super fast AABB collision detection ( Minkowski Sums )

Bump uses the closely related Minkowski difference method, both to detect and to resolve collisions.
by pgimeno
Wed Sep 18, 2019 1:03 pm
Forum: General
Topic: Concatenation and garbage
Replies: 5
Views: 439

Re: Concatenation and garbage

Fair enough. I've edited the statement to be more precise. The source code clearly gathers as many as possible without generating intermediate concatenated strings. https://www.lua.org/source/5.1/lvm.c.html#luaV_concat From the source of luaV_tostring (https://www.lua.org/source/5.1/lvm.c.html#luaV_...
by pgimeno
Wed Sep 18, 2019 11:32 am
Forum: General
Topic: Concatenation and garbage
Replies: 5
Views: 439

Concatenation and garbage

I wanted to share something that I've discovered about how Lua handles concatenation, which may be useful if you worry about writing optimized code. I noticed in the Lua manual that the concatenation operator is right associative. The operation itself is associative: you get the same result from ("a...
by pgimeno
Tue Sep 17, 2019 11:24 pm
Forum: Support and Development
Topic: is it necessary to "free" texture data / love.graphics.Image ?
Replies: 8
Views: 581

Re: is it necessary to "free" texture data / love.graphics.Image ?

I've found that in a similar situation, if I didn't force garbage collection, the memory grew and grew out of control until the memory was completely filled. My hypothesis is that, since Lua does not know the size of the underlying object, it doesn't care that there are many big ones waiting to be g...
by pgimeno
Tue Sep 17, 2019 9:37 am
Forum: Support and Development
Topic: Detecting Input Without Window Focus (Listen For Input In The Background)
Replies: 5
Views: 577

Re: Detecting Input Without Window Focus (Listen For Input In The Background)

The whole concept of focus is about where to send input events, isn't it? Imagine you are typing in an editor, then change window to a web form, and what you type in the web form is typed in the editor. [EDIT: Or that you press F1 for help in one application, and every other open application opens t...
by pgimeno
Mon Sep 16, 2019 11:37 am
Forum: Games and Creations
Topic: Chessboard
Replies: 19
Views: 3557

Re: Chessboard

Well done. Like I mentioned, the "standard" Lua way is to move your code in a module. Example of a stateless module: local lib = {} function lib.movePiece(board, from,to) .. end function lib.getPiece(board, position) .. end return lib Just a nitpick, this is not stateless in itself. The library is ...