The Daily Click ::. Forums ::. Klik Coding Help ::. How do you make a weapon fire when you press a button, but not too fast?
 

Post Reply  Post Oekaki 
 

Posted By Message

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
24th April, 2011 at 12:54:23 -

Personally, I think you should do what you can to make sure the game will run at full speed on as low a spec computer as possible (include options to disable special effects, etc if need be) - and then if the player's computer isn't fast enough, that's their problem.
There's no point trying to make a game run normally but at slow speed.

 
n/a

Duncan

Thelonious Dunc

Registered
  18/05/2002
Points
  552

VIP Member
24th April, 2011 at 13:29:59 -


There's no point trying to make a game run normally but at slow speed.



But that's what MMF does for everything else by default. Can you really account for everything that might trigger the tinest dip in performance? The inconsistency is just going to lurk in the shadows until it gets an opportunity to break the game.

If a game's perfectly playable with those special effects enabled, but for some reason I can't make a particular jump while something's exploding (edit: or because the midi file playing changes or whatever), I'm going to be inclined to think it's the developer's fault.





Edited by Duncan

 
n/a

nim



Registered
  17/05/2002
Points
  7233
24th April, 2011 at 14:23:16 -

This is an awful lot of talk for such a simple problem. Personally I'd use the method suggested by Assault Andy in the first reply.

 
//

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
24th April, 2011 at 14:39:25 -

So would I

Never use timers.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Eternal Man [EE]

Pitied the FOO

Registered
  18/01/2007
Points
  2955

Game of the Week WinnerHero of TimeLOL SignI am an April Fool
24th April, 2011 at 14:42:18 -

'Cept for when you need to access real time.

 
Eternal Entertainment's Code'n'Art Man

E_E = All Indie


...actually Ell Endie, but whatever.
Image
Image

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
24th April, 2011 at 15:04:21 -

I still wouldn't use timers, since they don't let you access real time anyway (see rest of thread). I'm pretty sure TimeX can get time independent of framerate.

Edited by an Administrator

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
24th April, 2011 at 19:07:20 -

This is how I do it.

http://www.whenthereisnoroominhellthedeadwalktheearth.com/MMF/firingspeedtutorial.mfa

Image

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
25th April, 2011 at 03:12:17 -

Chris - that looks good but remove the "Every 00-01"" from everywhere. Your code will run exactly the same, except it will be consistent on slow machines

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
25th April, 2011 at 06:06:09 -

How slow of a machine are we talking?

I've run games I've made on so many pieces of shit and they still run the same.

But yeah I need to get in that habit of using always instead. Thanks! happy easter

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
25th April, 2011 at 15:12:25 -

Anything that runs below the target FPS will run differently. It's not likely that someone is using a computer that slow, but it's not just that. If you freeze the app (such as with grabbing the title bar - I think), or your computer happens to lag for a second (due to some other process), it will run differently if you use timers. If you use counters/MMF framerate instead then it will run the same on all machines, albeit slower. In your code, there's no point in having the Every 00-01 in there.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Jenswa

Possibly Insane

Registered
  26/08/2002
Points
  2722
25th April, 2011 at 15:35:14 -

I just really like timed events like: every 02'13, they just add some unpredictable behaviour in your game.

But I recommend Andy's method too.

 
Image jenswa.neocities.org

Eternal Man [EE]

Pitied the FOO

Registered
  18/01/2007
Points
  2955

Game of the Week WinnerHero of TimeLOL SignI am an April Fool
25th April, 2011 at 15:49:09 -


Originally Posted by Jenswa
I just really like timed events like: every 02'13, they just add some unpredictable behaviour in your game.

But I recommend Andy's method too.




It's even more unpredictable with a Counter=Random(3276*Random(23)!

 
Eternal Entertainment's Code'n'Art Man

E_E = All Indie


...actually Ell Endie, but whatever.
Image
Image
   

Post Reply



 



Advertisement

Worth A Click