Search found 20 matches

by inJuly
Tue Jun 02, 2020 2:18 pm
Forum: Support and Development
Topic: Is cache friendly ECS possible in Lua ?
Replies: 2
Views: 4376

Re: Is cache friendly ECS possible in Lua ?

Here's one: https://github.com/tjakka5/Concord Didn't look too deep into it, maybe it doesn't use FFI, but it's probably still fast enough. If one wrote an ECS with LuaJIT's FFI, supporting C types including structs and arrays, LuaJIT *might* be a bit better in terms of memory layout and caching th...
by inJuly
Tue Jun 02, 2020 11:52 am
Forum: Support and Development
Topic: Is cache friendly ECS possible in Lua ?
Replies: 2
Views: 4376

Is cache friendly ECS possible in Lua ?

Since Lua only has tables, which are associative arrays, the components might never be right next to each other in memory / cache.
Is it possible to implement fast ECS ? If not then what are some alternatives in terms of development ease and modularity.
by inJuly
Fri May 22, 2020 10:53 am
Forum: Support and Development
Topic: bug when trying to rotate gun to mouse cursor position using math.atan ?
Replies: 3
Views: 643

Re: bug when trying to rotate gun to mouse cursor position using math.atan ?

These special cases are precisely what math.atan2 is for :) Well, that, and also to be more accurate. You can simply use: local angle = math.atan2(love.mouse.getY() - y, love.mouse.getX() - x) I actually did try that. But that led to weird stuff happening like this: https://cdn.discordapp.com/attac...
by inJuly
Fri May 22, 2020 7:33 am
Forum: General
Topic: Removing a table from another table
Replies: 5
Views: 3948

Re: Removing a table from another table

If you're using a table as an array/ list then you can simply keep track of the index and call table.remove(objects, index), and it will remove the element at that index and adjust the indices of other elements accordingly. Or, you could do this safely by traversing the table from last to first (thi...
by inJuly
Fri May 22, 2020 6:37 am
Forum: Support and Development
Topic: Trying to create a camera like this game (Nuclear Throne).
Replies: 1
Views: 489

Trying to create a camera like this game (Nuclear Throne).

Nuclear throne is a topdown 2D shooter roguelike that has a camera which isn't centered on the player. Instead it moves slightly towards the mouse cursor. screenshot: https://media.discordapp.net/attachments/703408354223194165/713278095225782292/unknown.png So there was this unity tutorial on how on...
by inJuly
Thu May 21, 2020 6:46 pm
Forum: Support and Development
Topic: bug when trying to rotate gun to mouse cursor position using math.atan ?
Replies: 3
Views: 643

Re: bug when trying to rotate gun to mouse cursor position using math.atan ?

UPDATE: Okay so I found a fix which is a nasty if else statement . Basically just check if the angle is negative when it shouldn't be (based on mouse pos) and multiply by -1 if self.owner.faceDir == 1 then if angle < 0 and mouseY > screenY then angle = -1 * angle end else if angle < 0 and mouseY < s...
by inJuly
Thu May 21, 2020 6:33 pm
Forum: Support and Development
Topic: bug when trying to rotate gun to mouse cursor position using math.atan ?
Replies: 3
Views: 643

bug when trying to rotate gun to mouse cursor position using math.atan ?

I am trying to create a cheap knock off of nuclear throne's mechanics. I was trying to get my character's gun to rotate and face the mouse, and it works but faces the opposite direction in a particular condition. Here is what I mean : https://media.discordapp.net/attachments/703408354223194165/71309...
by inJuly
Mon May 11, 2020 12:51 pm
Forum: Support and Development
Topic: How do I make the screen have a glitchy effect
Replies: 2
Views: 952

Re: How do I make the screen have a glitchy effect

4vZEROv wrote:
Sat May 09, 2020 12:33 pm
You could use shaders to do that.
This website have a lot of them, with the source code: https://www.shadertoy.com/results?query=glitch

The syntax is nearly the same as love shaders (https://love2d.org/wiki/Shader) so you can convert it and it will work fine.
Thanks ! That's an awesome site.
by inJuly
Sun May 10, 2020 4:17 pm
Forum: Support and Development
Topic: [Solved][Includes Example] Checking collisions and jumping around
Replies: 7
Views: 1340

Re: [Solved][Includes Example] Checking collisions and jumping around

If you want to learn how to handle physics and collisions, these are a couple of things you should learn:

1. AABB collision detection (just brute force in your first few games)
2. Sweep and prune
3. Fixed Resolution grids
4. Quadtrees or BSP Trees or k-d trees (Personally gonna recommend quadtrees)
by inJuly
Sun May 10, 2020 4:08 pm
Forum: Games and Creations
Topic: A short puzzle game (Bonkyon)
Replies: 3
Views: 4563

Re: A short puzzle game (Bonkyon)

AndyDuff wrote:
Sat May 09, 2020 10:22 pm
Nice work! I like the puzzle concept. I like how the game becomes more intuitive the more you play it. Simple graphics and sound/music, but works well.
thanks !