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 > Miscellaneous > Archive > CtP2-Creation/AI/Mods/Scenarios-Archive > Question
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!

bottom of page
  
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
Oerdin is offline Oerdin
King
of Internet Music.
Sep 2001
time: 21:21
  Old Post 22-07-2002 10:07
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
Question Support Apolyton buy from Amazon

Have you folks seen in Civ3 how a unit's sighting radius increases when the unit stands on top of hills or mountains? I think this is a very interesting feature and I'm wondering if it could be added to CTP2. Has anyone else tried this before?

HuangShang is offline HuangShang
King
USA, SoCal, L.A.
Jul 2002
time: 21:21
  Old Post 22-07-2002 21:11
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations: Deluxe Edition

Inoticed the fact you can see far...

only play it a couple times... hated it

child of Thor is offline child of Thor
Emperor
UK
Jan 2002
time: 05:21
  Old Post 22-07-2002 22:09
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Avatar Enlargement: We've got the solution

If balanced nicely,say just a one or two extra squares viewing distance, then it would be a good feature to have. Hmmmm, a z dimension in CTP2 terrain? I've no idea, but could be easy to do i guess. Just as units get a bonus defence when on mountains i suppose you could just add a bonus to units view range in the same way?

J Bytheway is offline J Bytheway
Emperor
England
Jul 2001
time: 05:21
  Old Post 23-07-2002 03:16 Visit J Bytheway's homepage!
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Support Apolyton buy from Amazon

I can't see any way to do that short of adding an additional unit to the square with the longer sight range, which obviously runs into trouble when the square has 12 units in...

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:21
  Old Post 23-07-2002 17:17 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Put an end to popups!

Well, it's easy to do but a lot of work. In the same fashion that the units in the 7 Samurai scenario get increasing hitpoints, etc, you can increase vision as well. It requires however that you have multiple versions of every unit: one with vision range 1, one with vision range 2, etc. Your Units.txt file (and other related files) would get 2-3 times bigger than it already it (and it's a lot of type/copy-paste work)...

Maquiladora is offline Maquiladora
Emperor

Jun 2001
time: 05:21
  Old Post 23-07-2002 17:52 Visit Maquiladora's homepage!
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

So it could be done. Would it slow the game down to a crawl with all that extra weight in the Units.txt files etc?

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:21
  Old Post 23-07-2002 18:12 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

I don't think so, not significantly anyway. But then again, noone ever tried tripling the total number of units in the game (and don't forget that in some mods we already almost doubled the number of units compared to the original game)

J Bytheway is offline J Bytheway
Emperor
England
Jul 2001
time: 05:21
  Old Post 24-07-2002 04:55 Visit J Bytheway's homepage!
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Support Apolyton, buy Civilization 2

What would slow the game down (if anything) would be the constant SLIC execution whenever a unit moved. I doubt my P200 could plough through the AI turns very quickly. Perhaps give the AI the long-sight versions everywhere to speed things up.

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:21
  Old Post 24-07-2002 05:19 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Support Apolyton buy from Amazon

You'd be surprised. The Alexander scenario has dozens of UnitMove events, doesn't hurt all that much (yes, it's very slow on a P200 but experience shows that that's mostly because of the huge map and loads of cities & units).

Pedrunn is offline Pedrunn
King
of Natal, Brazil
Jul 2001
time: 02:21
  Old Post 24-07-2002 08:09
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Increase the size of your Attachments

I think you guy are going the harder way.
The easiest thing to do is to create a invisible improvement under the unit. if unit has vision range 1 it creates a vision 2 imp, if hs vision 2 creates a imp with 3. When the unit move out the tile the imp is destroyed.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:21
Post  Old Post 24-07-2002 16:38 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Full PM-box? Change here!

quote:
Originally posted by Pedrunn
I think you guy are going the harder way.
The easiest thing to do is to create a invisible improvement under the unit. if unit has vision range 1 it creates a vision 2 imp, if hs vision 2 creates a imp with 3. When the unit move out the tile the imp is destroyed.


Actual this is the harder way, first you have to create the tile improvement, but then it isn't finished so you need a second event to finish it, until tehn the unit left the mountain. Then you can only build a tile improvement on land with an owner so you would have to give the land to the civ to which the units belongs. So it would only effective to use the test tile improvement of GoodMod for it. You couldn't pillage without huge problems the tile improvement afterwards. And if you pillage the location you will remove all the tile improvements at that place. So I would say it is possible to do it this way but the price is too high.

