Jump to content

Delenda Est: An overhaul mod for 0 A.D.


wowgetoffyourcellphone
 Share

Recommended Posts

  • 1 month later...
  • 1 month later...

Hi guys! Need some help here.

I'm playing 0ad on M1 Mac with Delenda Est, and so far I've been enjoying it very much. It's just that whenever I try to play the Nomad mode (by toggling the Nomad option), the game will fail to load. A window will pop up, saying "Error generating random map. Check application log for details," and there'll be a few lines on the interface as below:-

[34.996] error: JavaScript error: maps/random/rmgen-common/player.jsline471
[34.996] error: Script value conversion check failed v.isString() || v.isNumber() || v.isBoolean() (got type undefimed)
[34.996] error: placePlayersNomad@maps/random/rmgen-common/player.js:471:12
[34.996] error: @maps/random/red_sea.js: 353:18
[34.996] error: CMapGeneratorWorker:: Run: Failed to Load RMS 'maps/random/red_sea.js'

I did some trial and error, so I'm pretty sure that this only happens when I toggle the Nomad option.

I tried to uninstall, then reinstall both the game and the mod (I'm a complete noob when it comes to computers), but it didn't work. Then I tried switching to the newly released ARM native test build for M1 Mac, but it didn't work either. I tried Googling for solutions, but there aren't any. Am I the only person having this issue here? Huge thanks to anyone who can help me with this problem =)

Edited by anony5496
  • Like 1
Link to comment
Share on other sites

Here's the section

function placePlayersNomad(playerClass, constraints)
{
	if (!isNomad())
		return undefined;

	g_Map.log("Placing nomad starting units");

	let distance = scaleByMapSize(60, 240);
	let constraint = new StaticConstraint(constraints);

	let numPlayers = getNumPlayers();
	let playerIDs = shuffleArray(sortAllPlayers());
	let playerPosition = [];

	for (let i = 0; i < numPlayers; ++i)
	{
		let objects = getStartingEntities(playerIDs[i]).filter(ents => ents.Template.startsWith("units/")).map(
			ents => new SimpleObject(ents.Template, ents.Count || 1, ents.Count || 1, 1, 3));

		// Add treasure if too few resources for a civic center
		let ccCost = Engine.GetTemplate("structures/" + getCivCode(playerIDs[i]) + "/civil_centre").Cost.Resources;
		for (let resourceType in ccCost)
		{
			let treasureTemplate = g_NomadTreasureTemplates[resourceType];

			let count = Math.max(0, Math.ceil(
				(ccCost[resourceType] - (g_MapSettings.StartingResources || 0)) /
				Engine.GetTemplate(treasureTemplate).Treasure.Resources[resourceType]));

			objects.push(new SimpleObject(treasureTemplate, count, count, 3, 5));
		}

		// Try place these entities at a random location
		let group = new SimpleGroup(objects, true, playerClass);
		let success = false;
		for (let distanceFactor of [1, 1/2, 1/4, 0])
			if (createObjectGroups(group, playerIDs[i], new AndConstraint([constraint, avoidClasses(playerClass, distance * distanceFactor)]), 1, 200, false).length)
			{
				success = true;
				playerPosition[i] = group.centerPosition;
				break;
			}

		if (!success)
			throw new Error("Could not place starting units for player " + playerIDs[i] + "!");
	}

	return [playerIDs, playerPosition];
}

 

Here is the line (471):

			let treasureTemplate = g_NomadTreasureTemplates[resourceType];

 

 

I tried bypassing treasure generation by setting the starting resources to 1000, but then I got an error for line 475:

ERROR: JavaScript error: maps/random/rmgen-common/player.js line 475 Script value conversion check failed: v.isString() || v.isNumber() || v.isBoolean() (got type undefined) placePlayersNomad@maps/random/rmgen-common/player.js:475:12 @maps/random/mainland.js:192:18

ERROR: CMapGeneratorWorker::Run: Failed to load RMS 'maps/random/mainland.js'

 

Line 475:

				Engine.GetTemplate(treasureTemplate).Treasure.Resources[resourceType]));

 

Could the "problem" be that Delenda Est's treasures give more than 1 resource? :) A few months ago @Freagarach made it possible in the core game, so I ran with it. This could be an edge case not tested for? 

Link to comment
Share on other sites

On 28/04/2022 at 8:40 AM, wowgetoffyourcellphone said:

No, only wood and stone.

Well, yes and no. They cost "0" coin and glory (inherited from template_structure), which means

for (let resourceType in ccCost)

will still loop over coin and glory. But

g_NomadTreasureTemplates[resourceType]

then doesn't exist, such that

Engine.GetTemplate(treasureTemplate)

will fail.

You(/We) have some options to fix this:

  • Add coin and glory treasures to g_NomadTreasureTemplates (in maps/random/rmgen-common/player_DE.js).
  • Change the function to either (or both)
    • not account for zero-cost resources.
    • fail/warn when no treasure template exist.
  • Don't have standard cost of "0" for structures (not specified resources are already assumed "0", be aware that this might not be true for every piece of code).

These options can be mixed and matched. :)

  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Freagarach said:
  • Don't have standard cost of "0" for structures (not specified resources are already assumed "0", be aware that this might not be true for every piece of code).

 

Thank you for parsing the issue. This is the solution I went with and it fixed the issue!

 

@anony5496 This will be fixed in the next release.

  • Like 1
Link to comment
Share on other sites

  • 4 months later...
  • 3 weeks later...
  • 6 months later...
  • 1 month later...

Hi all,

Is Delenda Est a multiplayer oriented mod only?

I find the Petra AI on very hard behaving like it is easy or very easy. Not bragging here. The AI does not develop it's structures almost at all - barracks, stables and some houses, minimal army and minimal civilian population only.

In my 1 vs 3 (Very Hard AI) game, they only respond to my attacks in groups of 2-5 infantry ... And I was the first to attack ?!? I like to turtle btw.

In the vanilla game (also 1 vs 3 VH AI) I played just before this one, AI mopped the floor with my behind in the second coordinated attack (zillions of infantry, javelins, cavalry followed up by battering rams, and some more infantry for good measure).

Is Petra AI unable to utilize the altered mechanics of Delenda Est properly? Or is there some special setting/mod I should consider adding on top?

Otherwise, the mod is very intuitive and looks fantastic.

 

Cheers

  • Thanks 1
Link to comment
Share on other sites

Yeah, the AI needs modded as well, but that's beyond my current skillset.

 

I will say the current development version has the AI playing pretty well though, but still not as good as in vanilla.

 

Do you play random maps or skirmish maps in DE? Random maps don't have all of the features.

Edited by wowgetoffyourcellphone
  • Thanks 1
Link to comment
Share on other sites

  • 6 months later...

I tried it yesterday, single player mod, on very easy just to see the mechanics and be able to explore the concept without real challenge.

It is great!   I do like to coin and glory resource, it is nice to have the stall to "extend" the market, nice feature to have the priest worshipping at the statue. Tha additional units and tech are a nice addition, and specally the fact that you can't do them all, there is a choice, and they are not only "good"

  • Like 1
Link to comment
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.

 Share

×
×
  • Create New...