Adventures in Robust Coding - the game - GameDev.net

Adventures in Robust Coding

posted in the game for project unirule
Published September 25, 2016
Advertisement

:) :) :)

So I am very please because, fingers crossed, after working on this one function for more than two months I think I've finally got it.

The goal was the create a function that would draw a path of white arrows, refer to the pictures for visuals, between any two points selected by either a user or at random on the surface of a dynamically generated world. But not just once, ten times or even a thousand times but every-time, or 99.99999...% of the time.

At first errors would pop up after I had randomly picked 10 or 20 paths to draw, but soon I could click, click, click for a good 30 seconds and nothing, no errors.

robustPath4.png

So I decided to create a function that would just randomly make paths for me, right? I know!
And that would return errors after maybe a few hundred paths tested. Then I'd sort this out or that in my code and repeat and soon I could run the function a thousand times before an error would pop up. After a while I'd get a few thousand paths tested with no errors and so I'd up the detail of my world and see if the function would work on a dynamic surface as opposed to a flat uniform surface. And then again back to errors after just 10 or 20 paths.

And this cycle continued, and continued...

robusttesting.png

Soon I was running the function to test hundreds of thousands of paths taking hours and hours and only after hundreds of thousands of paths had been tested would and error pop up for me to see and analyse.

robustpath3.png

and now at the time of writing, still testing though, I am pretty confident I have finally met the robust challenge! :cool:
now of course I'm not 100% sure that it's perfect, I can never be certain because their are technically too many paths to be tested to count.
an example of a path to test is as follows
Sx:0.8925261008176053y:-6.462897144580008z:6.1995026343584705Ex:-0.9157777460656384y:6.468354322279517z:-6.190324704587636
but, if it can get to a million that It should be able to get to a billion.

This is good because this particular function is key to my game and it will run billions of times over the course of a single game so it only makes sense that it can handle what ever is thrown at it.

[side note: the coordinates to the path I listed above were actual the coordinates of the last error I encountered. Interestingly if you look at them the Starting x,y,z's and Ending x,y,z's are almost exactly opposite, thus opposite sides of the sphere, and of course my code up until that error could not handle such an odd circumstance because it threw my distance calculations off ]

EDIT: I LIED, IT FAILED,
back to the dungeon with my scrimbly board :blink:

Previous Entry Update
Next Entry Weekly update #1
1 likes 3 comments

Comments

Awoken

One minor update: I have just figured out to how to farm nothing but errors. previously it would take me hours and hours to identify an error. I can now do it in seconds. This will greatly contribute to my goal of being 99.9999999% robust.

September 29, 2016 03:31 PM
Awoken

O.k, jumped the gun two weeks ago. The function has run over 15,000,000 times and for more than 12 hours and no errors. That'll do. on to the next task.

October 11, 2016 01:49 PM
Navyman

I really like the world view, almost hex tiled, but the ground level is much more.

January 20, 2017 04:06 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement