Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Civilization IV > Civ4-General > c++ ability
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!
22.Sep: BLUE IS OCEAN, GREEN IS GRASS
22.Sep: SMAC-LIKE UN COUNCIL CONFIRMED
21.Sep: GERMAN `ANONYMOUS` LAUNCHES

bottom of page
  
Author
Thread   
Pages (2): [ 1   2   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:37
  Old Post 11-09-2005 03:50
Edit/Delete Message Reply w/Quote
#31 Report this post to a moderator
Suffering from ads?

quote:
Uh, no. A good AI doesn't care about the Carrier Flag, because the only unit with it is the Aircraft Carrier. A good AI doesn't care about any of the flags, because it knows the specific strategy to use for each unit.

Considering there are promotions which allow units to gain abilities, I think the kind of hard-coding you're suggesting would just weaken the ai. I agree with Solver. A good ai shouldn't know about units, but about the underlying abstractions.
As for a carrier flag, it's exactly the same for the ai to care about a carrier flag or about being an aircraft carrier, since, in your example, they are the same thing. But the one which knows about the flag is easier to adapt to modding.
Also, it's usually safer to build the ai on math rather than on believes. For instance you know that your units (of type A) can beat enemy units (of type B) with a given ratio of success. How many do you send to attack 3 kind B units? You are NOT going to compute the proportions for each possible pair of unit types as it's a huge table, and using such huge tables everywhere bloats and slows down the program needlessly. You're going to simulate the fights or compare the strengths. Abstraction is better because it is more accurate (less chance of an error slipping in the code), smaller and faster.
Also, Kuci, the kind of ai you're talking about is unable to handle modding. People who start modding the ai will start modding other aspects of the game, and the ai you're wishing for will be unable to handle these. Thus it will be useless for most people who would use it. Everyone who makes a mod or scenario would have to rewrite the whole ai for it to work, which is not practical.

Kuciwalker is offline Kuciwalker
Emperor
of Schmooism
Feb 2001
time: 00:37
  Old Post 11-09-2005 04:21
Edit/Delete Message Reply w/Quote
#32 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

quote:
Considering there are promotions which allow units to gain abilities, I think the kind of hard-coding you're suggesting would just weaken the ai. I agree with Solver. A good ai shouldn't know about units, but about the underlying abstractions.


A good AI in which the underlying units aren't fixed, yes. When they are, it doesn't have to.

quote:
Also, Kuci, the kind of ai you're talking about is unable to handle modding. People who start modding the ai will start modding other aspects of the game, and the ai you're wishing for will be unable to handle these. Thus it will be useless for most people who would use it. Everyone who makes a mod or scenario would have to rewrite the whole ai for it to work, which is not practical.


WHICH IS MY POINT.

Firaxis has to make an AI that can handle mods. Apolyton doesn't.

The AI that Apolyton would make, I'd think, is one that would be specifically customized to the default ruleset, or a slight modification thereof ala Apolyton University. It would be programmed with the strategies that players discover over time for that specific ruleset, and would fail when used in a mod. This AI would be superior to the Firaxis AI, in those stock games, and could even prove a formidable opponent.

Solver is offline Solver
Apolyton Duke Of Something
Latvia, Riga
Sep 2000
time: 07:37
  Old Post 11-09-2005 04:40 Visit Solver<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#33 Report this post to a moderator
Support Apolyton buy from Amazon

Uhh, you are, simply put, wrong. The AI will always take in account several factors when taking decisions. That's how it works. The factors will be numerous. To pick a promotion, you have to look at the overall situation, not always pick the same promotion. Thus, several factors. If you want the AI to choose the best promotion, you have it look at those factors. When it does, it simply doesn't matter anymore whether the unit is fixed or not. You don't tell the AI that for Swordsmen, it needs promotion X. You tell it what to consider when picking a promotion, and the AI will do it.

I really doubt Firaxis are specifically adding code that makes the AI adapt to mods. It's too complex. However, adaptation is simply emergent behaviour. A well designed AI is adaptive, to a degree.

Kuciwalker is offline Kuciwalker
Emperor
of Schmooism
Feb 2001
time: 00:37
  Old Post 11-09-2005 05:39
Edit/Delete Message Reply w/Quote
#34 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

quote:
Uhh, you are, simply put, wrong.


Great rebuttal

quote:
The AI will always take in account several factors when taking decisions. That's how it works.


Where did I say it wouldn't?

quote:
To pick a promotion, you have to look at the overall situation, not always pick the same promotion.


Where did I say it would?

However, the AI can be programmed with a sort of understanding of the uses of the various promotions, if they're constant, and to which units they should be applied, in what proportions, in what situations.

quote:

I really doubt Firaxis are specifically adding code that makes the AI adapt to mods. It's too complex. However, adaptation is simply emergent behaviour. A well designed AI is adaptive, to a degree.


No no no. Even the Civ3 AI adapted to mods. There were the flags, and it looked at move points and such. It built defense units in certain situations, offense units in others. But it never knew to do a Palace jump, or beeline for Cavs, or build a settler factory.

Wise Ass is offline Wise Ass
Warlord
Your Mom's House... Why?
Aug 2001
time: 00:37
  Old Post 11-09-2005 08:59 Visit Wise Ass's homepage!
Edit/Delete Message Reply w/Quote
#35 Report this post to a moderator
Tired of ads?

I hate to but in when I don't know the subject all that well but it sounds to me like you are saying the same thing.

Kuci is saying that the stock AI will be good and adaptive to mods overall by using the flags. However, when the community mods the game they will take specific things that players do or exploits and train the AI to do the same.

For instance, if the tech tree isn't as good as expected and players find a way where one research path is always used, then in order to aid the AI the mods will code the AI to use the same method.

I don't know it sounded to me like you were all argueing the same point and just misunderstood each other. I'll but out for now.

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:37
  Old Post 11-09-2005 12:49
Edit/Delete Message Reply w/Quote
#36 Report this post to a moderator
Remove this text

quote:
Firaxis has to make an AI that can handle mods. Apolyton doesn't.

You can certainly make ai's that will be able to better handle specific mods. But the more fine-tuning you do, the less generic they become, the less useul they become. Kuciwalker, you seem to believe there will be one standard game and the ai will be able to better cope with that standard thanks to modding. It's possible, but I don't believe that. I think there will be mods, that these will be different, and an ai devised for the standard game would behave worse than the standard ai for them.
In my opinion, the way to make the ai better is not to teach it units (CtP2 has a simple way of teaching which unit to build: It's got a list and picks the best unit of the given type in the list), but to teach it things the rules allow.
For instance, if the special ability XXX is overpowerful, it's intersting to teach the ai: "Try to get units with ability XXX". It will have several ways of doing that: Promoting them, or building such units. Building such units may require techs or resources. So you have to keep it general so an ai which is unable to get a resource is still able to get the XXX units through promotions. Maybe even declare a war just for the sake of promoting its units. This would require players to find out that XXX is important, that the ai doesn't have a clue about that, and it's better to handle it that way than by saying try to build unit Z which has that special ability, because it will also perform well when used with a mod where unit Z requires a resource that the ai can't find.
You do not need to hard-code things based on a certain set of moddable figures. Things like palace jumping aren't really moddable in civ2 or 3 (unless you prevent them by removing the palace from buildable things), they are part of the rules. Apolyton can adress such points if Firaxis failed somewhere, but this won't be attached to a specific ruleset, just to experience of how the game works. For instance, the real question with palace jumping is: When and where to do it. You may decide of an arbitrary number of cities, but that depends on map size or you may decide of a proportion of wasted resources, which will work as well and be able to adapt to other situations.
My point is a generic ai is not necessary weaker than a hard-wired one, and you don't have to rewrite it every time you tune the game.

Urban Ranger is offline Urban Ranger
Apolyton Duke of Off-Topic

Donate to the Red Cross
The City State of Noosphere, CPA special envoy
May 1999
time: 13:37
  Old Post 12-09-2005 12:19
Edit/Delete Message Reply w/Quote
#37 Report this post to a moderator
Got spare money?

quote:
Originally posted by Locutus
The reason for not using Python more is quite obvious: C++ give much better performance.


Only if you consider algorithms within the same big O measurement. It is often said that a quicksort written in Basic is faster than a bubble sort written in C for lists of arbitrary length.

That's why us CS types study algorithms and generally ignore individual programming languages

Besides, pointers in C (and C++ by extension) are horrible for a compiler to optimize. Fortran and Pascal, for example, are better in this aspect.

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:37
  Old Post 12-09-2005 14:23 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#38 Report this post to a moderator
Support Apolyton or Terrorists Win

quote:
Originally posted by Urban Ranger
It is often said that a quicksort written in Basic is faster than a bubble sort written in C for lists of arbitrary length.


Well, duh. Bubble sort is one of the worst sort algorithms in the world for large, unordered lists. That's apples and oranges (it's not like quicksort is impossible on C).

But obviously the algorithms for calculating city growth or the outcome of a battle aren't going to be horribly different in C than in Python. And using the same algorithm, C typically outperforms Python by a large margin.

quote:
That's why us CS types study algorithms and generally ignore individual programming languages


Uhm, I'm a CS type myself. The choice of language is one of the most important choices for any project, and it's not a trivial one. But in case of games programming, which relies very heavily on performance and in practice often involves low-level platform- or even hardware-specific code (for the purpose of increasing performance), you pretty much can't avoid C for at least major sections of your code.

quote:
Besides, pointers in C (and C++ by extension) are horrible for a compiler to optimize. Fortran and Pascal, for example, are better in this aspect.


Yeah, but we're not comparing C with Delphi or Fortran, we're comparing it with Python, an interpreted language. And although Python is one of the fastest of all major interpreted languages, it overall still performs much worse than C.

Last edited by Locutus on 12-09-2005 at 14:28

sophist is offline sophist
Prince

Nov 2001
time: 23:37
  Old Post 12-09-2005 21:42
Edit/Delete Message Reply w/Quote
#39 Report this post to a moderator
Support Apolyton

quote:
Originally posted by Locutus

But in case of games programming, which relies very heavily on performance and in practice often involves low-level platform- or even hardware-specific code (for the purpose of increasing performance), you pretty much can't avoid C for at least major sections of your code.

Performance is important, but not all parts of the code contribute equally. The 80/20 rule fits pretty well. Write your code in a high-level language for development speed, then profile your bottlenecks and rewrite the heavily-used parts in C. Some things obviously must be in C or assembly from the beginning, either because it will obviously be a performance bottleneck or because the high-level language doesn't support it. Nevertheless, I don't see that a game like Civilization needs the majority of its code (measured in lines, I guess) to be in C, especially since the graphics engine is third party.

Urban Ranger is offline Urban Ranger
Apolyton Duke of Off-Topic

Donate to the Red Cross
The City State of Noosphere, CPA special envoy
May 1999
time: 13:37
  Old Post 13-09-2005 10:01
Edit/Delete Message Reply w/Quote
#40 Report this post to a moderator
Increase the size of your Attachments

quote:
Originally posted by Locutus
But obviously the algorithms for calculating city growth or the outcome of a battle aren't going to be horribly different in C than in Python. And using the same algorithm, C typically outperforms Python by a large margin.


If you use two different languages to code the same algorithm, sure, a compiled language is going to have a speed advantage over an interpreted language. What I was saying was it would be better to spend the time on improving the algorithms themselves first.

quote:
Originally posted by Locutus
Uhm, I'm a CS type myself. The choice of language is one of the most important choices for any project, and it's not a trivial one.


Strange, since an algorithm can be implemented in virtually any programming language. Afterall, they all end up as machine code sooner or later.

quote:
Originally posted by Locutus
But in case of games programming, which relies very heavily on performance and in practice often involves low-level platform- or even hardware-specific code (for the purpose of increasing performance), you pretty much can't avoid C for at least major sections of your code.


Just capsulate the low level parts. C is nice for system programming, being essentially a preprocessor for an assembler I thought most people would have migrated to a nicer language (i.e. one that resembles natural language mre) by now.

quote:
Originally posted by Locutus
Yeah, but we're not comparing C with Delphi or Fortran, we're comparing it with Python, an interpreted language. And although Python is one of the fastest of all major interpreted languages, it overall still performs much worse than C.


Sure. I don't think it makes such a big difference here, though. The computer is waiting for the human player to think most of the time.

It appears multiple threads can be used to take advantage of this.

Darkstar is offline Darkstar
Prince
Huntsville, AL, USA
May 1999
time: 23:37
  Old Post 14-09-2005 01:00
Edit/Delete Message Reply w/Quote
#41 Report this post to a moderator
Browse Apolyton AD-FREE

quote:
Originally posted by Kuciwalker
Also, there are tons of units for which there are specific strategies in C3. It would be even more true with all these promotions. An AI designed around a specific ruleset will always beat an AI designed around a more general ruleset.


Complete BS.

A well designed general AI will be just as good, if not better, then a specifically designed AI for 1 specific ruleset.

The reason why the well designed general AI will be just as good, is that it would understand the strategies just as well as the dedicated 1 set AI. However, as a general AI, it may play better because it may have a larger set of strategies then just a 1 set AI.

Think about it. You are arguing that a Civil War buff who specializes in the Gettysburg battle would be a better strategist then a Sun Tzu. That isn't true. But in code, it would be easier to translate the particulars of that one battle, or indeed, of all the civil war era, then it would be to build a well rounded code version of Sun Tzu.

Now, what that means is that Apolyton will be able to more quickly roll out a good AI for WW2 era scenarios, etc then it will be able to create that master of all things war AI.

Last edited by Darkstar on 14-09-2005 at 01:11

Urban Ranger is offline Urban Ranger
Apolyton Duke of Off-Topic

Donate to the Red Cross
The City State of Noosphere, CPA special envoy
May 1999
time: 13:37
  Old Post 14-09-2005 13:38
Edit/Delete Message Reply w/Quote
#42 Report this post to a moderator
Remove this text

quote:
Originally posted by Darkstar
Think about it. You are arguing that a Civil War buff who specializes in the Gettysburg battle would be a better strategist then a Sun Tzu. That isn't true. But in code, it would be easier to translate the particulars of that one battle, or indeed, of all the civil war era, then it would be to build a well rounded code version of Sun Tzu.


You are right of course, though the Civil War buff isn't really a strategist - he is more of a tactician. Strategy decides which battles to fight. Tactics decides how to fight them.

As it was pointed out, Robert E Lee was a brilliant tactician but a rotten strategist.

 
Pages (2): [ 1   2   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:37.
Apolyton Time is 00:37.
    top of page
Rate This Thread:
Forum Jump:
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0548 seconds (91.62% PHP - 8.38% MySQL) with 30 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net