Because, I am always distracted by mini-projects…I decided to give a shot at random world generation.
This is the early stages, different land tiles are simply randomly applied, but the magic is in the land generation. Fixed some stuff and now have some dumb logic to create hills and mountains in like areas, eliminate stray land pixels and make areas surrounded by water sand tiles.
I was considering, then reading on perlin noise, and if I can't grasp exactly how it works in down-to-earth english, I generally avoid it. I could just copy and paste someone's code, but that's just not as fun.
So after some additional searching I found an interesting method more close to home.
Since I lifted it, I'll share it to those as less inclined to complicated maths like myself. Its actually very simple and doesn't require code to explain.
First off you have your array for the world, empty.
Secondly you generate a series of randomly placed land points, adding them both to the world's array and to a stack array.
After that, read through the stack array in a UNTIL loop, comparing all 8 sides for emptiness and placing either a land or water in each.
If the home space is water, neighbors are water.
Then each new space that is filled get's its X,Y stored into the stack array, the orginal value is deleted. Repeats until all the world is full and the stack is empty.
I did some additional tweaking with it...
It request how many seeds to plant for land, then it does the rest. Less seeds, less land, max seeds, no water.
Download GK.ziphttp://pastebin.com/fpy4DhgQCode, GLBasic. Don't need registered version.
Oh and I've done a few more things to the Halloween game that may never be done, engine wise.
Moving from room to room, hiding in lockers, being counted as hidden in shadows, some visual improvements as well.
Two major portions that determin if this project will see the light of day are both graphical. Characters and scene objects.
The characters are delayed mostly because I haven't been able to aquire the time and access to my desktop which I do my main art with, altough I can do the textures for the objects at any time.
I may just be left with a nifty engine that warms the dark reaches of my heart, or just another to add to the stack of throw-away projects, or just give the source out since it's been created to be very customizable. I've even found myself copying good old GM methods of object and graphic handling. At least how I named them in GM.
Eitherway, I'm hoping I can get some more done soon….oh fine, here's another demo since you got all the way to the bottom of this….
HSHH101510Arrows = move
Space = activate/unhide.
Two doors are locked.
I always found world generators to be interesting.
Yay pseudo code!Your halloween game is looking greatIts kind of addicting, stupid world generator distraction. Actually I side-tracked-track-sided to a little game thats probably going to be an 8-bit civ clone.
I made something like that awhile back, it generated random static maps with squares representing terrain and each cell having resources.You would build buildings over squares to get the resources like in CIV, but without a sphere of influence.Oh.
Download codesnip_wg.txtFree code too.http://pastebin.com/fpy4DhgQ
because putting a txt on host-a.net is stupid >:{I feel shamed.
I'm behind in free convenient services. Think I'll be using that.Scott_AW ought to feel shamed. And then, he will feel enlightened, with his newfound freedom of choice for sharing snippets of code and text :D
Woohoo!