Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (804)
Games in Android Showcase (237)
games submitted by our members
Games in WIP (867)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Retrieve random point inside regions of Perlin noise?  (Read 4489 times)
0 Members and 1 Guest are viewing this topic.
Offline Aalhex
« Posted 2017-02-01 15:31:21 »

To be frank—I’m not entirely certain this is the correct place to post a question like this. Should you (some random moderator) feel this is the wrong place, feel free to move it! Roll Eyes

Let’s say we’re procedurally generating an infinite level as we walk around using the following:

1  
2  
if(perlinNoise.noise2(x / scale, y / scale) > .2)
   makeTileSomethingInteresting(x, y);

Based on the Perlin noise, the world will place in interesting tiles for us! In fact, it’s going to generate a world that features certain “chunks”—or regions—that will have that interesting looking tile.

Assume we wanted to procedurally generate in one—and only one—nasty looking tile somewhere inside every single one of the regions generated by the noise. Somehow, we’d need to know what those tiles are on the fly, as the world is infinite. Cranky

I’ve been messing about with this for a while—and honestly—I have no clue as to how this might be solved without using some sort of flood fill to make sure an area always has the same random seed for the position of the random point.

Perhaps someone can come up with a suggestion?

Should you have a good answer as to how one might achieve this, do leave a post! If your answer is fully functional, you’ll be featured in the credits of my upcoming game! Pointing

It is I, Alexander from the Junivörs.
Offline Riven
Administrator

« JGO Overlord »


Medals: 1371
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #1 - Posted 2017-02-01 17:08:51 »

Use floodfill indeed. And drop the requirement that your game is supposed to be infinite. Not a single gamer cares about infinity Smiley

Try to make a relatively small world, and make a fun, functioning game - that is hard enough!

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline Aalhex
« Reply #2 - Posted 2017-02-01 17:25:10 »

You’re ruining my moments of “infinity” bliss Riven. I like infinity! Sad

On the other hand, what you’re saying is very much true! This game, however, features millions of extremely large planets and sort of requires infinity in a way. That’s enough spoilers, though! Roll Eyes

I suppose one could generate a noise with a smaller scale and pray to the Lord that about one of them are inside every larger chunk of noise. It wouldn’t be perfect—but that’s the way game development usually is! Smiley

It is I, Alexander from the Junivörs.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline bmanmcfly
« Reply #3 - Posted 2017-02-01 17:43:14 »

As a gamer, when I see "infinite" anywhere in a game, it instantly tells me a few things :
- if it does seem interesting enough to play, it wont last long
- there's a high likelihood of IAP to keep people playing a few minutes longer
- there's little to no depth or story beyond a premise.

Bottom line, making an infinite game tells me that the maker(s) were too lazy to think up a good story and make an ending... very different from a game where the maps are infinitely variable, if there's a good story, that = replayability.

Hopefully that doesn't make me come across like an a-hole...
Offline philfrei
« Reply #4 - Posted 2017-02-01 19:11:30 »

I'm not sure if I understand the scenario.

Perlin returns [-1..1], and you wish for noise values > 0.2 to be of a certain special type.
A variable number of contiguous tiles generated this way, forming blobs or islands.
On each island, there should be one "special" tile, which I will call the X tile.
Given the goal of "infinite world" it would be good to be able to identify the X tile procedure based upon the region itself, rather than maintaining some sort of list.

It occurs to me that some of the islands will be quite large, and some will be as small as a single tile. I'm thinking you will want a minimum number of tiles to be fulfilled before you include the X tile, e.g., there must be at least 10 tiles in the island if there is going to also be an X tile.

One could work with the geometry of the shape itself: using a floodfill algorithm to determine the complete extent of the island when you come across it. Then apply a hash function to the shape.

I like the idea of a hash giving 13 possible outcomes. With 13, one could have a "clock" of 12 regions and a central area. Then, place the X tile in the center of the hash-derived sector. Or, if one wants more variety, give the hash more possibilities, and break the island into corresponding sectors.

