Page 1 of 2

Mole Hunter <aka Game>

Posted: Thu Nov 06, 2008 5:15 pm
by Mandarancio
***UPDATED AND FIXED***

My first love game, a simple mole hunter mad in 4 day and 500 code lines..
**All artwork [inspired by love web site] and code are under cc license
Try it and say me your oppinion..

UPDATED
RESOLVE THE TIME PROBLEM
DIFFICULT LEVEL ADDED


**DON'T TEST UNDER WINDOWS
**SORRY THE LAST VERSION DON'T RUN.. NOW IS READY TO ENJOY IT

PS: Some help for the music??
Now I think to develop some other game..

Re: Mole Hunter <aka Game>

Posted: Thu Nov 06, 2008 6:59 pm
by Dvondrake
---

Re: Mole Hunter <aka Game>

Posted: Fri Nov 07, 2008 12:19 am
by rude
Graphics after my taste, but why two different versions?

And how did you time this game? The moles seem to be appearing very slowly ...

Re: Mole Hunter <aka Game>

Posted: Fri Nov 07, 2008 9:11 am
by Mandarancio
Post by Dvondrake on Thu Nov 06, 2008 7:59 pm
Very nice! Artwork is great.
Thanks
Graphics after my taste, but why two different versions?

And how did you time this game? The moles seem to be appearing very slowly ...
I made two different version for the problem that you say (the slowly of the moles!)..
On my pc with ati linux driver and love 0.5.0 the game run fast without problem but on my laptop with nvidia linux driver the game was extremely slow and for it I made a simply patch and and a second version of the game more fast.. (if in your system the normal version is slow try the nvidia vesion! Else for set the fast extract the love archive and open the main.lua and here change the k var is very commentated [only it])

Re: Mole Hunter <aka Game>

Posted: Fri Nov 07, 2008 4:46 pm
by rude
Then you problably time things by frames. You can avoid this if you use per-second timing instead. That makes the game independent of the frame rate.

Code: Select all

time_buf = 0

function update(dt)

  time_buf = time_buf + dt

  -- Spawn every two seconds:
  if time_buf > 2 then
     -- spawnMole()
     time_buf = 0
  end 

end

Re: Mole Hunter <aka Game>

Posted: Fri Nov 07, 2008 4:54 pm
by Mandarancio
rude wrote:Then you problably time things by frames. You can avoid this if you use per-second timing instead. That makes the game independent of the frame rate.

Code: Select all

time_buf = 0

function update(dt)

  time_buf = time_buf + dt

  -- Spawn every two seconds:
  if time_buf > 2 then
     -- spawnMole()
     time_buf = 0
  end 

end
I use a counter, exemple:

Code: Select all

time=0
function update(dt) 
   time=time+1
   if time>= 100 then
      makesomething()
   end
end
Is wrong make this?? Is here the problem?

Re: Mole Hunter <aka Game>

Posted: Fri Nov 07, 2008 5:00 pm
by rude
Yes, that code calls makesomething() every 100 frames. If you have a fast computer with vsync disabled, you may get 1000 FPS, in which case stuff happens really fast. If you have a slow computer (or vsync enabled), then stuff will happen more slowly.

You need to include "dt" somehow. This code, for instance, calls makesomething() each 100 seconds.

Code: Select all

time=0
function update(dt) 
   time=time + 1*dt
   if time >= 100 then
      makesomething()
      time = 0
   end
end
EDIT: Yes, bartbes is right, you don't want to wait 100 seconds, but I wanted to modify the code as little as possible.

Re: Mole Hunter <aka Game>

Posted: Fri Nov 07, 2008 5:01 pm
by bartbes
That is per frame, as rude said, you should use

Code: Select all

time=time+dt
That gives time the time in seconds (so you should lower 100 too as you don't want to wait 100 seconds)

EDIT: rude typed just a little bit faster :D

Re: Mole Hunter <aka Game>

Posted: Fri Nov 07, 2008 6:33 pm
by Mandarancio
Ok thanks to all!! Now I go to fix the bug!!

Re: Mole Hunter <aka Game>

Posted: Fri Nov 07, 2008 8:01 pm
by farvardin
it looks so cool and lovely!

unfortunately, both version have problem on my computer: the nvidia version is too fast for the coming of the moles, and the ati version is too slow. And after a while, both increase my cpu load to it's not playable at all (the mouse becomes slow and choppy)

I'm testing this under kde4 and with the nvidia driver, it's try it without (kde4)

Really nice design anyway.