Hello again.
If you have read our previous post about Development Cultorios game and MVC in Unity:
http://doctrina-kharkov.blogspot.com/2016/08/cultorios-unity-mvc-tutorial.html
you have noticed that we made separate Controller witch give us a lot of benefits. One of them is ability to automate game testing. We know that Unity provide solution for unit-tests, but it's complicated as finding bugs :). And that's obvious because automated testing is some kind of AI which need deep understanding the problem that is still not resolved with modern computers. It's depends of architecture, AI, game mechanics and lots of things.
This gameplay demonstrate automated movement of a Hero described below.
Reason is simple:
as developer you play exactly right to make everything working, but players are not! They push all the buttons at once and do some kind of random behavior. And there your game came into a case you never test it as developer.
With years we try to do same things during development but always there is a person who crash your game. Of course professional QA will do it better and even find a patters of bugs, know vulnerable parts of your code. But as indie developers we not always have resources to involve such people.
What all of this came to ? Games crash because of Input. If you start your game and do nothing in most cases it works fine, but with input it stuck or crash. And now we have a separate class that send input into a logic.
Idea is simple:
Generate random input instead of use keyboard or controller data. That's it. Most games at development will crash at that simple case.
If we have data from devices handled like this:
protected void Controlled()
{
float h = Input.GetAxis("Horizontal");
if ( Mathf.Abs( h ) != 0f )
{
root.ForwardEvent( EEvents.Move, h);
}
if ( Input.GetButtonDown("Jump"))
{
root.ForwardEvent( EEvents.Jump, null);
}
}
where hero is moved and jump. Randomly generated input will looks like this.
protected void Generated()
{
//Randomly select one of the available input from enum
//Randomly generate data for such input
//Send it to Root
}
We not made such simple case because it bring Hero nowhere and of course it is very limited testing because of full random. We made it much complicated to make behavior of our hero more real:
protected void Generated()
{
mMoveTimer += Time.deltaTime;
if (mMoveTimer > mMovePeriod)
{
mMoveRightLeftTimer += Time.deltaTime;
if ( mMoveRight )
{
root.ForwardEvent( EEvents.Move, 1f );
}
else if ( mMoveLeft )
{
root.ForwardEvent( EEvents.Move, -1f );
}
if ( mMoveRightLeftTimer > mMoveLeftRightPeriod )
{
mMoveLeft = mMoveRight = false;
mMoveRightLeftTimer = 0f;
if ( Random.value > 0.5f )
{
mMoveRight = true;
}
else
{
mMoveLeft = true;
}
mMoveLeftRightPeriod = Random.Range( 1f, 3f );
}
mMoveTimer = 0f;
}
mJumpTimer += Time.deltaTime;
if (mJumpTimer > mJumpPeriod)
{
root.ForwardEvent( EEvents.Jump, 0f );
mJumpTimer = 0f;
}
}
Conclusion:
We select direction of the Hero movement and time which he made such movement. When this time is reached we do it all over again. That's how hero will not stay at same place. Also we add jumping with some period of time. Of course you should write down code for testing, even with some kind of AI that is still not very useful.
Our next solution will be record mini patterns of input and randomly select such recordings. That's how we not need to write down any code. See such tutorial later.
Thanks for reading.
Keep sharing! Regards. Read more about
ОтветитьУдалитьSelenium Training in Chennai | Certification | Online Courses
selenium training in chennai
selenium training in chennai
selenium online training in chennai
selenium training in bangalore
selenium training in hyderabad
selenium training in coimbatore
selenium online training
I’m not that much of an internet reader to be honest but your blogs really nice, keep it up! I’ll go ahead and bookmark your website to come back down the road sap fico certification training in hyderabad
ОтветитьУдалитьi'm guiltless natured you take movement of to self-centeredness in your message. It makes you stand dependancy out from various assistant creators that can't maintain nonsensical environment content recollecting that you. Flip PDF Professional One2up
ОтветитьУдалитьYou've got carried out a loud challenge upon this article. Its absolutely regulate and extremely qualitative. You've got even controlled to make it readable and smooth to make a get accord of of into. You've got a few specific writing adroitness. Thank you as a consequence lots. Syncios Data Recovery Free Download
ОтветитьУдалитьThis sort of booklet continuously moving and I select to go web-based mind-set content material, for that excuse happy to track down extraordinary district to numerous here in the broadcast, the composing is simply on your loving, thank you for the name. Happy Friendship Day Quotes For Love
ОтветитьУдалить