What would be a good hash? I don't know. Maybe use the number of tiles in the island, but also add in the number of corners or the side lengths, and then do a mod division? How divide the varied island shapes into sectors? I'd have to think about that, as well. The main requirement is that it is a function of the shape that is found.

music and music apps: http://adonax.com
Offline Aalhex
« Reply #5 - Posted 2017-02-01 19:29:15 »

Riven and philfrei
I guess flood fill it’s going have to be. Smiley

This does however require saving the world data in order for the whole flood fill business not to affect the game’s performance too much. But this also means towns will have the possibility of having names! Did you hear that? Names! Well, anyhow, there went that beautiful evening of solving things by quick and simple means. Cry

bmanmcfly
These are good points, indeed. I’m going to need to reconsider whether I really want my game world (worlds) to be infinite. Pointing

It is I, Alexander from the Junivörs.
Offline bmanmcfly
« Reply #6 - Posted 2017-02-01 20:04:09 »

Riven and philfrei
I guess flood fill it’s going have to be. Smiley

This does however require saving the world data in order for the whole flood fill business not to affect the game’s performance too much. But this also means towns will have the possibility of having names! Did you hear that? Names! Well, anyhow, there went that beautiful evening of solving things by quick and simple means. Cry

bmanmcfly
These are good points, indeed. I’m going to need to reconsider whether I really want my game world (worlds) to be infinite. Pointing

There's no reason why you cant have the best of both... based on the description, its something like being able to go from world to world where each world is potentially infinite. 

Take the approach of the rogue-like games; there is potential for infinite replayability in the sense that each round of the game creates a randomized world where each challenge will be different from the last... so, there's endless potential, yet, there's still an overarching goal, sometimes even a story tying things all together.

If all you really WANT is just to have the challenge be "how far can you make it", then by all means, go ahead and do that.  There's a reason why there are so many variations on the "infinite runner" games, it's that they get downloads and I'm sure there's profits to be made. 

IMO, and even though you did not ask for my advice on the matter, but I would consider, use the mechanics of the infinite game you want, and then develop the infinite game into a "full" game... that said, you should also keep in mind that I've never published a game for sale, and never completed a game that was much more drastically complex than tetris, so, my advice should be taken with as much salt.
Offline Aalhex
« Reply #7 - Posted 2017-02-01 20:23:09 »

By “full”, I’m assuming you mean it should be as complex as a game “should” be? That is, something that isn’t overly repetitive as for gameplay?

The idea is that it shall be some day. Smiley

It is I, Alexander from the Junivörs.
Offline bmanmcfly
« Reply #8 - Posted 2017-02-01 21:50:42 »

By “full”, I’m assuming you mean it should be as complex as a game “should” be? That is, something that isn’t overly repetitive as for gameplay?

The idea is that it shall be some day. Smiley

Sorry, that was somewhat sarcastic...

I did mean in the sense that there would be a story, that has a beginning to an end... which isn't really a good measure, since even tetris is an "infinite" game (especially if you're my mom, who managed to play until the game stopped counting up... lvl 25 if memory serves), but it's still a full game in the more common sense where it's got a title, menu, options, music, sfx, controls, no game breaking bugs, etc.

Similarly, even though i'm not a fan (but I do still give them a chance once in a while), there are many infinite games that do fit the common description of being a full game.

The way I meant in the earlier, was more in the sense of there's a beginning, a plot, and an ending... which isn't really necessary for many types of games anyway.

Pages: [1]
  ignore  |  Print  
 
 

 
Riven (463 views)
2019-09-04 15:33:17

hadezbladez (5322 views)
2018-11-16 13:46:03

hadezbladez (2249 views)
2018-11-16 13:41:33

hadezbladez (5597 views)
2018-11-16 13:35:35

hadezbladez (1164 views)
2018-11-16 13:32:03

EgonOlsen (4600 views)
2018-06-10 19:43:48

EgonOlsen (5474 views)
2018-06-10 19:43:44

EgonOlsen (3138 views)
2018-06-10 19:43:20

DesertCoockie (4033 views)
2018-05-13 18:23:11

nelsongames (4782 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!