-
Notifications
You must be signed in to change notification settings - Fork 0
Developer Utilities
The Frogatto engine comes with several useful developer utilities integrated into it. Utilities are always invoked using the command line arguments, --utility=<utility_name> <args>
The query utility is useful for processing Frogatto's FSON files with FFL. It simply takes a directory or file and will recursively process all .cfg files, executing a given formula on each. If that formula simply returns data values it will output the values, if the formula returns commands, it will execute those commands on the file.
Example: finding all objects with over 10 hitpoints:
./game --utility=query data/objects 'if(hitpoints > 10, {id: 10})
Example: doubling all object's hitpoints:
./game --utility=query data/objects 'set(hitpoints, hitpoints*2))'
The visit_objects() function is very useful in some cases. It returns a list of all {} objects within a node. e.g. if one wanted to find the values of all image: attributes found within objects, one might simply do this:
./game --utility=query data/objects 'map(visit_objects(me), image)' | sort | uniq -c
When the query utility modifies files, it does its best to preserve the file's current comments, spacing, and other attributes. It's not perfect, but it works reasonably well most of the time.
The render level utility outputs a level as an image it takes a level name and output file and renders them.
e.g. ./game --utility=render_level titlescreen.cfg titlescreen.png