Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Ollhax

Member Since 22 Jan 2012
Offline Last Active Today, 08:56 AM

Posts I've Made

In Topic: Exclusive maximum in random functions

16 February 2015 - 01:32 PM


If everybody was jumping off of a bridge...

 

Mm, totally with you on that point. That's what I was looking for; whether this is just a convention or if there's something I've not thought about. Good arguments on either side. But, in line with what you said, I've made my problem easier by just calling it a gameplay-oriented randomizer instead (throwing in some helpers for random directions, colors, etc). I can definitely stand behind inclusive maximums for that use case.


In Topic: Exclusive maximum in random functions

15 February 2015 - 08:33 AM

 

None of the mapping functions are inherently better than the other. However, when you look at many different use cases, the math of 0-based exclusive ranges falls out prettier without magic numbers more often than not. You rarely have to add or subtract 1 to compensate for exclusive ranges.

 

 

This pretty much nails it. I agree that neither way (exclusive or inclusive max) is inherently better than the other. So unless I'm missing something, it boils down to my arguments above (counter-intuitive and weird states) vs usefulness for indexing arrays and convention.

 

Thanks for taking your time to answer, I'll go pounder this a bit more smile.png

 


In Topic: Exclusive maximum in random functions

15 February 2015 - 07:29 AM

But you can turn that argument around and ask, why would one design the random function's range only to index stuff in arrays smoothly when it's just as likely to be used for simulating die rolls? Stated differently, I *am* designing for general use, and I get the feel that exclusive maximum is a weirdness designed for indexing arrays, a very specific problem.


In Topic: Exclusive maximum in random functions

15 February 2015 - 06:57 AM

Thanks for the link! It's pretty much what I expected. I agree with that SO reply, but I'm not really sure if it applies to the interface of a random number generator. Expressing "I want a dice roll between 1-6" as Random(1, 6) just seems more natural to me.

 

Having Random(0, 0) mean Random(0, Int32.MaxValue-1) (or maybe Random(0, Int32.MaxValue)?) does not really feel natural either. If I don't go with a convention of my own, I'll just stick to the one in System.Random, where Random(0, 1) equals Random(0, 0).


In Topic: Figuring out the cause of jitter

12 May 2013 - 01:39 PM

I think I'm making some progress with queueing up the updates in case they are early, and applying them at their designated time. It definitely removed the worst of the jitter. However, there's some inherent problems with this:

* Queuing up = introducing latency. Not much to do about this.

* How large queue should one allow? I've set an arbitrary number right now (3!) but I think it needs some more thought...

* What happens to packets that are too late? I think I'll try extrapolating the position in case this happens.


PARTNERS