Search found 1722 matches

by ivan
Mon May 10, 2021 6:41 am
Forum: General
Topic: Using assert to establish pre/post conditions?
Replies: 4
Views: 90

Re: Using assert to establish pre/post conditions?

-- I'm not testing for nil because that would throw a runtime error and will be instantly obvious anyway. You are on the right path there - that's why you should rarely assert the "type" of the parameters. Also make sure you only assert parameters that are coming from an external source. ...
by ivan
Sun May 02, 2021 5:52 am
Forum: Support and Development
Topic: One for the mathematicians: mapping screen click to iso grid
Replies: 4
Views: 666

Re: One for the mathematicians: mapping screen click to iso grid

It's possible to do this using just math (without a bitmap mask), but it depends on the tilt of the tile.
A while ago I wrote a short tutorial on:
https://2dengine.com/?p=isometric#Mouse ... tile_index
by ivan
Thu Apr 29, 2021 12:55 pm
Forum: General
Topic: How to reduce size of final build?
Replies: 2
Views: 608

Re: How to reduce size of final build?

The way you zip the love file can also affect its final size. Make sure to choose the slowest and highest level of compression. PNGGauntlet can reduce the size of PNGs considerably and FLAC/OGG is considerably smaller than WAVs. You could also try minifying the Lua code, using something like https:/...
by ivan
Fri Apr 09, 2021 10:43 am
Forum: Games and Creations
Topic: Point in triangle
Replies: 3
Views: 836

Re: Point in triangle

If I remember correctly from Ericson's book, it may be possible to do even further performance optimizations - but you have to know the triangle's winding/orientation in advance.
by ivan
Thu Apr 08, 2021 5:12 pm
Forum: Games and Creations
Topic: Point in triangle
Replies: 3
Views: 836

Re: Point in triangle

Hello, I haven't tested your code, but I think there are a lot simpler and more efficient ways to test if a point is inside a triangle: https://2dengine.com/?p=intersections#Point_inside_triangle The issues with your code are: 1. The intermediate a,b,c tables. That's very inefficient 2. No "ear...
by ivan
Sat Apr 03, 2021 2:30 pm
Forum: Ports
Topic: Love.js - A Direct Emscripten Port
Replies: 207
Views: 258600

Re: Love.js - A Direct Emscripten Port

I have a followup update on the LoveJS Web player. It can now load files from arbitrary locations: example.com/lovejsplayer/?g=path/to/my/game.love The supplied path is relative to the lovejsplayer's install directory (cross-domain requests will not work) Some additional arguments: &f=1 disables...
by ivan
Wed Mar 31, 2021 5:08 pm
Forum: Support and Development
Topic: Enforce just one instance?
Replies: 21
Views: 6116

Re: Enforce just one instance?

Yea, I hear you grump. I'm not in a rush, but file locking seems like a super basic operation that should be available in love.filesystem by default
by ivan
Wed Mar 31, 2021 12:42 pm
Forum: Support and Development
Topic: Enforce just one instance?
Replies: 21
Views: 6116

Re: Enforce just one instance?

The socket solution is clever but it's hacky.
We need to open an issue request to include love.filesystem.lock in the next version of love2d.
lfs.lock seems to available in similar libraries
by ivan
Mon Mar 22, 2021 8:50 am
Forum: General
Topic: Example code of Platformer AI
Replies: 15
Views: 6446

Re: Example code of Platformer AI

I want to see any type of enemy AI that can jump gaps and walls. You answered your own question there, you are looking for path finding and possibly obstacle avoidance. When working with tile-based maps you can just check how large the gap is easily and determine if the player can jump over it. Hav...
by ivan
Sun Mar 21, 2021 1:20 pm
Forum: Support and Development
Topic: Enforce just one instance?
Replies: 21
Views: 6116

Re: Enforce just one instance?

A simple way would be to have your project create a file when opened, and delete it before it quits (there's a callback for the latter) Yes, I use this method too, although you have to check if that file is locked or not. If the file is there but it's not locked then the previous instance has eithe...