Search found 1193 matches

by ivan
Sun Feb 25, 2018 1:30 pm
Forum: Support and Development
Topic: Referencing object functions?
Replies: 10
Views: 559

Re: Referencing object functions?

Great find Grumps, I've used your solution since it's much cleaner than the "dummy" option mentioned before. I know it's not considered proper, but I like to add extra functions to box2d objects, for example "wrapping" prismatic joints so they loop: local reg = debug.getregistry() function reg.Prism...
by ivan
Sat Feb 24, 2018 9:51 pm
Forum: Games and Creations
Topic: BYTEPATH
Replies: 3
Views: 148

Re: BYTEPATH

Cheers, it's a cool-looking game. :)
by ivan
Sat Feb 24, 2018 3:06 pm
Forum: Games and Creations
Topic: Game Dev Studio - a game dev sim, with focus on employees (now on Steam)
Replies: 7
Views: 256

Re: Game Dev Studio - a game dev sim, with focus on employees (now on Steam)

Congratulations! Having your game released on Steam is a great milestone. Much respect to you as a fellow dev. But as I player going over the trailer and screenshots - I have to say that it's very hard to stand out on Steam. Was really hoping for a more lighthearted direction, with puns and referenc...
by ivan
Thu Feb 22, 2018 7:28 am
Forum: Support and Development
Topic: Collision detection problem
Replies: 4
Views: 117

Re: Collision detection problem

If you want to remove elements from a table during iteration, you have to iterate in reverse:

Code: Select all

for i = #list, 1, -1 do
  if some condition then
    table.remove(list, i)
  end
end
by ivan
Wed Feb 21, 2018 2:02 pm
Forum: Support and Development
Topic: Apply noise to bounce
Replies: 4
Views: 141

Re: Apply noise to bounce

You can use preSolve to decide how your ball/paddle collision is resolved. If you were to randomize the restitution and friction of the collision, you will get randomness that looks more or less plausible. Make sure to use "Contact:setFriction" and "Contact:setRestitution" (friction affects the tang...
by ivan
Sat Feb 17, 2018 6:48 pm
Forum: Support and Development
Topic: resize image at load
Replies: 4
Views: 158

Re: resize image at load

1. Yes, that should work, but it scales your image by a fraction so scale = 2 would draw your object twice as large. Exporting your image at 400% is not good because it wastes RAM and is slower to load. If you want to scale multiple sprites, there is also: love.graphics.scale 2. It's not a big deal ...
by ivan
Sat Feb 17, 2018 4:05 pm
Forum: Support and Development
Topic: resize image at load
Replies: 4
Views: 158

Re: resize image at load

Ok, so there are a few simple solutions but you're not going to like them. 1. You can resize/scale images while drawing 2. Don't base your game logic on images and how you draw things. Just use custom units for your game logic, like meters and convert those to pixels when you want to draw stuff. If ...
by ivan
Sun Feb 11, 2018 12:44 pm
Forum: Support and Development
Topic: Equivalent to Gamemaker's sign() function?
Replies: 39
Views: 1069

Re: Equivalent to Gamemaker's sign() function?

Also, if you want the test to be deterministic, we need to either move math.rand outside of the test function or: local function benchmark(iter, fn) math.randomseed(0) ... The branching variant is the fastest on my machine btw. After localizing math.min/math.max, the branching version is still the f...
by ivan
Sat Feb 10, 2018 5:46 pm
Forum: Support and Development
Topic: Equivalent to Gamemaker's sign() function?
Replies: 39
Views: 1069

Re: Equivalent to Gamemaker's sign() function?

Lua is an interpreted language running in a virtual machine.
While the Lua bytecode could be optimized using LuaJIT it's still running in a VM.
The VM alone adds all sorts of overhead. :)
by ivan
Sat Feb 10, 2018 4:26 pm
Forum: Support and Development
Topic: Equivalent to Gamemaker's sign() function?
Replies: 39
Views: 1069

Re: Equivalent to Gamemaker's sign() function?

Both * and / are quite costly for floating numbers, if LuaJIT can't help to optimize. A simple branching like grump's version could be more efficient. I'm not an expert at LuaJIT, but Lua is an interpreted language so I it's kind of silly to talk about float point operations being costly. Things li...