Welcome Guest ( Log In | Register )

[ Big| Medium| Small] -



Post new topic Reply to topic  [ 12 posts ] 
    Sarkilas
  Wed Mar 07, 2012 12:03 am
User avatar
Member


Location: Norway
I'm trying to find out a good way to create a method that generates a large world of tiles and objects, where the method itself only takes two parameters: width and height in tiles.

What I want to do, is split the map into "zones" with random sizes picked out from a width and height table using a random seed index. These zones gets a random biome to accompany it. I've been trying various things, and this is the closest I've become:
Expand to see the code.


So when I try to create a world with the sizes 2048 x 2048, it should give me 4194304 tiles, but it gives me about 10 times less than the expected amount (at the console line), and it looks like it skips all but the first Y-axis of each zone. I don't know why, because if I output the X and Y values every time it adds a tile, it shows correct values from start to finish, but still only gives me around 400k tiles in the final list.

It might just be an obvious code mistake, but I don't see it right now. Anyone have a better algorithm or any idea what happens wrong with this code?

Any help is greatly appreciated! Thanks!

_________________
Well..


Top Top
Profile      
 

    Sarkilas
  Wed Mar 07, 2012 12:50 am
User avatar
Member


Location: Norway
I noticed that I have to reset the X back to 0 every time the Y updates, so I added this line and now it's working to some extent. It's still not adding as many tiles as expected, though, so that is still up D:


Top Top
Profile      
 

    SekiRaze
  Wed Mar 07, 2012 2:05 am
Aprentice of the hidden Ruby
User avatar
Member


Location: Germany
you try something like this:

http://www.youtube.com/watch?v=fmF4B7AKSBg

?
if yes. this is straight gangsta. i dont even how it works. i accidentially a site and now i cant find it :(

_________________
Has been Streamer at IWBTS.com (iwannabethestream.com) if you go there, tell them SekiRaze sent you.

Haircolors:
Content Hidden


Games i am currently working on:
1. Sx3 - Secret Soul Survivor
Content Hidden


Top Top
Profile      
 

    Sarkilas
  Wed Mar 07, 2012 2:03 pm
User avatar
Member


Location: Norway
It's hard code. It's not RPG Maker, so that won't help me at all. But thanks for the link.


Top Top
Profile      
 

    SekiRaze
  Wed Mar 07, 2012 3:06 pm
Aprentice of the hidden Ruby
User avatar
Member


Location: Germany
what are you using for your project?

_________________
Has been Streamer at IWBTS.com (iwannabethestream.com) if you go there, tell them SekiRaze sent you.

Haircolors:
Content Hidden


Games i am currently working on:
1. Sx3 - Secret Soul Survivor
Content Hidden


Top Top
Profile      
 

    Sarkilas
  Wed Mar 07, 2012 3:29 pm
User avatar
Member


Location: Norway
That is irrelevant, since all I need is to fix the code given in the first post. It's C#, though, there is no editor or anything.


Top Top
Profile      
 

    SekiRaze
  Wed Mar 07, 2012 5:20 pm
Aprentice of the hidden Ruby
User avatar
Member


Location: Germany
well im no scripter, obviously, but it may be a problem with the different tileset pattern. could it be, that it counts ground, water and stuff like this not as a actual maptile?

_________________
Has been Streamer at IWBTS.com (iwannabethestream.com) if you go there, tell them SekiRaze sent you.

Haircolors:
Content Hidden


Games i am currently working on:
1. Sx3 - Secret Soul Survivor
Content Hidden


Top Top
Profile      
 

    Sarkilas
  Wed Mar 07, 2012 6:55 pm
User avatar
Member


Location: Norway
I'm not using a tileset, and as stated in the second post, it creates most of the zones, but skips a few zones. Some coordinate issues here, not the tile collection. It's how the X and Y variables are handled.
Expand to see the code.

This is the new method. In some cases it skips a few X-values on the second zone row.
If we assume a world made out of 2048 x 2048 tiles, and we have 20 zones per row, the first zone on the second row is kind of ignored and leaves an annoying empty hole.

I do not have performance issues with my tile iterations now that I split the zones into its own classes, only iterating tiles when the zone is within the screen bounds, but I am still trying to wrap my head around the black holes that randomly spawn. Perhaps someone can see a flaw in my code where it handles the X values that makes it skip some X-coordinates after moving to the next row?


Top Top
Profile      
 

    SekiRaze
  Wed Mar 07, 2012 8:08 pm
Aprentice of the hidden Ruby
User avatar
Member


Location: Germany
sorry but i cant help, but surelly this explaination makes it alot easier to understand for the others :) good luck with this one. may the force be strong with you

_________________
Has been Streamer at IWBTS.com (iwannabethestream.com) if you go there, tell them SekiRaze sent you.

Haircolors:
Content Hidden


Games i am currently working on:
1. Sx3 - Secret Soul Survivor
Content Hidden


Top Top
Profile      
 

    Sarkilas
  Sun Mar 11, 2012 10:47 pm
User avatar
Member


Location: Norway
I have solved the issue. This is no longer active.


Top Top
Profile      
 

    rosareven
  Sat Mar 17, 2012 2:02 pm
House Vidae
User avatar
Sponsor


Location: Australia
May I ask how did you solve the issue, so that others who happen to have the same problem can learn from what you did?


Top Top
Profile      
 

    Sarkilas
  Thu Dec 20, 2012 4:37 pm
User avatar
Member


Location: Norway
rosareven wrote:
May I ask how did you solve the issue, so that others who happen to have the same problem can learn from what you did?

Kind of late reply, I apologize for not being available for a long time. The code that was solved in this scenario is very old code and probably isn't very effective, but here's the code that was final after the solution was given.

Expand to see the code.

I'm unaware of what actual change that was made, but this shows all the necessary data needed to understand what I actually did.
Random biome widths, random biome choices, and random landmarks (objects such as trees etc) in each biome.

_________________
Well..


Top Top
Profile      
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 


Who is online

Users browsing this forum: No users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

We are an independent, not-for-profit game making community.
Homepage
Board Index
About Us
Downloadable Games
Free Browser Games
Games in Development
RPG Maker Support
Game Maker Support
Construct 2 Support
HBGames the eZine
Advanced RPG Maker
Site Announcements
Powered by phpBB © phpBB Group