Random things occur after playing Hexen2 ?:D?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
pacman
Citizen
Posts: 81
Joined: Thu Mar 14, 2013 4:10 pm

Random things occur after playing Hexen2 ?:D?

Post by pacman »

I tried play my game on 3 computers.
Macbook pro (RIP in pieces you useless junk :3 ), old PC with shady hard drives aaaaand much older laptop.
I was able to fix some issues here and there but there is one problem that doesn't even make sense...

Problem occurs on the old PC. Windows XP.
Game works flawlessly after restarting windows but after some usage (Hexen2, browsing interwebz, whatever else) the game is freaking out.

Here's a screen from broken game.
https://dl.dropboxusercontent.com/u/876 ... roblem.png
It randomly gives me ~0.1 to vertical position :? Only on one PC and only after doing something completly unrelated to the game itself :F

Other thing that gets #rekt happens when I'm standing on stairs.
player.invulnerableTime = 0
It goes up ONLY when you're getting hit and goes down every frame. When it's higher than 0, player is flashing red.
After "Hexening" the PC the player flashes red for one frame randomly. Poped up the invulnerableTime on screen and it goes up randomly for no reason... It just happenes.

Is this even possible? It shouldn't, right? :emo:
My PC is :halloween:
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Random things occur after playing Hexen2 ?:D?

Post by kikito »

Are you using [wiki]dt[/wiki] to handle time everywhere? Could it be that you are using it in some places and not in others? If that was the case, a very fast PC might appear to work ok (since all dts would be similar to 0) but on a slower machine the differences would become apparent (some things would remain close to 0 while others would start to take time).

Show us a .love and we'll probably be able to help you much more.

Nice graphics, BTW :)
When I write def I mean function.
User avatar
pacman
Citizen
Posts: 81
Joined: Thu Mar 14, 2013 4:10 pm

Re: Random things occur after playing Hexen2 ?:D?

Post by pacman »

I intend to use dt everywhere - that what I know ;)

It works well on the fastest and the slowest PC I tried :E
Tried to run this game before attaching here and daym... I cliped through the ground and everything was a mess. Restarted PC and works as intended...
Attachments
whatisaman.love
(4.63 MiB) Downloaded 109 times
User avatar
moikmellah
Prole
Posts: 12
Joined: Fri Jan 31, 2014 8:31 pm
Location: USA
Contact:

Re: Random things occur after playing Hexen2 ?:D?

Post by moikmellah »

Hello!

I've experienced very similar issues with my game - the 'clipping through the floor' part sounded especially familiar. What's happening is probably a symptom of varying framerates; you should try showing the output of love.timer.getFPS() onscreen to see what the framerate is both when the game is behaving properly and when it's spazzing out.

In my case, it was because I was checking only the tile the character was colliding with after moving to Y + (velocity * dt), which only works if your character is guaranteed to move less than tileHeight per frame. The problem actually cropped up on an old netbook, which ran my game at a lower framerate (so dt was much larger, and my character was moving farther than I had expected per frame). Try something like this instead:

Code: Select all

local yMovement = self.yVelocity * dt

local yTiles = math.floor(yMovement / map.tileHeight)

local tileHit = false

-- Step through tiles in whole increments of tileHeight
for yCounter = 1,yTiles do
  local nextY = self.y + (yCounter * map.tileHeight)
  -- substitute your collision check here instead of checkCollision()
  tileHit = checkCollision(self.x, nextY)
  if tileHit then
    --insert collision logic here
    break
  end
end

-- Didn't hit any tiles yet, check final position
if not(tileHit) then
  local nextY = self.y + yMovement
  -- substitute your collision check here instead of checkCollision()
  tileHit = checkCollision(self.x, nextY)
  if tileHit then
    --insert collision logic here
    break
  end
end
Rough, but I hope it gets my point across - you should step through in whole increments of one tile and check for collisions in each position, rather than jumping by yVelocity + dt and only checking the destination tile. That way, no matter how far your character is moving per frame, you're guaranteed to hit the first block you travel through.

Hope this helps!
User avatar
pacman
Citizen
Posts: 81
Joined: Thu Mar 14, 2013 4:10 pm

Re: Random things occur after playing Hexen2 ?:D?

Post by pacman »

Wow that's great way to deal with cliping through walls :awesome:
I had this problem but I "hacked" it with

Code: Select all

if dt > 0.05 then dt = 0.005 end
Definitely will apply the 1337 hax0r style next time :)

I checked the FPS and it sits on ~480.
But in conf.lua I have

Code: Select all

t.window.vsync = true
and then in main.lua

Code: Select all

love.window.setMode(windowWidth * scale, windowHeight * scale, {vsync=true})
Shouldn't it be caped at 60? :?

Anyway, it's not a problem with collision detection :c

The problem is that the game adds something to variables... Like this Y-position or invulnerableTime.
Who knows, maybe the game is okaaaaaay...? :F
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 5 guests