General Category > Game creators corner

FifeRPG Random Map Generation?

(1/1)

Chris3606:
I'm thinking about trying to use FifeRPG v0.2 to randomly generate maps (or, at least, entities ON maps).  Obviously, the system was designed to have a very explicit list of entities (in entities.yaml) for ALL maps when the game is started.  Obviously, if I am going to randomly generate levels, or, at least, the entities on them, that isn't desirable because only IF the user were to clear a level would I want to go generating more entities for more maps, etc.  Before I get to far into this, wanted to ask around and see if anybody has ever tried this/knows if there is a preferred or designed way to implement this, preferably without completely reworking entity loading and whatnot.

Thanks,
Chris

Beliar:
Well, when you want to create a separate map system, than the one from fife, then you have to call the get_or_create_entity system of the World class for creating the entities. It takes a dictionary with the component names as keys, and the values are also dictionries the the component properties and their values.

If we take the example from the tutorial (http://fife-rpg.github.io/docs/v0.2/tutorial/entities.html) the format is like this:


--- Code: ---General:
    identifier: PlayerCharacter
Agent:
    gfx: player
    map: Level1
    layer: actors
    position: [-5, 0]
    rotation: 180
    behaviour_type: Base

--- End code ---

Chris3606:

--- Quote from: Beliar on February 16, 2014, 09:30:08 am ---It takes a dictionary with the component names as keys, and the values are also dictionries the the component properties and their values.

--- End quote ---

Ok, that's what I figured.  Out of curiosity, though, what is the intended implementation of having the info AND the extra variables able to be passed in to it?  If the only thing that needs to be passed in is a dictionary (with dictionaries inside of it), why are the identifier and the two others separate?

Beliar:
Well, actually info is optional (unless you want to create a new entity if none is present with that identifier), and the identifier is used to return an entity that is already present with that identifier. Actually, the examply might be misleading, as you don't need to have the Agent component in the dictionary, it will be automatically created by the RPGEntity.

Edit:
As for extra, I currently don't know why it is there myself, would have to check the code where it is used, but this is also optional.

Navigation

[0] Message Index

Go to full version