[crossfire] Random map layout

Mark Wedel mwedel at sonic.net
Sun Mar 18 22:43:00 CDT 2007


Nicolas Weeger wrote:
> Hello.
> 
> Current random map layouts are kind of limited, and repetitive, and such :)

  I don't think it was ever designed to cover all possible map possibilities, 
but was really put in to add some more maps for the game.

> 
> To improve that, I'd like to either alter existing layouts or add new ones.
> 
> I just committed some changes that enable a plugin to access random map code 
> generation, including giving a layout for map filling (add walls, exits, 
> monsters, ...).
> 
> Would it be better to add those new layouts through a plugin, or directly into 
> the random_maps code?
> Note that to correctly work, the plugin needs an event_apply into the exit 
> that should point to a random map, to hook.
> 
> I already made a proof-of-concept layout generator, that correctly works. 
> Would be a matter to implement the layouts there, simply.

  My thought is this
In general, the code should be in the random maps (C) code for most of the layout.

  However, it would certainly be a good thing to be able to hook plugins into 
aspects of the map generation.  IIRC, there are about half a dozen steps in 
doing a random map - putting down the walls, putting in doors, putting in exits, 
putting in monsters, etc.  It'd be really nice to be able to have something like 
(psuedo python code here):

event_apply for random exit:
do_standard_layout();
do_standard_walls()
do_my_custom_monster_generation() (function is in this plugin, etc)
do_standard_treasure();
etc.

  As for why C code vs python:  I'll first admit I'm submit biased, as I'm not 
much a python user, but for me, it mostly comes down to it seems much easier to 
debug C code when things go wrong than the python code - much easier to see what 
line of code it was, all the values it was using, etc, than the python logic - 
I'm sure it can be done in some ways, but isn't as automatic to see what actual 
line of python script was executing, the values in the python script, etc.




More information about the crossfire mailing list