***Warning: Freeciv Enthusiast Plug***
Well I've been putzing around Freeciv 2.1 Beta for a bit now and the developers have released their first work using an event structure.
In Freeciv, almost all of the files used to create a game can be edited using a simple text editor. Save files, graphic dimensions, game rules, terrain rules, etc... can all be edited without having to get involved in major programming or hex editing.
Freeciv 2.1 Beta uses a unique way of grouping events. Instead of existing in a seperate text file that has to be "loaded" into a game save the event structure exists within the save. It sits right there next to the game map (which can be edited in the text editor), the games basic world rules (which can be edited in the text editor), and civilization players included (which can edited in the text editor along with their starting positions). In short, it can all be edited using Wordpad.
Of course, there's a small hitch. The save games are compressed into gz format, but thankfully they can be unzipped using a number of handy utilities similar to Winzip and Winrar. I used 7-zip, which is a free compressor program with a handy file manager screen like WinRar. After the file is unzipped it is ready to be edited using a text editor.
The event structure is still a bit basic, but powerful as you can see from some lines of script I have cut from the tutorial.sav. I probably have left out a little bit of the scripting from my rudimentary cutting and pasting, but the bulk of the event is listed.
This is an example of an If Turn trigger used to cause the Notify event. It displays a popup text box using regular windows language, just like anyother window on your desktop. The text has to be sparsed using some basic code "\\n\" to get the text to wrap, just like we have to do with our scenario popups in Civ2.
This is an example of an City Growth trigger used to cause the Notify event.
This is an example of an If Unit Built trigger used to cause the Notify event.
This is an example of an If Unit Can't Be Built trigger used to cause the Notify event.
Other Triggers:
If Military Unit Built
If Tech Researched
If Hut Entered
As you can see, the event language is growing and is quickly becoming fully fleshed out.
I'm having a ball screwing around with Freeciv. The language is easy to use and read. Try it out!
***End Freeciv Enthusiast Transmission***
Well I've been putzing around Freeciv 2.1 Beta for a bit now and the developers have released their first work using an event structure.
In Freeciv, almost all of the files used to create a game can be edited using a simple text editor. Save files, graphic dimensions, game rules, terrain rules, etc... can all be edited without having to get involved in major programming or hex editing.
Freeciv 2.1 Beta uses a unique way of grouping events. Instead of existing in a seperate text file that has to be "loaded" into a game save the event structure exists within the save. It sits right there next to the game map (which can be edited in the text editor), the games basic world rules (which can be edited in the text editor), and civilization players included (which can edited in the text editor along with their starting positions). In short, it can all be edited using Wordpad.
Of course, there's a small hitch. The save games are compressed into gz format, but thankfully they can be unzipped using a number of handy utilities similar to Winzip and Winrar. I used 7-zip, which is a free compressor program with a handy file manager screen like WinRar. After the file is unzipped it is ready to be edited using a text editor.
The event structure is still a bit basic, but powerful as you can see from some lines of script I have cut from the tutorial.sav. I probably have left out a little bit of the scripting from my rudimentary cutting and pasting, but the bulk of the event is listed.
This is an example of an If Turn trigger used to cause the Notify event. It displays a popup text box using regular windows language, just like anyother window on your desktop. The text has to be sparsed using some basic code "\\n\" to get the text to wrap, just like we have to do with our scenario popups in Civ2.
function turn_callback(turn, year)
if turn == 0 then
notify.event(nil, nil, E.TUTORIAL,
_('Welcome to Freeciv. You lead a civilization. Your\\n\
task is to conquer the world! You should start by\\n\
exploring the land around you with your explorer,\\n\
and using your settlers to find a good place to build\\n\
a city. Use the number pad to move units around.'))
end
end
signal.connect('turn_started', 'turn_callback')
if turn == 0 then
notify.event(nil, nil, E.TUTORIAL,
_('Welcome to Freeciv. You lead a civilization. Your\\n\
task is to conquer the world! You should start by\\n\
exploring the land around you with your explorer,\\n\
and using your settlers to find a good place to build\\n\
a city. Use the number pad to move units around.'))
end
end
signal.connect('turn_started', 'turn_callback')
function city_growth_callback(city, size)
if city.owner:is_human() then
if size == 2 and not growth2msg then
notify.event(city.owner, city.tile, E.TUTORIAL,
_('Your city has grown! As a city grows, more citizens become\\n\
available that can be put to work in the fields or dedicated as\\n\
citizen specialists. A city of size two or more may also build\\n\
settlers, which costs one unit of population.\\n\
\\n\
If your city is building settlers, you should consider buying them\\n\
now. Open the city dialog and click on the Buy button. This trades\\n\
in gold (if you have enough of it) to instantly complete the\\n\
production.'))
growth2msg = true
if city.owner:is_human() then
if size == 2 and not growth2msg then
notify.event(city.owner, city.tile, E.TUTORIAL,
_('Your city has grown! As a city grows, more citizens become\\n\
available that can be put to work in the fields or dedicated as\\n\
citizen specialists. A city of size two or more may also build\\n\
settlers, which costs one unit of population.\\n\
\\n\
If your city is building settlers, you should consider buying them\\n\
now. Open the city dialog and click on the Buy button. This trades\\n\
in gold (if you have enough of it) to instantly complete the\\n\
production.'))
growth2msg = true
function unit_built_callback(unit)
if not unit.owner:is_human() then
return
end
if unit:type().name == 'Settlers' then
if settlersbuilt == 0 then
notify.event(unit.owner, unit.tile, E.TUTORIAL,
_('You have built a settler unit. Settlers are best used to build \\n\
new cities, so as to expand your civilization. Move your settler\\n\
away from your existing cities to find a spot for a new city. When\\n\
you have picked a spot press B to build the city.\\n\
\\n\
Again, cities are best built on open ground near water. Grassland\\n\
and plains provide food for the city. Forests and hills provide\\n\
the resources (shields) needed for building things. Rivers and ocean\\n\
give trade bonuses that provide civilization-wide benefits. Desert,\\n\
tundra, and mountains generally provide little output and are not\\n\
of much use to small cities. See the help on terrain and specials\\n\
for more information about terrain specs.'))
if not unit.owner:is_human() then
return
end
if unit:type().name == 'Settlers' then
if settlersbuilt == 0 then
notify.event(unit.owner, unit.tile, E.TUTORIAL,
_('You have built a settler unit. Settlers are best used to build \\n\
new cities, so as to expand your civilization. Move your settler\\n\
away from your existing cities to find a spot for a new city. When\\n\
you have picked a spot press B to build the city.\\n\
\\n\
Again, cities are best built on open ground near water. Grassland\\n\
and plains provide food for the city. Forests and hills provide\\n\
the resources (shields) needed for building things. Rivers and ocean\\n\
give trade bonuses that provide civilization-wide benefits. Desert,\\n\
tundra, and mountains generally provide little output and are not\\n\
of much use to small cities. See the help on terrain and specials\\n\
for more information about terrain specs.'))
function unit_cant_be_built_callback(unittype, city, reason)
if not city.owner:is_human() then
return
end
if unittype.name == 'Settlers' and not nosettlermsg then
notify.event(city.owner, city.tile, E.TUTORIAL,
_('Your city cannot build a settler. Settlers take one unit of\\n\
population to build, so a city of size one cannot build one without\\n\
disbanding the city.\\n\
\\n\
To remedy this, you need to adjust the citizens in the city to\\n\
provide more food so as to grow the city faster. Cities that\\n\
do not have much food should not try to build settlers. When\\n\
founding a new city, make sure it is built on terrain that provides\\n\
enough food - grassland is best; plains or hills are almost as good.'))
nosettlermsg = true
if not city.owner:is_human() then
return
end
if unittype.name == 'Settlers' and not nosettlermsg then
notify.event(city.owner, city.tile, E.TUTORIAL,
_('Your city cannot build a settler. Settlers take one unit of\\n\
population to build, so a city of size one cannot build one without\\n\
disbanding the city.\\n\
\\n\
To remedy this, you need to adjust the citizens in the city to\\n\
provide more food so as to grow the city faster. Cities that\\n\
do not have much food should not try to build settlers. When\\n\
founding a new city, make sure it is built on terrain that provides\\n\
enough food - grassland is best; plains or hills are almost as good.'))
nosettlermsg = true
If Military Unit Built
If Tech Researched
If Hut Entered
As you can see, the event language is growing and is quickly becoming fully fleshed out.
I'm having a ball screwing around with Freeciv. The language is easy to use and read. Try it out!
***End Freeciv Enthusiast Transmission***
Comment