-Martin

ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:21
  Old Post 24-07-2002 21:23
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Get a bigger avatar today!

quote:
Originally posted by Martin Gühmann


Actual this is the harder way, first you have to create the tile improvement, but then it isn't finished so you need a second event to finish it, until tehn the unit left the mountain. Then you can only build a tile improvement on land with an owner so you would have to give the land to the civ to which the units belongs. So it would only effective to use the test tile improvement of GoodMod for it. You couldn't pillage without huge problems the tile improvement afterwards. And if you pillage the location you will remove all the tile improvements at that place. So I would say it is possible to do it this way but the price is too high.

-Martin


Couldn't you just reach into the structure of each unit to the visionrage through a .slc? it seems that all you would need to do (And I haven't fully undertaken learning all the .slc variables) is write a .slc that says in essence:

While terrain = mountain or hills (In another .slc project I was reading about the land was being checked to see who was the owner in order to influence the movement rate, so it seems this could be done),

UNIT_[TYPE or whatever the varible should be].visionrage = UNIT_TYPE.visionrange + 1

Last edited by ahenobarb on 24-07-2002 at 21:37

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:21
Post  Old Post 24-07-2002 22:48 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#13 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations: Deluxe Edition

quote:
Originally posted by ahenobarb
Couldn't you just reach into the structure of each unit to the visionrage through a .slc? it seems that all you would need to do (And I haven't fully undertaken learning all the .slc variables) is write a .slc that says in essence:

While terrain = mountain or hills (In another .slc project I was reading about the land was being checked to see who was the owner in order to influence the movement rate, so it seems this could be done),

UNIT_[TYPE or whatever the varible should be].visionrage = UNIT_TYPE.visionrange + 1


The problem here is there is no slic function that allows us to increase the vision range of an unit. I can damage it and I can add/remove move points, unfortunatly nothing more.

-Martin

ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:21
  Old Post 24-07-2002 23:05
Edit/Delete Message Reply w/Quote
#14 Report this post to a moderator
Support Apolyton buy from Amazon

quote:
Originally posted by Martin Gühmann


The problem here is there is no slic function that allows us to increase the vision range of an unit. I can damage it and I can add/remove move points, unfortunatly nothing more.

-Martin


You guys are the experts in this, but in looking at the units.txt file, all the units are set up as C structures. As you know any C structure element can be access by referencing the structure name adding the structure member operator (i.e. '.' ) and the name of the structure element you want to access (in this case, for example "UNIT_ARCHER.visionrange" Visionrange is one of the elments in a unit structure listed in units.txt). Once you have refenced the specific element you want, you should be able to change it.

What I don't know is whether you can do this with .slc
I'm not certain if .slc only let's you use the variables that are named in the modification section of the CTP2 portion of this site. Or, if once you know a structure name, you can access that structure just like a C strucutre through the .slc file.

Since I haven't learned enough about .slc to try to write some code yet (I'm still in the middle of my first real game), I'm passing it along in case one of the experts wants to try their hand at it.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:21
Post  Old Post 25-07-2002 02:50 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#15 Report this post to a moderator
Put an end to popups!

quote:
Originally posted by ahenobarb
You guys are the experts in this, but in looking at the units.txt file, all the units are set up as C structures. As you know any C structure element can be access by referencing the structure name adding the structure member operator (i.e. '.' ) and the name of the structure element you want to access (in this case, for example "UNIT_ARCHER.visionrange" Visionrange is one of the elments in a unit structure listed in units.txt). Once you have refenced the specific element you want, you should be able to change it.

What I don't know is whether you can do this with .slc I'm not certain if .slc only let's you use the variables that are named in the modification section of the CTP2 portion of this site. Or, if once you know a structure name, you can access that structure just like a C strucutre through the .slc file.


Would it is such easy then you have to answer me this question: Why we need such a function to add additional movement points:

AddMovement

Another question would be what do you exactly change if you use the dot operator, do you change just the vision range of one particular unit or would it rather change the vision range of all the units of the same type. Of course I didn't tryed it, so at least I will try it afterwards I finished my GOTM, finished GoodMod1 v.1.0 and started with GoodMod2, there such a thing would be very helpfull if it work.

-Martin

Peter Triggs is offline Peter Triggs
Prince
Gone Fishin, Canada
Jan 2000
time: 05:21
  Old Post 25-07-2002 04:14
Edit/Delete Message Reply w/Quote
#16 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

Here's the problem:

quote:

SLIC provides direct read-only access to much of the data contained in the game databases.


