English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. AMOS

 
 
Thread Tools
Old 31 October 2015, 21:57   #1
volvo_0ne
Registered User
 
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
=Timer= woes.

I'm currently getting back into Amos, but just encountered a minor setback...

I need a constant timer which is reset for each subgame completion, after which I need to reset the (AMOS)Timer.

Which is fine, however it also affects the RND seed, causing predictable sequences.

Short of writing my own ticker/timer follower for my usage (which will obviously slow things down) has anyone any ideas how to avoid this issue?

Pseudo code example

1 set Timer=0
2 Print timer
3 do something random <----- no longer very random
4 loads of other AMOS stuff
5 collision > goto 1
6 goto 2 else end


I'd like to do this without much overhead to alleviate the "no longer very random " bit

Anyone any good ideas?

TIA
volvo_0ne is offline  
Old 31 October 2015, 22:27   #2
Predseda
Puttymoon inhabitant
 
Predseda's Avatar
 
Join Date: Mar 2007
Location: Tromaville
Age: 46
Posts: 7,544
Send a message via ICQ to Predseda
How this affects random seed? It generates always the same value in RND command?
Predseda is offline  
Old 31 October 2015, 23:00   #3
volvo_0ne
Registered User
 
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
Quote:
Originally Posted by Predseda View Post
How this affects random seed? It generates always the same value in RND command?
Yes, because the game loop is synchronised to the VBL (as far as possible) to keep timing constant.

Stops typing.............

Bangs forehead on keyboard...........

Just realises to take random number BEFORE resetting Timer!

I feel more than a bit stupid now....

Sorry for wasting your time.

volvo_0ne is offline  
Old 02 November 2015, 18:58   #4
Lonewolf10
AMOS Extensions Developer
 
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
Yes, the usual way to get a random number is to use a timer to count how long it takes a user to start the game (e.g. length of time title screen is displayed). You can use RND to generate random(ish) numbers too.
Lonewolf10 is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
555 timer A600 Michel support.Hardware 8 25 July 2016 08:33
in-game timer/clock Lonewolf10 Coders. Asm / Hardware 2 26 September 2014 19:59
AMOS timer/clock? Djay Coders. General 7 30 December 2011 20:51
Using timer.device in C (VBCC) DBAlex Coders. General 2 28 June 2011 22:10
Old timer, new member ! cyberknight Member Introductions 14 23 May 2009 11:07

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:34.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.17521 seconds with 13 queries