Jump to content

Recommended Posts

Just now, LordWahu said:

That happens to be exactly what he needs. More details

and/or the exact code he needs

What i mean is I don't have the details :D And I'm too short in time to look for them :)

Share this post


Link to post
Share on other sites

>> Nescio said,
>> Do you also have a location (e.g. github) where one could easily browse or view individual files of your mod?

The Undying Nephalim said,
> I don't at the moment but I could set one up.

If you created one (and remembered to keep it in sync with your changes) it would mean we could see the current state of code easily. Would also mean that you'd only need to zip-up your code when you wish to make a release. If you're concerned about privacy, or limiting who sees the code between releases, I believe GitLab allows you to create Private repos for free (unlike GitHub where you need a paid subscription).

In addition, both GitHub and GitLab also provide a project wiki that could be useful for documenting certain things, such as faction lists. Or a table which cross-references which resources are gatherable by which faction. These wikis can be locked so they can be read, but not edited, by the public.


As to resources, as mentioned a couple of time already, there are a couple of things we'd need to know that affects the faction-specific resource code:

  • What should happen when faction "A" gives (through tribute) faction "B" a resource that faction "B" cannot ordinarily gather? (Zoras giving the Gorons Coralmold, for instance.)
  • What should happen if faction "C" comes across a treasure that it cannot ordinarily gather? (Stalfos come across a crate of Food, for instance.)
  • What should happen if the units of faction "D", who when killed drop a certain resource, are killed by faction "E" who cannot ordinarily gather that resource?
     

Share this post


Link to post
Share on other sites

From the sound of it it doesn't seem to be an 'actual' replacement of resources. If they never have more than 4 resources, you only need 4. On resource loading, change the icon&tool-tip depending on civ type (I don't know how to do that so... *cough*). I think the json is loaded once so you should just have to set it equal to 'blah'. This would by-pass the market and bartering problem entirely.

Restrictions/additions to gathering a resource could be done through the xml's gather-rates and to resourcesupply(see Note); adding <food.coralmold>#</food.coralmold> and setting food.fish to 0. The treasure statement of s0600204 is a good one. I've never messed around with them. Aren't they of type 'treasure' like food.treasure or something?

 

Note: ResourceSupply can only have one type. They can not be of type food.fish and food.blob... Or some stone/metal/goron related analogy.

It sounds like you're making different resource supply's specifically for certain civs. Map generation/fairness is gonna be a pain to manage if that is the case.

--Add sub-types to the resource's json file of course.

Edited by SirPope
  • Like 1

Share this post


Link to post
Share on other sites
12 hours ago, s0600204 said:

If you're concerned about privacy, or limiting who sees the code between releases, I believe GitLab allows you to create Private repos for free (unlike GitHub where you need a paid subscription).

I'll see if I can get my work up on GitLab

12 hours ago, s0600204 said:

What should happen when faction "A" gives (through tribute) faction "B" a resource that faction "B" cannot ordinarily gather? (Zoras giving the Gorons Coralmold, for instance.)

- I imagine the Zora player would just not be able to give another player that resource unless they also happen to be playing a faction that also uses Coralmold. If their ally is a Goron the option to trade coramold would just not show up at all.

12 hours ago, s0600204 said:

What should happen if faction "C" comes across a treasure that it cannot ordinarily gather? (Stalfos come across a crate of Food, for instance.)

- I suspect treasure might end up only taking the form of Rupees, which is the resource that every faction uses. If there are treasures of other resources that a faction can't use I would imagine they either don't get anything from the treasure or perhaps it's converted to Rupees?

12 hours ago, s0600204 said:

What should happen if the units of faction "D", who when killed drop a certain resource, are killed by faction "E" who cannot ordinarily gather that resource?

- This one probably is a bit more complicated. I can imagine that it would need something that specifies which faction is killing the unit and then give them the appropriate resources, instead of the unit having a fixed set of resources on death. This would be most notable for the undead factions in the game, as kills would always translate to Corpses for them but not other factions.

5 hours ago, SirPope said:

Restrictions/additions to gathering a resource could be done through the xml's gather-rates and to resourcesupply(see Note); adding <food.coralmold>#</food.coralmold> and setting food.fish to 0

There are more then 4 resource in the game, but each faction will only use four at a time. I pretty much just need an on/off switch with resources to show up or hide themselves in the UI depending on what faction you are playing as. They probably just can't be sub-resources because it would probably be immersion-breaking to trade away something like Coralmold and it magically shows up as Wood for another player.
 

