Strategy for using procedurally generated content.

Monkey Forums/Monkey Programming/Strategy for using procedurally generated content.

FlameDuck(Posted 2011) [#1]
Thoughts?


Skn3(Posted 2011) [#2]
First thought would be can we have render to texture/FBO's otherwise how would you generate decent content?


slenkar(Posted 2011) [#3]
syntax error..
question too broad


Warpy(Posted 2011) [#4]
What slenkar said.


Why0Why(Posted 2011) [#5]
I'm not sure what type of game you are talking about, but this has always been an interest of mine. I have played with roguelikes and am considering doing one. I also started on a Master of Magic clone(many years ago and I used Blitz 2D) and spent a lot of time getting fairly realistic maps generated with accurate terrain, features and shoreline.

Lately I have been thinking more on the content line as just opposed to maps. Interesting items to populate levels. I was thinking what if there was a game that could scale up so that you could play forever and still make it interesting?


FlameDuck(Posted 2011) [#6]
First thought would be can we have render to texture/FBO's otherwise how would you generate decent content?
I don't know yet, that's why I'm asking. :)

question too broad
I am thinking in a broad sense. It could be as simple as Diablo or as complex as Minecraft/Terraria or even From Dust if you really went all-in. While I personally think the answers in the league of From Dust is more interesting, at this point I'm not yet quite ready to throw away otherwise perfectly good ideas for how to get "something like that" into something made with monkey.

Since, as Skn3 pointed out, there is no reliable cross platform way to get "render-to-texture" or a pixmap concept going, so the two other alternatives so far (that I've come up with) are:
1) Create an enormous amount of pre-generated images, and combine them creatively. This technically works, but is painfully slow (and prohibitively memory consuming) in HTML5.
2) Create a Java servlet (or similar) to serve you the procedurally generated images. This doesn't actually, currently work, but could be fairly trivially kludged in there, if you really wanted to.

Neither of these are pretty, but both could be coerced into working (particularly if you didn't care about HTML5). So the question is initially more of a technical nature rather than a theoretical one.


FlameDuck(Posted 2011) [#7]
I'm not sure what type of game you are talking about, but this has always been an interest of mine.
Right now I'm not thinking of any game in particular (see above for examples tho'). I'm thinking more in the terms of the technical aspects.


matty(Posted 2011) [#8]
My game lockdown necrosis uses procedurally generated levels. I have a simple set of tiles and my own random number generator to ensure the levels are always the same for a specific seed. Not sure if that's what you mean though as it had nothing to do with pic maps?


Armitage1982(Posted 2011) [#9]
@Skn3
First thought would be can we have render to texture/FBO's otherwise how would you generate decent content?


You forgot the DrawTexturedPolygon and a Reflection module too Skn3 ^^

But It's a good question!
In a way, Diablo or Minecraft are not that much procedural mainly because they use predefined assets.
I would rather be much more impress by a game that procedurally generate all it's content.

I wonder if Monkey ultimately want to support every features on every platforms or if hopefully we'll be able to officially use unsupported display related features.


Skn3(Posted 2011) [#10]
Is there a DrawTexturedPolygon module?

I don't know yet, that's why I'm asking. :)


Well it sounds like your thinking of doing something.. which inturn sounds rather interesting.. wot wot!

Id imagine it would be cool to make a procedural content system that is accessible to anyone. Meaning, it is not complicated for anyone; no dealing with algorithms, equations, splines, blah blah!

Something like a compositing suite. Let the user create a texture object, add layers, paint to layers, apply effects to layers and then compile the image.

The effects and paint system could be OOP'd so over time, a library of functions could be added to the system. E.g. drawing gradients, lines & shapes, adding noise, blurring, inverting colors, grey scale, make image repeatable, colorizing.. etc

Is that the kinda of answer you were after?


Gerry Quinn(Posted 2011) [#11]
Ultimately (well, already!) there will be modules that support features found only on some platforms. My guess is that Mark will want to keep mojo itself 'pure' and cross-platform, and I think that is indeed how it should be. Monkey with mojo should work perfectly to produce cross-platform stuff out of the box. That's one of its major USPs.

It's no problem then if we download additional modules that have extra features but don't work on all platforms. When we use such modules we know what we're getting into.

By the way, I'm not much of an expert regarding building and stuff, but my belief is that Monkey needs a preprocessor because nobody knows what shape it will be ultimately, and a preprocessor adds the flexibility needed at the lowest level.


FlameDuck(Posted 2011) [#12]
Well it sounds like your thinking of doing something.. which inturn sounds rather interesting.. wot wot!
It's nothing concrete right now, just playing around with ideas, really. Once I have a proof of concept going, we can talk specifics. :)

Something like a compositing suite. Let the user create a texture object, add layers, paint to layers, apply effects to layers and then compile the image.
Good idea. I'm stealing it. :)

Ultimately (well, already!) there will be modules that support features found only on some platforms.
Sure. That's not really what I'm looking for though. I'm looking for something that *will* work on all platforms. The easiest way to do that, is write it in monkey, and hope it performs well.


Skn3(Posted 2011) [#13]
Good idea. I'm stealing it. :)


I'll just wait until its a released module and take you to court waving my patent in your face!

...

Brill! Can't wait to see any fruits of labour if you get anywhere with it all :D


visionastral(Posted 2011) [#14]
A way to Draw to an array instead of the screen buffer and a way to convert an array into an actual image wich the Draw function could handle would be excellent, since there is plenty of graphics that could be done on the fly without having to pre-render them as bitmaps/ressources.


Raz(Posted 2012) [#15]
I've been messing around with 2d map generation recently. I'm doing it in Blitzmax because of file read/write issues, but all logic could be used in Monkey too.

I'm sure there's a much more elegant way of doing things, but I'm basically just making it up as I go and drawing / eroding as required. The link below shows the progress.

http://chrismingay.co.uk/procedural-maps/


Gerry Quinn(Posted 2012) [#16]
Looks quite nice.


Skn3(Posted 2012) [#17]
Nice one raz, your map gen looks quite interesting.

Could I suggest lakes possibly when the river has an "end" ?


Raz(Posted 2012) [#18]
Yeah Skn, I've got that down as a todo :)


pantson(Posted 2012) [#19]
nice work Chris.. I'm loving the idea.
Unfortunately your logic is based on random numbers. (not saying it doesn't look good)

I would try to make it a bit more real by creating a height map. (The height map could be used in game but doens't have to)

That way..
-rivers run down hill.. lakes fill up holes overflow into water falls etc
- Settlements are on flat ground, or on north sides of valleys (in the northern hemisphere)
- Foliage is based on altitude.
- Roads go round hills.

Just something to think about.

Would love to join in a project to expand this out.


Raz(Posted 2012) [#20]
Hey Rich thanks! Yeah, all of the reading I've done uses a height map in one form or another (Perlin noise most probably) as the basis of the map.

I'd love to give that a go too, so the methods I have been using are by no means the end of it!


Raz(Posted 2012) [#21]
Impixi and Bladum have some heightmap / perlin code in the code archives here too, so that could very easily become the basis of something


Why0Why(Posted 2012) [#22]
When I made a world gen for my Master of Magic game I made a height map and a "water" map then used a combination of the two to decide terrain type. High terrain and high water would be a river starting in a mountain, low terrain and dry would be desert, low terrain and wet would be swamp, etc. It really made some nice looking worlds that felt quite real. I tweaked for a long time just by sight until the world felt right.


Paul - Taiphoz(Posted 2012) [#23]
After a 48 hour marathon mine craft session, I sat back in my chair, head sore, back hurting my rsi in my wrist playing up, and I thought what the hell its been nearly two days, I wrote most of whats bellow on a bit of paper and stuck it to my wall.

I'v not done any of it yet, but its gone stay on my wall till I do. thought it was appropriate to your question.

as a strategy, I would keep it simple, work with basic objects and creation and then add further layers to gain complexity.

Take mine craft for example, simple blocks being placed around the map, add in a layer of complexity that allows for circuits and you have a whole new ballgame, people making computers and factories that work, bet notch never thought any of that would happen..

So keep it simple, build on that simple idea and things will get complex and interesting on their own.

In terms of a potential game, and to stay with the minecraft theme, look at castle story, voxels much like minecraft, but their taking it another direction with RTS gameplay. starting with placing simple blocks, but this time adding a layer of RTS coolness.

I think whats important is that you try not to think of the end result, keep it simple, make something that lets the player create stuff in game, be it voxel box's, pollygons, or pixels, how about a game where the player is 2D mario esque and he can run around creating blocks, giving them textures, his own textures, from those humble beginigs people could build mario, toystory,little big plant and any number of other platform games.

Start simple, build complexity with new layers of features and tool sets. until eventually you will have something with a life of its own, sandbox to play in.