[crossfire] Building materials

Nicolas Weeger nicolas.weeger at laposte.net
Wed Mar 23 07:58:07 CST 2005


Hello.

A few months ago I committed my building code, which lets a player build a map at will.

To correctly be used, the player needs 'Raw materials', like 'Raw floor material', one per square to be used.

Currently, there is only one floor type, and one wall type, as well as the ability to remove walls.

I was thinking of adding more things to build, and wondering the best way to do that.

Right now, my code uses special archetypes, hardcoded with the built item in the 'slaying' field of the archetype.

The idea I had is to make a python plugin to let users request materials. So the player could go to a shop, and ask for 'wood floor', or 'marble floor', or 'fountain', and so on.

How I was thinking of implementing that was:
* when the player asks for material, create a dummy material object.
* set its slaying field with the archetype name (need a 'human name to archetype' conversion so players can say 'wood floor' instead of 'woodfloor' or whatever the archetype is)
* if required, change the material type to 'wall', 'floor', 'item'.

Those last 3 types are the 3 types of items my code currently handles: wall will be built on a floor, and try to connect to other floors around. Floor will destroy a wall on the square, and/or replace existing floor. Finally item is checked for 'connected' (door, lever, ...) type, connected if required (through the use of a marking rune), and inserted.

The main point I have currently is that letting a player request material may lead to abuse. You could ask for 'dragon mail', then build one, if code isn't correctly done.

To prevent that, I see 3 solutions:
* build a 'safe list' of archetypes players can build, fill it with everything they should be allowed to create
* build a 'safe list' of item types allowed. Thus you can disable 'armor' but enable 'wall'.
* don't do any plugin, and make archetypes for all buildable items :)

The 1st is more messy, because when you add a new floor/wall/... you need to update the list, but lets you have more control over what you can or cannot build.
The 2nd may be easier to do (only let players build floor, wall, doors/level/..., and items with no type), but gives less freedom.
3rd is the current one, but will take time to make archetypes for everything you can build - and kind of duplicate many things.

So, what does everyone think of that?

Nicolas

Accédez au courrier électronique de La Poste : www.laposte.net ; 
3615 LAPOSTENET (0,34€/mn) ; tél : 08 92 68 13 50 (0,34€/mn)




    
    


More information about the crossfire mailing list