5 hours ago, SirPope said:

Map generation/fairness is gonna be a pain to manage if that is the case.

Most of the new resources are harvested from buildings that a player constructs (such as Coralmold), and wont be a factor in map generation.
Coralmold is grown from farms like food, Rock Sirloin is harvested from a building that Gorons build, Corpses are gathered from killing units, Sols are energy created from power generators, and the magic Aura similarly is an auto generated resource.

Edited by The Undying Nephalim

Share this post


Link to post
Share on other sites

Immersion-breaking? What about play-ability? The civ's that depend on wood - depends on the map. If no one on your team can trade that resource... You are SOL.

It's just a 'different type of wood'. It's like having a civ that can only gather pine, trading it for oak. I get the need for immersion. I just think playablity is better and more important.

Also with separate resources, it'd be better for Hyrule to team up with the Gerudo than the Zora's. That break's immersion. You'd basically be crippling yourself to join a team with anyone that doesn't have or can't trade the resources. Besides, when you're playing the game and immersed, you're not trying to figure out what resources your ally has. That is more meta-immersion which I don't think exists. You are immersed in your city, not your allies bank.

Edited by SirPope
  • Like 1

Share this post


Link to post
Share on other sites
5 hours ago, SirPope said:

What about play-ability?

I'll consider turning everything into sub-resources. My only issue is the Aura resource, it's essentially a supernatural magic that can't exactly be translated into food or stone or anything else. It'd be like asking to trade the Force from Star Wars for bundles of wood and stone. :laugh:

EDIT: At the very least would it be easy to make it so that the resource icons change depending on the civ you are playing as? If you are playing as the Hylians it shows the steak icon for food, but when you are the Gorons it shows the Rock Sirloin icon for food, for example. It would also be neat for the Pop Cap icon, it could show little faces for the race you are playing as instead of just a generic icon. 

Edited by The Undying Nephalim
  • Like 3

Share this post


Link to post
Share on other sites

So I've compressed most of my reasources into 4 generic resources, which should make trading between all races work. I combined Wood and Stone into a generic resource, I'll have to think of ways to differentiate harvesting them for races that can use both. I'm also still not sure what to do with the Aura and Sols resources, seeing as their nature basically makes them impossible to trade. It's still a very long way off before I get to factions that use those two resources so I won't worry about them in the meantime.

Spoiler

 

Food (Shows up as Food in coding)
- Farms
- Fruit
- Meat
- Rock Sirloin
- Corpses

Material (Shows up as Wood in coding)
- Lumber
- Stone

Ore (Shows up as Stone in coding)
- Metal
- Coralmold
- Subrosian Ore

Currency (Shows up as Metal in coding)
- Rupees
- Gold
- Force Gems

 


A quick question though, what files determine the sprites that shows up when you select a worker and then hover the cursor over a resource to harvest it?

EDIT: also how do you link animations with harvesting of specific resource subtypes? My workers now just have idle animations when harvesting subtypes that are not from 0AD.

EDITEDIT: And the Ai..... the ai is still trying to harvest subtypes I cant harvest now. The Goron AI is going after berry bushes that it cant harvest and ignoring the Sirloin Mines it built. 

Edited by The Undying Nephalim
  • Like 2

Share this post


Link to post
Share on other sites

For EditEdit - They still have the food.fruit tag in the file (or the parent file).

Spoiler

<?xml version="1.0" encoding="utf-8"?>
<Entity parent="units/briar_customUnits/briar_eco_buildings">
  <Identity>
    <GenericName>Female Citizen</GenericName>
    <Gender>female</Gender>
    <History>Carved from the earth itself.</History>
    <Classes datatype="tokens">FemaleCitizen</Classes>
    <VisibleClasses datatype="tokens">Citizen Worker</VisibleClasses>
    <Formations disable=""/>
  </Identity>
  <ResourceGatherer>
    <MaxDistance>2.0</MaxDistance>
    <BaseSpeed>1.0</BaseSpeed>
    <Rates>
      <food.fruit>0.8</food.fruit>
      <wood.tree>0.7</wood.tree>
      <wood.ruins>5</wood.ruins>
      <stone.ruins>2</stone.ruins>
      <metal.ore>0.35</metal.ore>
    </Rates>
  </ResourceGatherer>
</Entity>

Part of a file I called 'briar_eco_gatherers'. The lack of stone.ore disabled the gathering of stone entirely. The parent here inherits from template_unit_support - no gatherrate tag in its file.

