• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
lucky6969b

[updated]: Make certain objects arrive in the scene (a lorry)

24 posts in this topic

I think I've asked this question before, but I've lost the link to that post.
I wonder what is the best way to make a lorry arrives.
I remember somebody told me that keeping a series of random numbers and
choose one of them, and see if that number is larger than a certain threshold,
then a lorry will arrive is not a good idea.
Could anyone please refresh my memory? I forgot what that post says.
Thanks
Jack
0

Share this post


Link to post
Share on other sites
I don’t have time to answer; I only have time to clarify what he is trying to ask for those who were just as confused as I originally was the first 10 times I re-read it.
 
He is asking when to make a cargo truck arrive.
The procedure for deciding when to make the truck appear at a certain place.
 
Not for detecting when it arrives at a certain place.
 
 
L. Spiro Edited by L. Spiro
0

Share this post


Link to post
Share on other sites
There is no right answer for this. You might want it to arrive when the player did X (whether that's entering an area for the first time or completing a quest). You might want to roll a random number every X time units and if the result fulfills a criteria you make it arrive. You might want to connect to a central server and that decides when it's lorry time for every player in the world.

All of these are reasonable for certain design decisions. Many more are possible.
0

Share this post


Link to post
Share on other sites
void App::FrameUpdate() {
    int number = GetRandomNumber();
    if (number > 9000) { 
        arrive = true;
    }
}
Is or isn't this a good idea? Thanks Jack
0

Share this post


Link to post
Share on other sites
How frequently is the function run? What range of values does GetRandomNumber return? What is the resulting expected arrival time calculated from those two values?
0

Share this post


Link to post
Share on other sites

Hello BitMaster,

Thanks for helping.

I am not sure how to tell how frequently the function runs. I am using the Ogre3D rendering engine.

Is there a way to measure this frequency? The numbers that return will be in the range of 1-10000

so there will be 90% of the chance that the lorry will not appear?

Thanks

Jack

0

Share this post


Link to post
Share on other sites
Assuming the function is run 25 times per second (not unreasonable for an update function) the probability for the lorry not having arrived after 1 second is 0.1^25 = 0,0000000000000000000000001. For all practical purposes, the lorry will always be there 1 second after you started.
0

Share this post


Link to post
Share on other sites
Related to BitMaster's computation, if the lorry has probability p of arriving each frame, in the average you'll have to wait 1/p frames for it to arrive (so 10 frames in your example, which at 25 frames per second would be 0.4 seconds).
0

Share this post


Link to post
Share on other sites

If I want to make this more deterministic (but still more or less random) as I need to load some data from Excel

that determines how the program would behave...

pretty stumped now. What are your suggestions to me?

Thanks

Jack

Edited by lucky6969b
0

Share this post


Link to post
Share on other sites

We need more info...

 

What is the intended behaviour?

Should the lorry appear once every x seconds?

Once the level starts?

After a random amount of time?

0

Share this post


Link to post
Share on other sites
Date              Time       Apple    Orange   Pear
10/10/2009        7:00       1
                  8:00       1                 1

The Date and time are the "Cartons or pallets" arrival dates and times, they arrive in the trailer of the truck

I need to convert this data into the probability of truck arrival time....

Thanks

Jack

Edited by lucky6969b
0

Share this post


Link to post
Share on other sites

I dont understand this list.

 

Doesn't it mean that the truck will always arrive at a specified time? If so, why the randomness?

0

Share this post


Link to post
Share on other sites

Come on... I'm not going to write the code for you. My last post should have all the info you need to implement something that you can build upon.

0

Share this post


Link to post
Share on other sites
Keep in mind that "random" isn't necessarily random in the way it sounds.

I.e. if you're going to add/subtract a random amount of time to when a truck arrives you'll want to determine a threshold, what is the maximum amount of time the truck could be early/late. for instance if the truck arrived at 1:00 you could set a 20 minute threshold for both arriving late or arriving early.

After that it kinda depends on the math you want to use, you could use a rand function between -20 and 20 and apply the difference(that may require a little fiddling if you're using an object representing time with a unique type) or you could pick a random 0-20 and then decide to add or subtract based on a second rand roll.

Anyway the math doesn't matter that much, the point is more that in terms of computers you're almost never going to just pick some totally random number. Most of what everyone has been trying to convey to you so far in the thread is that you have to look at your problem and decide how best to tackle it for your unique situation. Edited by Satharis
0

Share this post


Link to post
Share on other sites

If you want to model number of arrivals in a discrete time period (e.g. number of arrivals per hour, with some mean number of arrivals per time unit), you want to use the Poisson distribution:

 

http://en.wikipedia.org/wiki/Poisson_distribution

 

If you just want to model time between arrivals (with a certain mean time of arrival) you want the exponential distribution:

 

http://en.wikipedia.org/wiki/Exponential_distribution

0

Share this post


Link to post
Share on other sites

Okay, I'll think thru it, and see I can come up with a solution.

Sorry, I was too impulsive to ask for an instant answer....

Thanks everybody

Jack

Edited by lucky6969b
0

Share this post


Link to post
Share on other sites

Has anyone used a simulation library before? Which one do you think is the best?

[url]

 https://www.google.com.hk/search?q=Simulation+Library&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:zh-TW:official&client=firefox-a&channel=sb&gfe_rd=cr&ei=jX-TU82eHsn0mAX_2IGADQ

[/url]

0

Share this post


Link to post
Share on other sites

It's a C++ library which encompasses all the features we discussed above.

I found one of them on my hard drive, which is called C++ Sim,

But I think I have to give it up, because it is written for unix, not win32

which is the platform I am currently working on.

Sorry, I forgot to link to share. But it's from the University of NewCastle, UK

Edited by lucky6969b
0

Share this post


Link to post
Share on other sites
There are plenty of timer examples out there. All you need is to decide on a "normal" time each truck arrives and add/subtract some random value from the time. When that time is reached in your game loop, send in the truck (lorry). You don't need to make this any more complicated with simulation libraries.....
0

Share this post


Link to post
Share on other sites

Wouldn't it just be easier to, at load time of the data you have, add/subtract a random number so that at load time you already have "randomized" data and act deterministically from there?

 

If you want to repeat the process several times, keep a copy of the original data, and recalculate the next time (with some randomness) a truck should go everytime a new truck goes.

Edited by mdias
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0