FIFE forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

FIFE 0.4.0 has been released on 15th of January, 2017!

Author Topic: FifeRPG Random Map Generation?  (Read 1859 times)

Chris3606

  • Newbie
  • Posts: 6
    • View Profile
FifeRPG Random Map Generation?
« on: February 15, 2014, 08:04:45 pm »

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
Logged

Beliar

  • Newbie
  • Posts: 25
    • View Profile
Re: FifeRPG Random Map Generation?
« Reply #1 on: February 16, 2014, 09:30:08 am »

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: [Select]
General:
    identifier: PlayerCharacter
Agent:
    gfx: player
    map: Level1
    layer: actors
    position: [-5, 0]
    rotation: 180
    behaviour_type: Base
« Last Edit: February 16, 2014, 09:33:41 am by Beliar »
Logged

Chris3606

  • Newbie
  • Posts: 6
    • View Profile
Re: FifeRPG Random Map Generation?
« Reply #2 on: February 16, 2014, 12:44:37 pm »

It takes a dictionary with the component names as keys, and the values are also dictionries the the component properties and their values.

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?
Logged

Beliar

  • Newbie
  • Posts: 25
    • View Profile
Re: FifeRPG Random Map Generation?
« Reply #3 on: February 17, 2014, 09:07:54 am »

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.
« Last Edit: February 17, 2014, 09:09:32 am by Beliar »
Logged