Search found 1911 matches

by ivan
Tue Aug 16, 2011 2:48 pm
Forum: Support and Development
Topic: Lua local question
Replies: 33
Views: 15360

Re: Lua local question

function my_func(someArg) local someArg = someaArg or 'someDefaultValue' end I think you mean someArg instead of some a Arg :) Am I right that the first version should use local, but not the second? You don't need to declare the local in the first example. In fact some languages (like Python I thin...
by ivan
Tue Aug 16, 2011 2:28 pm
Forum: Support and Development
Topic: Maximum number of vertices in polygon shapes
Replies: 6
Views: 2920

Re: Maximum number of vertices in polygon shapes

it would be nice if Love let us change that like it's possible with Box2D You can't change most of Box2D's constants without rebuilding the entire library. Over the years I've noticed that you don't really need to change those constants 99% of the time. In general, 8 vertices is a lot for a convex ...
by ivan
Mon Aug 15, 2011 2:43 pm
Forum: Support and Development
Topic: Stuck with Tile Loading and threads.
Replies: 5
Views: 1289

Re: Stuck with Tile Loading and threads.

I would humbly point out that if your game is going to be as complex as you've described, tile transitions are going to be your least worry.
by ivan
Mon Aug 15, 2011 8:31 am
Forum: Support and Development
Topic: Stuck with Tile Loading and threads.
Replies: 5
Views: 1289

Re: Stuck with Tile Loading and threads.

I think your general approach is too complicated. I would suggest getting your mind off the project for a few days and coming back to it with a fresh look. First off, if this is supposed to be a prototype, you should focus on the gameplay instead of the rendering implementation. Second, I'm not sure...
by ivan
Fri Aug 12, 2011 8:17 am
Forum: General
Topic: Lua Performance Tips
Replies: 39
Views: 21139

Re: Lua Performance Tips

Interesting results. I do have a couple of criticisms however: for n=1,cycles do local test = CLASS.test This is an extra assignment which is not present in the "localize_method_no" test. I would change it to: local test = CLASS.test for n=1,cycles do - Strangely, custom unpack function is...
by ivan
Thu Aug 11, 2011 1:27 pm
Forum: General
Topic: Lua Performance Tips
Replies: 39
Views: 21139

Re: Lua Performance Tips

I understand. It's faster but not so fast that you have to care unless you're doing lots of calls to the same function in one specific place. Yep, for example: for i = 1, 100 do love.graphics.print(i, i*10, 10) end Would be slower than: local print = love.graphics.print for i = 1, 100 do print(i, i...
by ivan
Thu Aug 11, 2011 1:18 pm
Forum: General
Topic: Lua Performance Tips
Replies: 39
Views: 21139

Re: Lua Performance Tips

Code: Select all

local print = love.graphics.print()
I think you mean:

Code: Select all

local print = love.graphics.print
The biggest performance drop in Lua that I've noticed is from creating unnecessary tables (for example in a loop) that get destroyed right away.
by ivan
Sat Aug 06, 2011 2:22 pm
Forum: Support and Development
Topic: Fail maths.
Replies: 27
Views: 3272

Re: Fail maths.

I noticed this when porting some code from the AGen engine.
Happens with integers as well as floats.
by ivan
Fri Aug 05, 2011 8:10 am
Forum: General
Topic: Short article on AI
Replies: 7
Views: 3976

Re: Short article on AI

Check it out, I have a new demo of the AI system. The demo is a simple Asteroids-like game. The arrow keys move your little ship and Z shoots. Enemy AI code: local hit = ai:Sequence ( false ) hit:Push ( ai:ReceiveMSG ( "shot" ) ) hit:Push ( ai:MoveTo ( x, y ) ) local goal = ai:Parallel ( t...
by ivan
Mon Jul 25, 2011 2:18 pm
Forum: Libraries and Tools
Topic: Simple midpoint displacement terrain generation
Replies: 9
Views: 4356

Re: Simple midpoint displacement terrain generation

Hey, that's pretty cool, tentus. However, I left a bug in the code while porting it to Love2D. In theory, map sizes should be power of 2 + 1 (513x513 instead of 512x512). Notice the commented assertion: --local pow2 = (nw - 1)/2 --assert(math.floor(pow2) == pow2) Also, the displacement variable (dis...