Re: [Freeciv-Dev] [bug #13599] [RFC; patch] pollution on lakes / ocean
I've started working on generalizing tile specials before school started, but now I hardly find time to sleep. Hopefully, when semester will end I'll get back into it. On Wed, Apr 14, 2010 at 4:05 PM, pepeto no-reply.invalid-addr...@gna.org wrote: Update of bug #13599 (project freeciv): Priority: 5 - Normal = 1 - Later ___ Follow-up Comment #4: Before implementing this, shouldn't we make the tile special a part of the ruleset? ___ Reply to this item at: http://gna.org/bugs/?13599 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #15430] Wish: Unit flags should be handled similarly to effects.
URL: http://gna.org/bugs/?15430 Summary: Wish: Unit flags should be handled similarly to effects. Project: Freeciv Submitted by: luftzig Submitted on: Saturday 02/20/2010 at 00:49 Category: general Severity: 1 - Wish Priority: 5 - Normal Status: None Assigned to: None Originator Email: Open/Closed: Open Release: Discussion Lock: Any Operating System: None Planned Release: ___ Details: Unit flags should be externalized as much as possible, by providing unit effects that act like unit other effects, and have a requirement list. If requirements are met (e.g, unit 1 has flag A is on forest, and unit 2 has flag B) then unit get bonus or can perform certain actions. Will require a way to differentiate between the current unit (and it's tile, city, etc.) and the target unit (and it's tile, adjacent units, cities, nation et cetera). Might require new requirement range. Doing so will greatly help modders. ___ Reply to this item at: http://gna.org/bugs/?15430 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] A question about requirement
Thanks! On Tue, Feb 16, 2010 at 9:27 AM, Matthias Pfafferodt free...@mapfa.de wrote: The definition of the vector can be found in ./utility/specvec.h ... Quoting Pepeto pepet...@gmail.com: Le mardi 16 février 2010 à 01:14 +0200, Yoav Luft a écrit : I'm trying to figure out how to use requirement. In improvement.h, in the improvement struct there's this line: struct requirement_vector reqs; I'd tried to figure out where and how this requirement_vector is defined, but could find anything. I know it's not the best place to ask at, but I'd appreciate your help. (BTW, I'm trying to add requirements to unittype as well). This verctor is defined in the ruleset, in buildings.ruleset. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev This message was sent using IMP, the Internet Messaging Program. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] [bug #15373] add health effect to default/effects.ruleset
When I first made this, I used some spreadsheets in order to choose parameters, and hoped for parameters that will prevent cities of effectively growing bigger than 8 without improvement. I no longer have those spreadsheets, but my original ruleset is found here: http://forum.freeciv.org/viewtopic.php?t=5721 The patch is, of course, irrelevant. Also, I don't know how much the code had changed since my original contribution, so it might be relevant any more. On Mon, Feb 15, 2010 at 11:23 PM, Jacob Nevins no-reply.invalid-addr...@gna.org wrote: Follow-up Comment #1, bug #15373 (project freeciv): I've actually been playing default rules with illness enabled for a while, for giggles. I'm finding it effectively just reduces the max city size with no Sewer System; the default increase in plague chance with size is very steep (size 7/8/9 = 0.0%, size 10 = 11.0%), so I never even get to size 11 (I don't have Sanitation yet). I think this slope dwarfs any effects from pollution/trade. So, the default setup seems uninteresting enough that it's not worth being able to switch it on; I assumed that the parameters needed more tuning. I've got Health_Pct effects Aqueduct = 30, Sewer System = 20, Cure for Cancer = 5; I can't remember where I lifted these from now, but I think the parameters in the [illness] section of game.ruleset are probably what needs tuning. I imagine it also gets more interesting if you have buildings specifically for this like Hospital. Perhaps syntron's experimental ruleset (patch #1236) has better tuned parameters; I haven't looked yet. (It's perhaps a shame that that isn't in 2.2.0 to play with.) Also the effect code on [http://freeciv.wikia.com/wiki/Math_...] is wrong, the name of the effect is Health_Pct and not Health. Fixed. ___ Reply to this item at: http://gna.org/bugs/?15373 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] A question about requirement
I'm trying to figure out how to use requirement. In improvement.h, in the improvement struct there's this line: struct requirement_vector reqs; I'd tried to figure out where and how this requirement_vector is defined, but could find anything. I know it's not the best place to ask at, but I'd appreciate your help. (BTW, I'm trying to add requirements to unittype as well). ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] [Freeciv-i18n] Making default ruler names translateable?
It's really noticeable in Arabic and Hebrew, where writing order it right to left. Having a left to right name in a middle of a right-to-left sentence makes things a bit difficult to read, so it seems like a good idea to me. On Mon, Feb 8, 2010 at 11:31 AM, Sini Ruohomaa sini.ruoho...@cs.helsinki.fi wrote: Hi, It appears that there might be a point in making default ruler names translateable, since their spelling actually differs from one language to the other. I haven't glimpsed at an up-to-date po file in quite a few months so I assume they haven't become translateable just now. O:) For example: Atawallpa is Atahualpa and Mary Stuart is Maria Stuart in Finnish. Greek philosophers are also typical causes for mismatches, I seem to recall from English class. ;) I expect that languages with Kyrillic, Greek and Arabic lettering and Japanese currently get the names as standard ascii English versions too? Please keep the i18n list in cc for any translator-relevant replies. :) (Dunno if the message gets to -dev past spam protection even, since I'm not on the list.) --Sini PS. Thanks to Juhani Heino for pointing this out. ___ Freeciv-i18n mailing list freeciv-i...@gna.org https://mail.gna.org/listinfo/freeciv-i18n ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] [bug #15258] Some cities fail sanity checking after nuclear winter
Maybe we should simply allow cities to exist on such tiles, but not be created on? I mean, it's nuclear winter, and yeah, some cities might be caught in newly created glacier, or something. On Sat, Feb 6, 2010 at 11:56 AM, pepeto no-reply.invalid-addr...@gna.org wrote: Update of bug #15258 (project freeciv): Planned Release: 2.2.0 = 2.1.12, 2.2.0 ___ Follow-up Comment #5: Fix for S2_1 attached. (file #7948) ___ Additional Item Attachment: File name: S2_1_city-check-for-nuclear_winter-and-global_warming.diff Size:0 KB ___ Reply to this item at: http://gna.org/bugs/?15258 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] [bug #13890] [Patch] Transform unit
This leads me to think of Colonization, where certain units, when they lose combat, transform to another, weaker unit. If I'll have the time I'll try to add this as well. On 7/7/09, Marko Lindqvist no-reply.invalid-addr...@gna.org wrote: URL: http://gna.org/bugs/?13890 Summary: [Patch] Transform unit Project: Freeciv Submitted by: cazfi Submitted on: Tuesday 07/07/2009 at 02:59 Category: None Severity: 3 - Normal Priority: 1 - Later Status: None Assigned to: None Originator Email: Open/Closed: Open Discussion Lock: Any Release: Operating System: None ___ Details: Attached patch makes it possible for units to transform in to other units. I needed this to make something like Cannon build crew unit which, after built in city, can move to site where cannon should be placed. Then the crew transforms itself in to immobile Cannon unit. Cannon cannot transform to anything. Of course this new moddability feature can be used to many other things as well, as long as AI's inability to use this feature is not a problem. As implemented in this patch, transforming takes no time. It works like unit upgrade does (sharing most of the code with upgrading). ___ File Attachments: --- Date: Tuesday 07/07/2009 at 02:59 Name: TransformUnit.diff Size: 15kB By: cazfi http://gna.org/bugs/download.php?file_id=6156 ___ Reply to this item at: http://gna.org/bugs/?13890 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#40617) Assertion with RiverNative flag
URL: http://bugs.freeciv.org/Ticket/Display.html?id=40617 Hi, On the trunk, when giving the trireme RiverNative flag, the game forces us to change it's movement type to Both in order of it to work. But doing so cause a in advmilitary.c. The backtrace: civserver: advmilitary.c:1183: kill_something_with: Assertion `SEA_MOVING == utype_move_type(boattype)' failed. Program received signal SIGABRT, Aborted. 0x7feec1c313c5 in raise () from /lib/libc.so.6 (gdb) backtrace #0 0x7feec1c313c5 in raise () from /lib/libc.so.6 #1 0x7feec1c3273e in abort () from /lib/libc.so.6 #2 0x7feec1c2ab1f in __assert_fail () from /lib/libc.so.6 #3 0x004c415c in kill_something_with (pplayer=0x898100, pcity=0x1bd2b40, myunit=0x1bcecb0, choice=0x1bd38e0) at advmilitary.c:1183 #4 0x004c437a in military_advisor_choose_build (pplayer=0x898100, pcity=0x1bd2b40, choice=0x1bd38e0) at advmilitary.c:1512 #5 0x004ccb33 in ai_manage_cities (pplayer=0x898100) at aicity.c:1754 #6 0x004d1942 in ai_do_last_activities (pplayer=0x898100) at aihand.c:460 #7 0x0046d64d in srv_running () at srv_main.c:795 #8 0x0046dc86 in srv_main () at srv_main.c:2259 #9 0x00404236 in main (argc=3, argv=0x7fffca829328) at civserver.c:283 The AI exepcts the transport to be a boat, moving over seas. Is this check really neccesary? Should we check if the suggested unit can reach the target unit some other way, or at least check that the movement type is not land? ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] Patch: Generalizing bonus such F_HORSE vs. F_PIKEMEN
This patch is supposed to allow modders to use more bonuses against specific units. It adds for the units.ruleset the following optional fields: bonus_against_classX = Class Name - against which class we get bonus. the X is a number from 1 to 4, so we can have different bonuses against up to 4 different classes. defense_bonusX = (percent value) - percent by which unit's defense is increased against the class given in bonus_against_classX. Notice that the X must be the same number. Also, negetive value will decrease our defense. E.g - 100 will double our defense (adds it's full value to itself), while -50 will halve it. attack_bonusX = (percent value) attack_firepowerX = (number) - The firepower when attacking that class, the default is keeping the same firepower. defense_firepowerX = (number) - As above, but when defending against that class. I am sending this to the mailing list first because: A. I am not sure my approach is good. It works, but it's not nesseceraily the best solution. B. The code on helpdata.c does not work, it always see NULL pointers, altough everywhere else it doesn't happen. diff -r -u trunk/ai/advmilitary.c trunk-class-bonus/ai/advmilitary.c --- trunk/ai/advmilitary.c 2008-10-26 18:33:50.0 +0200 +++ trunk-class-bonus/ai/advmilitary.c 2008-12-22 13:19:16.0 +0200 @@ -488,6 +488,8 @@ static unsigned int assess_danger(struct city *pcity) { int i; + int j; + int h = 0; unsigned int danger[DANGER_LAST]; int defender; struct player *pplayer = city_owner(pcity); @@ -496,6 +498,8 @@ int igwall_threat = 0; struct tile *ptile = pcity-tile; int defense; +#define MAX_DEFENSE_BONUS 8 + struct unit_class *(defense_bonuses)[MAX_DEFENSE_BONUS]; TIMING_LOG(AIT_DANGER, TIMER_START); @@ -514,7 +518,19 @@ unit_list_iterate(ptile-units, punit) { if (unit_has_type_flag(punit, F_DIPLOMAT)) pcity-ai.has_diplomat = TRUE; + /* Check if the defender has some bonus against any type at all */ + int j; + for (j = 0; j = CLASS_BONUS_MAX; j++) { + if (punit-utype-bonuses[j].class_bonus == NULL) { +continue; + } else { +if (punit-utype-bonuses[j].defense_bonus != 0) { + defense_bonuses[h] = punit-utype-bonuses[j].class_bonus; + h++; +} + } + } } unit_list_iterate_end; players_iterate(aplayer) { @@ -567,14 +583,23 @@ } if (unit_has_type_flag(punit, F_HORSE)) { - if (pikemen) { - vulnerability /= 2; - } else { - (void) ai_wants_role_unit(pplayer, pcity, F_PIKEMEN, -vulnerability * move_rate / -MAX(dist * 2, 1)); - } - } +if (pikemen) { + vulnerability /= 2; +} else { + (void) ai_wants_role_unit(pplayer, pcity, F_PIKEMEN, + vulnerability * move_rate / + MAX(dist * 2, 1)); +} + } + + /* we check whether we have a unit with a bonus against that class + * if so, we reduce vulnerability to half (regradless of the bonus) + */ + for (j = 0; j h; j++) { +if (punit-utype-uclass == defense_bonuses[j]) { + vulnerability /= 2; + } + } if (unit_has_type_flag(punit, F_DIPLOMAT) (dist = 2 * move_rate)) { pcity-ai.diplomat_threat = TRUE; @@ -681,6 +706,7 @@ int desire = punittype-hp; int attack = punittype-attack_strength; int defense = punittype-defense_strength; + int defense_bonus = 0; /* Sea and helicopters often have their firepower set to 1 when * defending. We can't have such units as defenders. */ @@ -699,6 +725,17 @@ if (utype_has_flag(punittype, F_GAMELOSS)) { desire /= 10; /* but might actually be worth it */ } + /* if unit has any defense bonus at all */ + int i; + for (i = 0; i = CLASS_BONUS_MAX; i++) { + if (punittype-bonuses[i].class_bonus == NULL) { + continue; + } else { + defense_bonus += punittype-bonuses[i].defense_bonus; + } + } + desire += (defense_bonus * defense) / 100; + return desire; } diff -r -u trunk/client/helpdata.c trunk-class-bonus/client/helpdata.c --- trunk/client/helpdata.c 2008-11-21 07:54:27.0 +0200 +++ trunk-class-bonus/client/helpdata.c 2008-12-24 19:20:24.0 +0200 @@ -1012,6 +1012,51 @@ for the attacker.\n), utype-bombard_rate); } + /* Get some information about unit bonuses */ + int i; + for (i = 0; i CLASS_BONUS_MAX; i++) { + if (utype-bonuses[i].class_bonus == NULL) { + continue; + } + if (utype-bonuses[i].attack_bonus 0) { + cat_snprintf(buf, bufsz, + _(* Gets %d percent attack bonus against units of %s class.\n), + utype-bonuses[i].attack_bonus, + uclass_name_translation(utype-bonuses[i].class_bonus)); + } + if (utype-bonuses[i].attack_bonus 0) { + cat_snprintf(buf, bufsz, + _(* Gets %d percent attack penalty against units of %s class.\n), + utype-bonuses[i].attack_bonus, + uclass_name_translation(utype-bonuses[i].class_bonus)); + } + if (utype-bonuses[i].defense_bonus 0) { + cat_snprintf(buf, bufsz, + _(* Gets %d percent defense bonus against units of %s
Re: [Freeciv-Dev] function genlist_size() causes game to crash after I've added new effect
Good morning for this side of the world... My patch compiles against the latest trunk, and as far as can see, it works, and even as expected. I only have to make the GTK GUI show some relevant information, because currently it always shows that the chance for a city to catch a plague is 0. It seems that, as I have planned, my patch effectively keeps cities from growing to large without certain improvements, while not setting a fixed size. A city without an aqueduct is unlikely to grow above size 8 for long. Haven't got to larger cities yet. I'll send a newer patch in a couple of days or so, with a ruleset that uses the new feature. On 12/18/08, Madeline Book madeline.b...@gmail.com wrote: On 12/17/08, Yoav Luft yoav.l...@gmail.com wrote: Hi, I've written a little patch to the stable tree, as a way to acquaint myself with the code of freeciv. The patch adds the new functionality of plagues to game, which are determined randomly based on the size, pollution, improvements and trade routes of a city. The patch segfaults on me. I get that massage: Program received signal SIGSEGV, Segmentation fault. 0x0041bd7d in pay_for_units (pplayer=0x861e18, pcity=0x1890fc0) at ../utility/speclist.h:110 110 return genlist_size(tthis-list); it only happens when the game.info.plague_on is true, but I do not understand what genlist_size() does, or where and why it is called. It is my first attempt at adding code to freeciv, and I've spent some nights trying to understand what went wrong, but I'm kinda clueless. I guess it's not a bug, but rather a I didn't do something they it should be done, but I could find what that is. Attached is the patch. I will appreciate any help, even in explaining me what genlist_size does. The function genlist_size returns the size of a genlist which is a linked list of pointers. Genlists are used to implement speclists, which are just macro-generated interfaces to the genlist functions for specific data types (to avoid the type unsafe void pointers used by genlists). These data structures are defined in utility/genlist.h and utility/speclist.h. The particular segfault you have there is in all likelyhood caused by an operation on a NULL list somewhere; it would help if you looked at the entire backtrace to see the history of function calls. Then when you have a rough idea of where the NULL list might be, you can use gdb to step through the code or just insert some printfs (:D) to have the program tell you how far it gets before crashing. Once you pin point the location of the NULL access you can trace back the code path and find what caused the list to be NULL in the first place (you would check all the changes you made that get activated by your new setting). There is some information about using gdb for debugging here: http://freeciv.wikia.com/wiki/Bug_Reporting Also, I looked at your patch and it is actually not that bad at first glance. Granted you need to setup diff to ignore all those useless files that change every configure/make cycle, and setup your editor to follow the freeciv coding style more closely. Of course this is only if you intend to submit your patch for inclusion later. Here are some more helpful pages: http://freeciv.wikia.com/wiki/How_to_Contribute http://freeciv.wikia.com/wiki/Coding_Style Oh and by the way, you should implement new features on the trunk branch; the stable 2.1.x series is only getting bugfixes now. --- 黒死病で死にたくない。 ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] function genlist_size() causes game to crash after I've added new effect
Hi, I've written a little patch to the stable tree, as a way to acquaint myself with the code of freeciv. The patch adds the new functionality of plagues to game, which are determined randomly based on the size, pollution, improvements and trade routes of a city. The patch segfaults on me. I get that massage: Program received signal SIGSEGV, Segmentation fault. 0x0041bd7d in pay_for_units (pplayer=0x861e18, pcity=0x1890fc0) at ../utility/speclist.h:110 110 return genlist_size(tthis-list); it only happens when the game.info.plague_on is true, but I do not understand what genlist_size() does, or where and why it is called. It is my first attempt at adding code to freeciv, and I've spent some nights trying to understand what went wrong, but I'm kinda clueless. I guess it's not a bug, but rather a I didn't do something they it should be done, but I could find what that is. Attached is the patch. I will appreciate any help, even in explaining me what genlist_size does. Luftzig. health.diff Description: Binary data ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [Discussion] Trade routes and special resources
Hi, I decided to add a more complex and interesting trade system for freeciv. Something much like Civ3 trade system with special resources that can be trade and are requisite for building certain buildings. I'm not quite sure how it should be done from a the game perspective. Please tell if there is some other place more suited for this kind of discussion, as I'm rather new to freeciv's community. One way would be to copy Civ3's system of trading goods/resources through treaties, and that each resource is available in all cities that are connected to a city that has that resource through train, harbor or airport. The problem with that approach, as I see it: 1. There's no significance to the amount of that resource available. You only need one of each to supply all your cities. Surplus is meaningless unless you can trade it, which from my experience doesn't happen at advance stages of the game. 2. There is no real meaning the route by which trade goes. You can't pillage a trade route, nor there is any meaning to the way in which it is transported (Sending coal with airliners is quite price and inefficient). 3. You cannot trade in food, so you cannot have specialized cities that depend on food from other source. On the subject of resources, I though they could be added as output_type, so we could trade anything (like science output). Some buildings / units should have a build cost in special resources as well, and maybe upkeep to (A coal power plant can't work without coal, most modern motorized units will need fuel to work, for example). It would add some complexity to the game, but it will mostly add a lot of challenge, as you'll have to acquire sufficient materials to support your super modern war machines. On the matter of trade routes, I can think of 3 different approaches, in my opnion all of them are bad: 1. Civ3's - you have resource. You make treaty to sell that much for that nation for so much time for so much money / other resource. Pros: Simplistic. Cons: There's no physical route, so third party cannot intervene in some way, and neither does distance have any significance; No trading between your cities, resource are just magically distributed. 2. Colonization's - Trade is done manually by moving units that carry trade between places, and bartering (or not, depending on where) on the price of each resource. Some automation is available. Pros: Realistic, You can trade any thing, you can intercept everyone's else trade. Cons: tiresome and complex micromanagement. 3. Imperialism (1 2) - Each turn you can set how much of each resource you are selling and what you are bidding for. At the start of each turn you get biddings from other players, and sell offers, and decide what to sell, from who, at which price, etc. The total amount resources you can move from city to city depends on how many trade ships or trains you've got. Pros: very realistic, interesting, and not extremely complex Cons: the bidding phase in each turn is very tiresome. micromanagement. What I suggest (and idea which is not yet fully developed) is this: To establish a new trade route, send a caravan to the city you want to trade with. If this is your city, you'll get a a dialog in which you set how much of what resource you want to send to that city each turn (or possibly, each caravan trip), and if you want something sent back. If it's not your city, a treaty dialog is opened at both players, so they can negotiate what they trade and for how much. A single caravan can trade all kind of resources up to amount defined in the unit type divided by the time it takes to that type of unit to get from city A to city B (adjusted each turn, so railroads give great advantage). Another possibility is that you get amount once every [trip time] turns, for added realism. Once a trade route has being established, the unit disappears (but is still maintained), and a trade route appear in both cities dialogs. Each city can adjust the amount and if they're of different players, they can either renegotiate the trade route or if we allow dirty backstabbing, stop adjust the amount sent from the city without negotiation (the other player will be altered of this next turn). Each trade route should also add some trade bonus on both cities. The upkeep for the original unit disappears when the trade route is canceled entirely. Well, what do you think? ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev