Sunday, November 2, 2014

World Generation By Pathing?


Hey guys, this is my first post on the site. I'm currently working on a game engine and am trying to come up with a solution which requires many steps.


The object types I am using:


An object called SectionInfo, which is filled with data, or if has defined properties before being implemented into the world will be used to store and have data extracted from this object when the World Generation Method is called.


An object (You could call it a map) that holds a key, and a set of values for that key. This key is an int[] which holds 2 (possibly maybe 3 values if I need to change it) values, the first at index 0 being the node Iteration number, and the second at index 1 being the subNode (Child iteration sequence) number. Then I log the unique ID number of the placed section.


An object (You could call it a map) that holds an integer as the Key, and a set of values that are either node keys (int arrays that would be used for the node map stated above) or the unique section ID's (Integers). This is used so that when I need to know which path the section is on, I can do PathMap.getValueKey(SectionID) and it would return the path it sits on. If I want the list of Sections that sit on a specific Path, I can do PathMap.getKeyValue(PathID) and it would return the Section ID's in a Set of Integers.


Sections need to know if there is space along the Current Path Iteration. I need a way to check in 2D space if the Path generated will intersect with previous paths, but when placing sections I need to know if it is going to collide with other sections or not.


What I was thinking; I could store a list of Polygons that represent the space taken up when a section is placed, and then when placed I have to assign an entrance/door to the next section, and also figuring out what other sections it's adjacent to which could include it in it's node map as well.


Interconnecting Nodes on different iteration Levels, I don't know, but it is very confusing to think about. What step do I start on?


Goal:



  • Populate a map of Paths (Not nodes, but a group of sections that are unobstructed when going from one to the other all the way to the last section in the Path) that holds a set of the section ID's in that Path.





  • Populate a map of nodes with a set of the section ID's on that node, as well as assigning adjacent sections a Section ID of adjacent Sections.





  • Place Sections in 2D space without blocking paths, or placing on other sections that already have taken up some of the space.


If any of you have any suggestions or tips towards an implementation, that'd be quite helpful. As for the Maps I'm using to store these objects, I have my own class that deals with this created, so don't offer suggestions on using TreeMaps or HashMaps etc, I already have that handled.



No comments:

Post a Comment