Resources and realms.

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Resources and realms.

Post by Yukiko »

I was looking through the resource and related config files and I couldn't find anyway to restrict a resource to a particular realm. According to the example files in the documentation there is no way to do it. in <resouce type>.cfg you can specify a range of coordinates that a resource can be harvested but there is no way to specify a realm. Atleast, as I said, judging from the example. So is there a way to define resource availability within the various realms?

From the docs:
Global
{
InitialUnits (long number of resource units world has to start)
[LandTile (int landtile ID)]...
[ObjType (int arttile ID)]...
}
Region (string regionname)
{
Range (x-west) (y-north) (x-east) (y-south)
UnitsPerArea (int resource units per tile)
SecondsPerRegrow (int seconds delay between regrows)
Capacity (int unit capacity for this region)
}
[Region...]
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

Re: Resources and realms.

Post by RusseL »

core-changes.txt
Regions:
Added "Realm realmname" property
my ore.cfg

Code: Select all

Region  Large range near Trinsic
{
    UnitsPerArea        20
    Realm               britannia_alt
    SecondsPerRegrow    120
    Capacity            50000
    Range 1014 2514 1529 3047
}
I am not sure if pol099beta from site has this param, but svn revisions anyway
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Re: Resources and realms.

Post by Yukiko »

RusseL wrote:
core-changes.txt
Regions:
Added "Realm realmname" property
my ore.cfg

Code: Select all

Region  Large range near Trinsic
{
    UnitsPerArea        20
    Realm               britannia_alt
    SecondsPerRegrow    120
    Capacity            50000
    Range 1014 2514 1529 3047
}
I am not sure if pol099beta from site has this param, but svn revisions anyway
Quite right Russel. That is in Regions.cfg. It is shown as a property in the sample regions.cfg on the docs section. However, in the resourcetype.cfg sample file there is no realm property shown. There is a range for coordinates but no realm property. I suppose I could add the realm property for a certain resource type, for example sand, limiting it to one realm and test this but I thought I would ask. It's possible that it is added to resource types and someone forgot to update the docs.
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Re: Resources and realms.

Post by Yukiko »

OK. I did a test. I changed my sand.cfg file in \pol\regions by adding a Realm property.

Code: Select all

Region The Whole World
{
    UnitsPerArea        7
    SecondsPerRegrow    3600
    Capacity            200000
    Realm		britannia_alt
    Range               0 0 5119 4095
}

I put my character in the "britannia" realm and proceeded to dig for sand and I was able to harvest sand from the sand tiles in the britannia realm when I should not have if resources supported the realm property. This is a little disappointing but nothing I can't handle in scripts if I want to restrict a resource type to a single realm. Perhaps in a future update this could be added. Mind you I am not complaining. I just needed clarification. I didn't want to assume one thing and then spend hours debugging a script when there wasn't a bug to begin with.
xeon
Forum Regular
Posts: 338
Joined: Fri Oct 31, 2008 3:18 am

Re: Resources and realms.

Post by xeon »

Yuki, you're sure your pg was in a different realm (britannia/britannia_alt)? What return who.realm ?
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Re: Resources and realms.

Post by Yukiko »

I did an .info and it showed britannia.
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

Re: Resources and realms.

Post by RusseL »

Do you use svn builds or beta from website?
I'm pretty sure that realm property works in my pol build
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Re: Resources and realms.

Post by Yukiko »

Russel,
Right now I am testing this on the "Official" release of POL 0.98 but I will test on the latest SVN build and see if it works there. I'm not using the latest SVN Core on my "working" shard because I can't get the UOML client to work properly with the latest POL 0.99 build. I have custom artwork and such that I have to transfer to the High Seas client which works fine with latest SVN Core.
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Re: Resources and realms.

Post by Yukiko »

I tested this with the most recent build of the POL 0.99 development source from the SVN. Adding a "Realm" property to the resource type file did not restrict the particular resource to the realm designated in the value for the property. In other words adding Realm britannia_alt to my sand.cfg file in \pol\regions still allowed my character to mine sand while in the britannia realm.