Also, although it's written that you can access many fields from the databases (using dot notation) this only seems to work for the UnitDB. Every time I've tried a different one (even using the examples that were given in the documentation), I get a syntax error. So it looks to me that this was something that was intended to be included but didn't get finished. It's a pity, being able to access the fields in strategies.txt and diplomacy.txt would be very useful.

ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:21
  Old Post 25-07-2002 18:05
Edit/Delete Message Reply w/Quote
#17 Report this post to a moderator
Inflate your Upload Space

quote:
Originally posted by Peter Triggs
Here's the problem:



Also, although it's written that you can access many fields from the databases (using dot notation) this only seems to work for the UnitDB. Every time I've tried a different one (even using the examples that were given in the documentation), I get a syntax error. So it looks to me that this was something that was intended to be included but didn't get finished. It's a pity, being able to access the fields in strategies.txt and diplomacy.txt would be very useful.


I read through the SLIC documentation yesterday and saw that same passage. However, in the 10 minutes I had free last night, I tried my hand at it. I expected that I would get an error, but it should point me to the proper solution.

However, that one part I thought wasn't in error apparantly was. The error message said: "No TERRAIN_HILL in the TerrainDB" "No TERRAIN_MOUNTAIN in the TerrainDB" (I had referenced both with TerrainDB(TERRAIN_XXXX))

I haven't had anytime to look at it again, but that struck me as odd. Unless the Terrain.txt is not considered the TerrainDB, I don't know what is wrong.

Any ideas?

HuangShang is offline HuangShang
King
USA, SoCal, L.A.
Jul 2002
time: 21:21
  Old Post 25-07-2002 21:18
Edit/Delete Message Reply w/Quote
#18 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

God... i never remember what this thread is for in the morning

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:21
  Old Post 26-07-2002 02:30 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#19 Report this post to a moderator
Enter the AD-FREE zone

That's odd, ahenobarb, I did the same thing just now and got a syntax error, just like Peter. Are you sure you didn't make any typos or anything silly like that? If not, could you post your code, so others can see they can reproduce and explain it?

Aside from that, it's good to know we have an experienced programmer looking into SLIC again. We desperately need people like you

ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:21
  Old Post 26-07-2002 07:07
Edit/Delete Message Reply w/Quote
#20 Report this post to a moderator
Avatar Enlargement: We've got the solution

quote:
Originally posted by Locutus
That's odd, ahenobarb, I did the same thing just now and got a syntax error, just like Peter. Are you sure you didn't make any typos or anything silly like that? If not, could you post your code, so others can see they can reproduce and explain it?

Aside from that, it's good to know we have an experienced programmer looking into SLIC again. We desperately need people like you


It was a case-sensitivity issue. i was rushing out the door and didn't get time to fool around to check it.

Anyway, here's the SLIC I did for this:

HandleEvent(MoveUnits) 'IncreaseVision' post {
unit_t tmpUnit;

While(tmpUnit.location == 8 ||
tmpUnit.location == 9 ||
tmpUnit.location == 18 ||
tmpUnit.location == 19 ||
tmpUnit.location == 20 ||
tmpUnit.location == 21 )
{
tmpUnit.visionrange = tmpUnit.visionrange + 1;
}
}
}


However, when I load it up, CTP2 tells me "Visionrange is not a member of tmpUnit".

So from this I believe I have learned the only parts of the unit array that can be used are:

unit.owner - the unit's owner
unit.location - the unit's location
unit.type - the unit's database index
unit.hp - the unit's remaining hit points
unit.valid - true if the unit still exists, false otherwise
unit.name - the unit's name, only useful in string replacements

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:21
Post  Old Post 26-07-2002 21:24 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#21 Report this post to a moderator
Support Apolyton or Terrorists Win

quote:
Originally posted by ahenobarb
It was a case-sensitivity issue. i was rushing out the door and didn't get time to fool around to check it.

Anyway, here's the SLIC I did for this:

HandleEvent(MoveUnits) 'IncreaseVision' post {
unit_t tmpUnit;

While(tmpUnit.location == 8 ||
tmpUnit.location == 9 ||
tmpUnit.location == 18 ||
tmpUnit.location == 19 ||
tmpUnit.location == 20 ||
tmpUnit.location == 21 )
{
tmpUnit.visionrange = tmpUnit.visionrange + 1;
}
}
}


However, when I load it up, CTP2 tells me "Visionrange is not a member of tmpUnit".



