Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Random point generation

 
Post new topic   Reply to topic Printable version
 View previous topic  Help - Patch Application Post :: Post Windows ASSS Help  View next topic  
Author Message
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Thu Aug 26, 2004 3:28 pm    Post subject: Random point generation Reply to topic Reply with quote

I have a need for a random point inside a non retangular region.

If the region were rectangular, a simple x+rand(width) would work.

My first thought was a loop that generates random points from 0,0 to 1023,1023 and checks it againts the region. Unfortunatly, this has the nasty side effect of totally hanging the server if the region has been misconfigured (easy to do).

Another thing to note is that these points will be used in warping, so checking near by walls would be nice but not essential. If it comes to it, I can make regions that aren't near any walls and don't enclose any walls.

At some point, I would like to see this function moved into mapdata.c.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Thu Aug 26, 2004 10:30 pm    Post subject: Reply to topic Reply with quote

Pre-calculate how many tiles are in the region and gerate a random number in that range. The trick is then to efficiently map the number you generated to one of the tiles. Maybe a list of "tile rows".
_________________
4,691 irradiated haggis!
Back to top
View users profile Send private message Add User to Ignore List
Muskrat
Server Help Squatter


Age:38
Joined: Aug 24 2004
Posts: 829
Location: Swamp
Offline

PostPosted: Thu Sep 09, 2004 1:05 am    Post subject: Reply to topic Reply with quote

could you do this using a bitmap, such as from facts?
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 45 page(s) served in previous 5 minutes.

phpBB Created this page in 0.525188 seconds : 27 queries executed (90.4%): GZIP compression disabled