If you don't want to change the parent file, you might be able to 'cancel' the rates tag by <food.fruit />. The 0 gather-rate threw errors for some reason. It might have been that template_unit_support doesn't have a rate or a do not 'divide by zero' insurance. I could of swore that 0 worked though.

A quick check to see if you've set it up right is to start as the goron's select those that can gather and hover over the resource you want it to ignore. If the mouse icon stays an arrow, you've set it to the proper value.

 

Let me know if this works. I'm sure the Engine would throw an error if the AI was to force it to gather something it couldn't.

Share this post


Link to post
Share on other sites
44 minutes ago, SirPope said:

For EditEdit - They still have the food.fruit tag in the file (or the parent file).

It does seem like it's an AI problem. Hovering over bushes, meat, and farms brings up no gathering icon for my Goron workers and it doesn't let me right click to harvest them, so it's all correct. Their template entries are fine and none of their parents have fruit or meat as possibilities:

    <Rates>
      <food.rocksirloin>1</food.rocksirloin>
      <wood.rock>0.7</wood.rock>
      <wood.ruins>5</wood.ruins>
      <stone.ore>0.35</stone.ore>
      <stone.ruins>2</stone.ruins>
      <metal.rupees>0.35</metal.rupees>
    </Rates>
    

  • Like 1

Share this post


Link to post
Share on other sites

SirPope seems to be stuck in a mindset that the engine cannot be changed. That is one of those things where we do have an advantage over other engines.

The requirements listed in response to s600204's questions seem to indicate that there should be different resources, with limitations on bartering and possibly trading. But trying to shove those into the resources currently present in the public mod seems to be more than just wrong.

Yes, having quite a few of resources will require quite a few changes to template files, but since this is the closest thing to a total conversion mod we have that seems ok.
And yes, a few of the requirements/wanted changes might require changes to the AI, the tributing code, the bartering code and the trading code, but in case those changes are only done after figuring out what needs doing those should be stable and not require any future changes.

  • Like 1

Share this post


Link to post
Share on other sites

I know it can be changed and hopefully will be. Hiding of resource and market values would take a bit and is necessary when it come to the other two resources. It is still a problem. As for the next release of this mod, it doesn't need to be done just yet. This will be a workaround for the 'release blocker' that that was.

This AI problem should be able to be solved with an addition to findsupply. Open worker.js (copy the petra folder to hyrule first). The function findsupply is oddly nested inside startGathering; about half way down the page... or just use ctrl+F and type findSupply =

Spoiler

	let findSupply = function(ent, supplies) {
		let ret = false;
		for (let i = 0; i < supplies.length; ++i)
		{
			// exhausted resource, remove it from this list
			if (!supplies[i].ent || !gameState.getEntityById(supplies[i].id))
			{
				supplies.splice(i--, 1);
				continue;
			}
			if (m.IsSupplyFull(gameState, supplies[i].ent))
				continue;

			let type = supplies[i].ent.get("ResourceSupply/Type"); //Might disable/ignore treasure gathering
			let canGather = false;
			for (let r in ent.get("ResourceGatherer/Rates"))
				if (r === type)
					canGather = true;
			if(canGather === false)
				continue;

			let inaccessibleTime = supplies[i].ent.getMetadata(PlayerID, "inaccessibleTime");
			if (inaccessibleTime && gameState.ai.elapsedTime < inaccessibleTime)
				continue;
			// check if available resource is worth one additionnal gatherer (except for farms)
			let nbGatherers = supplies[i].ent.resourceSupplyNumGatherers() + gameState.ai.HQ.GetTCGatherer(supplies[i].id);
			if (supplies[i].ent.resourceSupplyType().specific !== "grain" &&
				nbGatherers > 0 && supplies[i].ent.resourceSupplyAmount()/(1+nbGatherers) < 30)
				continue;
			// not in ennemy territory
			let territoryOwner = gameState.ai.HQ.territoryMap.getOwner(supplies[i].ent.position());
			if (territoryOwner !== 0 && !gameState.isPlayerAlly(territoryOwner))  // player is its own ally
				continue;
			gameState.ai.HQ.AddTCGatherer(supplies[i].id);
			ent.setMetadata(PlayerID, "supply", supplies[i].id);
			ret = supplies[i].ent;
			break;
		}
		return ret;
	};

 