Some notes about the code, the MoveUnits event has two location variables and an army variable in its context. You can take access with army[0] on the army variable. (See the slic documentation which variables are in the context) If you now want to take access on the units of the army you have to use the GetUnitByIndex function within a for loop. It is also possible to get the army size, the best thing here is to consult the various slic files and the slic documentation for examples. So your temporary unit variable actual contains nothing.

Another problem I see in your code is the while loop: As your handler is a post handler the code will be executed after the move event was done. The event is called everytime a unit moves from one tile to its adjacent tile. Once the army is on the hill for instance the condition in the while loop is true and the while loop will be executed until the army leaves the hill. But the next MoveUnits event want be called until the your code was be executed. So once the condition in the while loop is true it will be always true. And the loop turned in an endless loop.

quote:
Originally posted by ahenobarb
So from this I believe I have learned the only parts of the unit array that can be used are:

unit.owner - the unit's owner
unit.location - the unit's location
unit.type - the unit's database index
unit.hp - the unit's remaining hit points
unit.valid - true if the unit still exists, false otherwise
unit.name - the unit's name, only useful in string replacements


These ones does work with the unit array, for the other ones you have to use the unitrecord array. See the Great Library for some example code about this although I think the GL is not the best place to find examples.

Even if it takes some time to learn slic, don't give up keep on trying.

-Martin

ahenobarb is offline ahenobarb
Prince

Nov 2001
time: 05:21
  Old Post 26-07-2002 21:45
Edit/Delete Message Reply w/Quote
#22 Report this post to a moderator
Support Apolyton, buy Call to Power 2

quote:
Originally posted by Martin Gühmann



If you now want to take access on the units of the army you have to use the GetUnitByIndex function within a for loop. It is also possible to get the army size, the best thing here is to consult the various slic files and the slic documentation for examples. So your temporary unit variable actual contains nothing.

Another problem I see in your code is the while loop: .... the loop turned in an endless loop.



These ones does work with the unit array, for the other ones you have to use the unitrecord array. See the Great Library for some example code about this although I think the GL is not the best place to find examples.

Even if it takes some time to learn slic, don't give up keep on trying.

-Martin


Thanks, Martin. I dumped the GetUnitsByIndex even though I saw an example using that. I figured, if I really needed it, CTP2 would say something when I started the game and it spat out its error messages. It didn't say anything when I dropped it, so I figured I didn't need it. Guess I was wrong.

While loop: I thought that might be the case, but figured I'd cross that bridge when/if I ever saw the visionrange actually increase.

I'll check the GL. Thanks again.

J Bytheway is offline J Bytheway
Emperor
England
Jul 2001
time: 05:21
  Old Post 27-07-2002 03:49 Visit J Bytheway's homepage!
Edit/Delete Message Reply w/Quote
#23 Report this post to a moderator
Suffering from ads?

quote:
Originally posted by Martin Gühmann
Would it is such easy then you have to answer me this question: Why we need such a function to add additional movement points:

AddMovement


Even if such modification did work (which it apparently doesn't) you would still need the AddMovement function since this affects the units current available movement, not the MaxMovePoints. Similarly for the hp.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:21
Post  Old Post 27-07-2002 20:42 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#24 Report this post to a moderator
Support Apolyton buy from Amazon

quote:
Originally posted by ahenobarb
Thanks, Martin. I dumped the GetUnitsByIndex even though I saw an example using that. I figured, if I really needed it, CTP2 would say something when I started the game and it spat out its error messages. It didn't say anything when I dropped it, so I figured I didn't need it. Guess I was wrong.

While loop: I thought that might be the case, but figured I'd cross that bridge when/if I ever saw the visionrange actually increase.

I'll check the GL. Thanks again.


There are two kinds of errors that can you code contain. On the one hand syntax errors on the other hand semantic errors. The syntax errors are the easier ones, because you will get an error message, even if slic error messages could give you more pieces of information. But the semantic errors are the ones that are much harder to detect, because the syntax is ok but the content is the problem. The only symptom that you notice is that your code doesn't do the stuff that it is supposed to do, and now you have to search why.

Here is an example in English:

code:
The only symptom code is that doesn't do the stuff that it is supposed and now have why.


You see I just deleted some words of my last sentece and you don't get the content, but nevertheless all the words I used are valid English words and also the form should be correct, capital letter on the beginning a dot at the end, and the grammer is ok more or (rather) less correct.

-Martin

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:21.
Apolyton Time is 00:21.
    top of page
Rate This Thread:
archivepost
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.0613 seconds (88.99% PHP - 11.01% MySQL) with 31 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