English Amiga Board


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

 
 
Thread Tools
Old 31 October 2015, 22: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, 23:27   #2
Predseda
Puttymoon inhabitant
Predseda's Avatar
 
Join Date: Mar 2007
Location: The City of Townsville
Age: 41
Posts: 5,520
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 01 November 2015, 00: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, 19:58   #4
Lonewolf10
AMOS Extensions Developer
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 40
Posts: 1,923
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 09:33
in-game timer/clock Lonewolf10 Coders. Asm / Hardware 2 26 September 2014 20:59
AMOS timer/clock? Djay Coders. General 7 30 December 2011 21:51
Using timer.device in C (VBCC) DBAlex Coders. General 2 28 June 2011 23:10
Old timer, new member ! cyberknight Member Introductions 14 23 May 2009 12: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 00:00.


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