Only a workaround other parts need to be updated and changed. Tested with public and removing food.meat from the female citizens. They stood around cause they seem to just hunt animals in the beginning and the code of 'startHunting' doesn't check if they can even hunt animals. Eventually they will walk off to cut wood or build buildings. The below fixes the 'standing around' problem if you disable 'food.meat'.

Spoiler

m.Worker.prototype.startHunting = function(gameState, position)
{
	// First look for possible treasure if any -!!!- keep this just add the bottom part
	if (!position && this.gatherTreasure(gameState))
		return true;

	let canGather = false;
	for (let r in this.ent.get("ResourceGatherer/Rates"))
		if (r === "food.meat")
			canGather = true;
	if(canGather === false)
		return false;

To ignore meat (from hunt-able supplies).

Untested but should work to enable treasures - replace separated code in find supply:

Spoiler

			let type = supplies[i].ent.get("ResourceSupply/Type");
			let canGather = false;
			if( type.indexOf("treasure.") !== -1 ) //should work
				canGather = true;
			else
			{
				for (let r in ent.get("ResourceGatherer/Rates"))
					if (r === type)
						canGather = true;
			}
			if(canGather === false)
				continue;

 

 

Edited by SirPope
Spelling - added treasure

Share this post


Link to post
Share on other sites
2 hours ago, SirPope said:

Only a workaround other parts need to be updated and changed. Tested with public and removing food.meat from the female citizens. They stood around cause they seem to just hunt animals in the beginning and the code of 'startHunting' doesn't check if they can even hunt animals. Eventually they will walk off to cut wood or build buildings. The below fixes the 'standing around' problem if you disable 'food.meat'.

That does stop the Gorons from clustering around meat sources, but they still seem to be doing it for bushes. Im guessing more script is needed for bushes?

Edited by The Undying Nephalim
  • Like 1

Share this post


Link to post
Share on other sites

No, with the addition the only way for a unit to gather from something, is if it has a gather-rate variable for it. It is never told that there is a 'supply' for it to gather from.

 

If some are not clustering, some must inherit from something different. Check the parent files for those that do cluster and see if that parent can gather. Females and CitizenSoldiers have different gather rates and different files. If they inherit from template_unit_infantry or template_unit_calvary (calvary meat only) they have a gather-rate as well. I forgot about those.

Share this post


Link to post
Share on other sites
12 minutes ago, SirPope said:

No, with the addition the only way for a unit to gather from something, is if it has a gather-rate variable for it. It is never told that there is a 'supply' for it to gather from.

 

If some are not clustering, some must inherit from something different. Check the parent files for those that do cluster and see if that parent can gather. Females and CitizenSoldiers have different gather rates and different files. If they inherit from template_unit_infantry or template_unit_calvary (calvary meat only) they have a gather-rate as well. I forgot about those.

My Goron workers do not have the ability to gather fruit, nor do any of their parent templates. I've gotten rid of gathering from template_unit as well. They are still clustering around fruit bushes and apple trees like they want to gather from them, and they will not gather from the Rock Sirloin mines like they should.

  • Like 1

Share this post


Link to post
Share on other sites

Are the mines named as _field and have the class Field, and the proper resource supply type? They only look for fields to gather from and aren't considered in the supply check. Adding Field to the class list will allow it to be viewed as a gather-point for food. Changing the template name will allow it to build it. The AI is a bit too literal with it's template names and classes. The names need to be exact.

I've tested the adjustment I've made with the public mod; for food.fruit and food.meat removed for 20 minutes now. They don't even go near the resource for me. Which has got me at a loss. Could it be the fruit template? You said it worked for meat. The only suspect I can think of is the fruit template... The supply is never noticed so it can't be marked as gatherable (or a target)  in any capacities. If you are testing this in atlas that might be a problem. atlas... is a bit odd.

Edited by SirPope

Share this post


Link to post
Share on other sites

Hello Undying Nephalim,

Congratulations for your mod. He is very funny fun to play.

I attach to this message a little mod that improve the gui of the game. It is not finish yet. It is composed by 2 parts : one improve the gui size (I increases the size of icons because they are very detailed), the other change the current set of icons and cursors. If you like it, you can take files for the main mod, but beware : the pictures and cursors are created from official Zelda games.

I will publish some ideas to improve the gameplay latter in the week-end if I have the time.

HC XXL.zip

Edited by Aragorn30

Share this post


Link to post
Share on other sites

:unsure: I apologize : I make an error in the first message I wrote "funny" at the place of "fun". I'm not very good in English.  :rolleyes:

Here are some ideas to improve the game :

Gui modification :

1) change the current version of the symbol of gerudo with an other more simple as this one : gerudo_by_kingaelle-d630mwu.png.

 2) Make army building only build from a citizen soldier and economic buildings only by simple citizen (not to improve gameplay but to make the game more clear because there are a lot of buildings).