I thought the resource type config files allowed a developer to restrict the locations where resources can be found. So unless I misunderstood how the resource type config files work, this seems like a bug.
Nando
POL Developer
Posts: 284
Joined: Wed Sep 17, 2008 6:53 pm

Re: Resources and realms.

Post by Nando »

Hi Yukiko, that would be a bug, yes. I checked the code and it seems to do what it promises: the code for resourcetype.cfg creates a region in the same way as regions.cfg. If Realm was not being respected, the other regions would also show this behavior.

Could you try changing the name to some non-existing realm? It must give you an error.
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Re: Resources and realms.

Post by Yukiko »

Russel,
Thanks for confirming my suspicion regarding this being a bug.

Yes, I added the "Realm" property with a non-existent realm and POL errored out with the following error:
Error reading configuration file regions/sand.cfg:
Realm not found
Element: Region The Whole World, found on line 206
Server Shutdown: load_resource_cfg
Execution aborted due to: Configuration file error
For completeness sake here is the relevant part of my sand.cfg file:

Code: Select all

Region The Whole World
{
    UnitsPerArea        50
    SecondsPerRegrow    30
    Capacity            200000
    Realm		Hope
    Range               0 0 5119 4095
}

You are right that POL is reading the Realm property and doing a validity check but it doesn't seem to use that property when determining resource availability. I hope this isn't too difficult to correct. As I said earlier, as long as we know about it it's not that big of an issue for now since this can be handled in scripts until the bug is corrected.
Nando
POL Developer
Posts: 284
Joined: Wed Sep 17, 2008 6:53 pm

Re: Resources and realms.

Post by Nando »

Nando ;)

I have to confess that I've never used the resources.cfg from POL (I guess most scriptbases I've seen have a custom one). The code appears to be taking care of it, so yeah, I guess we can consider that a bug.

If you can write me a small example script where this fails - and the appropriate behavior expected - I could look at it. Should have some free time in the evenings.
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Re: Resources and realms.

Post by Yukiko »

You don't really need an example script. Just edit the sand.cfg file in \pol\regions to include a realm parameter then go to any realm but the one you defined in the sand.cfg file and locate a sand landtile and dig for sand. If you can harvest sand then the Core isn't restricting that resource to the realm specified. Not knowing the internals of POL I could hazard a guess that the bug is in the "resource manager".

Tell me if I am wrong on my understanding of the resource system in POL. Here is how I understand things. You define a resource type in a file with the resource name, ie. sand.cfg. In that file you list the landtiles where the resource can be obtained along with a region name. Under the region name you list various parameters one of which is the range where that resource can be obtained. The thing I noticed is there is no way to restrict a resource to a particular realm. Say for example I wanted a certain mushroom to only be found in britannia_alt for example I can't specify that as a parameter in a resource type cfg file. I don't know if this was ever intended to be a feature. Maybe I'm not seeing a bug but just expecting something to be there that just wasn't conceived. Oddly enough I do know that POL Core parses the realm parameter when reading the "resource type" files because I tested it with a non-existent realm. What appears to have happened is someone just forgot to add a realm check to the resource manager during the upgrade to multiple maps that happened with POL 0.96.

So try modifying the last part of your sand.cfg file to look like the following and put your character in britannia and harvest some sand. You will be able to.

Code: Select all

Region The Whole World
{
    	UnitsPerArea        		100
    	SecondsPerRegrow    	        30
    	Capacity            		200000
        Realm         malas
    	Range               		0 0 5119 4095
}

If this is a bug and you do fix it might I offer a suggestion? For the purposes of the resource manager if the Realm parameter is missing from a "resource type" file have the manager default to making the resource available in all realms. That way we won't have to create 6 different files corresponding to each map for those resources that developers want to be universally available. Or maybe create a wildcard value for Realm such as "All" to specify universally available resource types.

Thanks Nando. I hope I explained things clearly.
Post Reply