Search found 3586 matches

by pgimeno
Mon May 27, 2024 8:13 pm
Forum: General
Topic: Messed up variable with connecting block textures
Replies: 5
Views: 248

Re: Messed up variable with connecting block textures

What does this mean exactly? Sorry, I'm not the best programmer ahah. How could I change the code in order to prevent something like this? Like I said, I'm not sure at all what's actually causing this in the generateTerrain code. OK, I've finally understood what's going on here. The problem is as f...
by pgimeno
Sun May 26, 2024 3:52 pm
Forum: General
Topic: Messed up variable with connecting block textures
Replies: 5
Views: 248

Re: Messed up variable with connecting block textures

Well, I've added this to main.lua right after generateTerrain, to see the map structure: for i = 1, #self.ents[1] do io.stdout:write(self.ents[1][i].id) if i % self.worldW == 0 then io.stdout:write("\n") end end The output was: 11111111111111111111111111111111 22222222222222222222222222222...
by pgimeno
Sun May 26, 2024 12:38 pm
Forum: Support and Development
Topic: How to prevent drifting from analog movement?
Replies: 3
Views: 187

Re: How to prevent drifting from analog movement?

Here's a function to do what MrFariator said. Generally, I'm all for teaching how to fish instead of giving fish, but I made an exception in this case because it's not easy for everyone to work out the linear transform that makes the dead zone work. In addition, the most common formulation may suffe...
by pgimeno
Sun May 26, 2024 5:21 am
Forum: General
Topic: Messed up variable with connecting block textures
Replies: 5
Views: 248

Re: Messed up variable with connecting block textures

Hello, welcome to the forums. Your comparison works for me. I've converted your snippet to a whole program by adding a line before and a few lines after your code, like this: local Block = {} function Block:update(t,state,dt) -- check adjacencies and update self.merge -- v (self) for i = 1, #t do lo...
by pgimeno
Wed May 22, 2024 6:26 pm
Forum: Support and Development
Topic: How do you really tell if your game has a memory leak?
Replies: 23
Views: 2192

Re: How do you really tell if your game has a memory leak?

Its interesting that at doesnt crash at least. And that's my point: there comes a point where the garbage generation rate equals the garbage collection rate, and past that point, memory stops growing. The problem is the number of objects generated at that point, and the space occupied by each. The ...
by pgimeno
Wed May 22, 2024 8:40 am
Forum: Support and Development
Topic: How do you really tell if your game has a memory leak?
Replies: 23
Views: 2192

Re: How do you really tell if your game has a memory leak?

It takes a few minutes on my 4gb system. And top doesnt properly show it, i can not explain the behaviour but this code will crash all my systems veryfiying that this code does in fact not release its memory. I left it running for over an hour, and the love executable didn't reach 8 GB according to...
by pgimeno
Tue May 21, 2024 10:29 pm
Forum: Support and Development
Topic: How do you really tell if your game has a memory leak?
Replies: 23
Views: 2192

Re: How do you really tell if your game has a memory leak?

Regardless of what people want to call this, it does sound problematic as you have to explicitly call collectgarbage() before the program crashes, which isn't obvious if you expect the garbage collector kicking in on its own after a while. Not really. Just adding a line before newFont, like the fol...
by pgimeno
Tue May 21, 2024 8:05 pm
Forum: Support and Development
Topic: How do you really tell if your game has a memory leak?
Replies: 23
Views: 2192

Re: How do you really tell if your game has a memory leak?

Even if your entire program is just Font = love.graphics.newFont( 12) Font = love.graphics.newFont( 21) In my book thats a memory leak, those two lines cause a memory leak. Because it fits the definiton of "not freeing unused data". And thats the whole thing, this line, it fits so it is. ...
by pgimeno
Tue May 21, 2024 7:45 am
Forum: Support and Development
Topic: How do you really tell if your game has a memory leak?
Replies: 23
Views: 2192

Re: How do you really tell if your game has a memory leak?

This is the very definition of a memory leak. And of course its not anymore if you call garbage collect, i mean.... thats the point. What are you trying to say here? A memory leak consists of memory that is never released. The difference with what I'm saying is that garbage collection would eventua...