3) Hide the technology and unit that we can't produce because we are not at the good age or because we have not the technology required. Such as heroes that we have not selected.

Gameplay modification :

 4) I think there are too much worker units that we can produce in the forum. Why not use a part of these units to create soldiers that we can upgrade like in AoE.

Swordsman recruit -> upgrade in the casern in -> Hyrulean knight

Townguard1 -> upgrade  -> Redonecastleguard

 

 5) I found  citizen are too weak.  That could be great to improve their armor and/or their life.

 6) Stone and diamond are collected through the same way : why not change the way to collect diamond ? There are several other ways to collect ressources : kill heroes or units, capture special location of the maps, keep or collect relics ...

 

Some ideas for the future :

 7) Kokiri : make them able to convert animals but not to kill them,

 8) add a lot of "gaia" content : it helps to immerse the player in the universe.

 9) create special contents that can't be created by player.

Example 1 : special buildings hidden on the map that we can't destroy but only capture to produce special units, upgrades or ressources (as diamond)

Example 2 : create units that can join the player when he founds them. These elements make the exploration of the map more interesting.

 

I hope there is not too much mistakes. These are only suggestions and not criticism. The game is already very good.

 

Edited by Aragorn30

Share this post


Link to post
Share on other sites
2 hours ago, Aragorn30 said:

 

Some ideas for the future :

 7) Kokiri : make them able to convert animals but not to kill them,

 

 9) create special contents that can't be created by player.

 

Example 2 : create units that can join the player when he founds them. These elements make the exploration of the map more interesting.

 

I hope there is not too much mistakes. These are only suggestions and not criticism. The game is already very good.

 

There are good but need programming  by Wildfire Games side. 7- is planned. 9- is very open.

Share this post


Link to post
Share on other sites
10 hours ago, SirPope said:

This AI problem should be able to be solved with an addition to findsupply. Open worker.js (copy the petra folder to hyrule first). The function findsupply is oddly nested inside startGathering; about half way down the page... or just use ctrl+F and type findSupply =

yes, good catch. I've added a fix in svn https://trac.wildfiregames.com/changeset/20658

But i encourage you to report such issues either on trac (if you only report it) or phabricator (if you also provide a patch). Forum posts are not always read (at least by me) and it would be a pity to have to rediscover all these issues in the next version a few months from now.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
13 hours ago, SirPope said:

Are the mines named as _field and have the class Field, and the proper resource supply type?

I added Field as a class in, although now the AI places the foundation for the building but never actually completes it, runs out of resources and just sits there hopelessly trying to gather from bushes. Is there a way to force the AI to build a field immediately? 

Share this post


Link to post
Share on other sites

I'd have to look at the templates to fix this bush gathering. It's probably something small.

Force them to build a field at the start? I believe they wait a certain amount of time to build fields. Changing that would force everyone else to build them which has got me to be a bit reluctant.

But:

Spoiler

checkResourceLevels in basemanagers.js. There is an if(count < 600), commenting out will make them build it at the start (they might stand around for a few seconds). There is another '|| count < 300' in the else statement below that (you can remove that). Note: it will affect everyone.

A23 I think has the ability to load json files in the AI. This could allow for a 'civ' specific strategy to be made.

 

Return worker.js to the petra default and paste the attached file into the petra folder (leave the name the same). It has some of mimo's code in it.

Tested by removing everything but <metal.ore> in the template_unit_support_female_citizen.xml. Removing everything but food.grain and the above changes to the count < statements does allow them to build farms near the beginning. It takes a while to get to it though. The build assignment is done in a separate check.

worker_Hyrule.js

Edited by SirPope

Share this post


Link to post
Share on other sites
3 hours ago, SirPope said:

checkResourceLevels in basemanagers.js. There is an if(count < 600), commenting out will make them build it at the start (they might stand around for a few seconds). There is another '|| count < 300' in the else statement below that (you can remove that). Note: it will affect everyone.

This doesn't seem to be changing anything. The AI still just puts down the foundation for the field but still sends no workers to actually finish building it despite the fact that it does run off to finish other buildings. Removing the Field classlabel from the field causes them to build it asap as they should, but they don't harvest anything from it.

 

Edited by The Undying Nephalim

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...