Jump to content

Wall build tool for RMGs


FeXoR
 Share

Recommended Posts

Hiho, I found there had to be a better possibility to place walls, so I wrote a rmgen script to make it easy... and it is!

With it a demo RMG to see how it works.

Until now only wall design type 'palisades' available... it's a bit of work but other types are easier and will be added soon.

To make a custom wall, just do something like:

var myWall = new wallTool('palisades');
myWall.wall = ['wall', 'tower', 'wall', 'cornerIn', 'gate', 'outpost', 'endRight'];
var startWallX = 100;
var startWallY = 75;
var startWallFaceAngle = 3*PI/4;
var playerId = 1;
myWall.place(startWallX, startWallY, playerId, startWallFaceAngle);

You can also choose from prebuild fortresses (like it's done in the demo map) by:

var myWall = new wallTool('palisades'); 
myWall.setFortress("very large"); // Sizes named like map sizes, 'giant' is missing, yet...
myWall.place(mapCenterX, mapCenterZ, 1, 5*PI/8);

EDIT Start: New versions in later posts!

Last version for Alpha 8 can be found here.

Later versions are for the svn repo and will be added in new posts.

EDIT End.

Well, to fully get it I think better read the comments in the file.

wall_demo.zip

And a screenshot of a small map with 8 players.

post-14196-0-15460200-1330983626_thumb.j

Edited by FeXoR
Link to comment
Share on other sites

It would be nice if anyone interested could go through the code and tell me what to do better.

Most parts of the code are setting up the length, placement angle and indentation of the wall elements appropriate to the template and the predefined fortress types, so this can be skipped and it's not much left to read.

The main part I'm interested in is what types of variables should be what type of object (list/dictionary/object).

For example the fortress class is not really needed for now but could proof useful for custom fortresses later.

Until now a dictionary would do.

I don't know how to define an object inside an object because 'this' always points to the 'most top' object.

But this would be better IMO since the 'wallElement' and 'fortress' objects are not very useful without the wallTool and only take namespace.

Some variables are not that well names like 'centerX' and 'centerZ' because it's only X/Z directed if the angle of placement is 0.

And it's more an offset then a center coordinate, since it's the X/Z distance between the (unindented) position of the first wall element to the center.

Perhaps I should do it exactly the other way around (vector from point of placement to the first wall element) and call it offsetX/offsetZ...

Sounds good at the moment.

And should I define the 'wallStyles' and 'fortressTypes', which take a lot of space, somewhere else?

I find it makes the main 'wallTool' code harder to read because it splits the code for functionality.

Don't exactly know where to put it...

Also the getCenter function is really useful but I don't know when to use it exactly by default. (Returns the 'Center of mass' of the fortress)

I do it when setting the wall to a preset fortress, though, if custom fortresses have been added to the 'fortressTypes' and have a 'center' defined manually, it will be overridden until you turn the 'recalculateFortressCenter' property to 'false'.

That might not be very handy (though I doubt many would search for the center by hand ^^. And you still can simply use the 'wall' property and set the center vars manually).

The existing 'wallTypes' are not very well documented yet.

But I think they are chosen wisely. Wait to see the other fortress styles...

A circular wall tool was requested and I will add it soon.

It will have the functionality for generic bending of walls. Edit: Not to the ground but to one and another wall element so a point is enclosed.

I guess tomorrow I will finalize the other wall styles and there will be some more screenies.

Edited by FeXoR
Link to comment
Share on other sites

Here's the wall demo with all civs included.

The argument given to the 'wallTool' (or it's 'setStyle' function) takes the same civ strings as given by 'g_MapSettings.PlayerData[playerID].Civ' with 'playerId' set appropriate to player.

For the wall demo map:

Take a giant one, otherwise you will just see a mess of walls with many players.

Each player gets a fortress of the style of his civ.

When the civ is 'rome' (map editor only) the style will be set to 'palisades'.

Fortress size depends on player number:

- 1: 'demo' fortress (All wall element types included)

- 2: 'small'

- 3: 'very large'

- 4: 'normal'

- 5: 'large'

- 6: 'medium'

- 7: 'giant'

- 8: 'tiny'

In addition in the map center a 'palisades' style 'demo' type fortress is placed, just to see the size compared to existing civ's fortresses.

wall_demo2.zip

post-14196-0-44740800-1331095501_thumb.j post-14196-0-28588800-1331095562_thumb.j post-14196-0-87727700-1331095580_thumb.j

post-14196-0-56984400-1331095612_thumb.j post-14196-0-69600000-1331095629_thumb.j post-14196-0-55584800-1331095650_thumb.j

Edited by FeXoR
Link to comment
Share on other sites

I feel the fortresses are to powerful in the meaning of firepower and upkeep gain.

So a to-do list:

- DONE: Rotate wall towers so 'garrison out direction' shows to the 'inside' of the wall.

- IT'S OK: Think of something to avoid walls from decaying because not in area with civil center.

- DONE: Priority: Nice look, balancing or reasonable damage potential? I decided a mix is best (See following topics)

- DONE: Celt: Change 'cornerIn' template from fortress to normal wall. EDIT: Done. Doesn't fit well without towers though.

- DONE; Celt: Perhaps change 'cornerOut' from outpost to wall. Fit's better but produces a graphic glitch so added it as non-default only.

- DONE: Comment to celt walls: The ramp seams not to be walkable. Units just walk 'through' it.

- DONE: Hele: Change 'cornerOut' template from fortress to wall tower. EDIT: Done. Changed fortress to non-default.

- UNNEEDED: Comment to hele walls: There's a graphic glitch on the top of the wall if two walls are put together.

- UNNEEDED: Comment to hele gates: In opposite to other civs they have towers but no attack or garrison space. If indented as walls they are a little off to 'outside'.

- DONE: Iber: Perhaps change 'cornerOut' template from outpost (that grants upkeep) to a diagonal wall tower (they are not symmetric).

- IT'S OK: Iber: Perhaps change 'cornerIn' template from outpost (that grants upkeep) to wall tower EDIT: Wall extends into tower, added as non-default.

- NO: Pers: Perhaps change 'entry' template from outpost to obelisk tough pers are equally powered or even underpowered.

- DONE: Palisades: Perhaps change 'entry' template from outpost to a flag as alternative..

- Add 'cornerInHalf' and 'cornerOutHalf' wall element types with bending of PI/4 (45°). Especially for celt gates to look better.

- Add 'autoplaceWallTo' capability.

- Add circular wall capability.

- Add 'romanSiege' style.

- Add 'fence' style.

Edited by FeXoR
Link to comment
Share on other sites

Well, I will add default fortresses for each civ fitting into civil centers territory range.

They will grand 20 upkeep each (0 for palisades) and will never have a production building included.

This will enable good looking civ specific default fortresses that don't decay.

I'll name them 'cartDefault', 'celtDefault', 'heleDefault', ...

...so they can be placed by something like:

var playerID = 1; // 2, 3, 4, 5, 6, 7, 8
var civ = g_MapSettings.PlayerData[i].Civ;
var myFortress = new WallTool(civ);
var myFotressType = civ + 'Default';
myFortress.setFortress(myFortressType);
var myX = 100;
var myZ = 100;
var myAngle = 3*PI/4;
myFortress.place(myX, myZ, playerId, myAngle);

Edited by FeXoR
Link to comment
Share on other sites

Oh, I noticed that 'setFortress' should actually be named 'setFortressType'. The above code example is correct until now though. 

EDIT: No, I will not change it because if you place a 'wall' it acts differently than placing a 'fortress' so you somehow set the hole behavior to 'fortress'.

Edited by FeXoR
Link to comment
Share on other sites

What do you mean by upkeep?

Sorry, it's called population bonus in 0ad ^^.

If your referring to the 20 population bonusfor default fortresses it's because iberians have no templates well placeable as an corner bending in other then their outpost... and they give 5 population bonus.

To 'close' a fortress with PI/2 (90°) corners you need at least 4 corners.

4*5 makes 20.

Edited by FeXoR
Link to comment
Share on other sites

Hmm, the Iberians do have a wall tower like all the other civilizations. So I'm not sure what you mean by that :unsure: (Also, if you're using SVN there are Roman walls and wall towers as well =) But that's up to you, it is definitely recommended to use the SVN version for any kind of development though ;) )

  • Like 1
Link to comment
Share on other sites

Hmm, the Iberians do have a wall tower like all the other civilizations. So I'm not sure what you mean by that :unsure: (Also, if you're using SVN there are Roman walls and wall towers as well =) But that's up to you, it is definitely recommended to use the SVN version for any kind of development though ;) )

Your for sure right, I'll look into it.

What I mean is that the iberian wall towers don't cover 2 walls placed in a right angle (90° or PI/2) but the walls cover the inside of the tower.

That looks ugly and fractional.

Link to comment
Share on other sites

Here we go!

New civs may not work but in principle it's how I think it can be done.

There is no default fortress of type 'palisades' yet. Otherwise I'd added this for civs other then cart, celt, hele, iber and pers.

In the simple but playable fortresses RMS can be seen how simple it is to place them for each player.

All fortresses grand 20 upkeep and have about the same size and firepower.

The new version of the wall_builder rmgen script includes them and the wall_demo RMS should cause no conflicts any more.

EDIT: Don't dl this, take: v0.2

fortresses_v0.1_and_wall_demo.zip

post-14196-0-62451800-1331254051_thumb.j

Edited by FeXoR
Link to comment
Share on other sites

Your for sure right, I'll look into it.

What I mean is that the iberian wall towers don't cover 2 walls placed in a right angle (90° or PI/2) but the walls cover the inside of the tower.

That looks ugly and fractional.

Well, then that's an issue with the models. I wouldn't say it's a good idea to work around issues with the models by changing the code, better to do it right in code the first time and fix the models :) (They might need tweaks anyway once the player wall building system is implemented.)

That said I don't see the issue when manually placing walls and wall towers:

post-2319-0-36569500-1331254060_thumb.jp

Perhaps it's harder to do in code though :unsure: There are issues in other angles than 90° though, so perhaps that's what you meant?

Link to comment
Share on other sites

Well, then that's an issue with the models. I wouldn't say it's a good idea to work around issues with the models by changing the code, better to do it right in code the first time and fix the models :) (They might need tweaks anyway once the player wall building system is implemented.)

That said I don't see the issue when manually placing walls and wall towers:

post-2319-0-36569500-1331254060_thumb.jp

Perhaps it's harder to do in code though :unsure: There are issues in other angles than 90° though, so perhaps that's what you meant?

Oh, forgot the main thing: all garrisonable buildings have a 'drop-point' where units ungarrisoned will be placed.

This should for sure be 'inside' the fortress!

So they have to be placed in a 45° angle (Half the angle the corner bends the wall).

That's the main thing.

But there's another:

Iberian wall towers are not symmetrical (Not the same length then width). So to make it look nice and symmetrical, the have to be placed like I mentioned above.

And then the walls coming from both sides will be seen inside the tower.

By the way, I didn't check all wall towers for the 'drop-point'.

Edited by FeXoR
Link to comment
Share on other sites

I wouldn't say it's a good idea to work around issues with the models by changing the code, better to do it right in code the first time and fix the models.

I agree perfectly, that's where the default fortresses of the different sizes come in. That should be default later.

I only added civ specific default fortresses differing from one another to get about the same size, same firepower and same upkeep for all civs (well, not romans ^^)

If you only have walls and towers it's boring. Test the wall_demo map to see what is possible and allrdy working!

Edited by FeXoR
Link to comment
Share on other sites

Nice work Fexor, that is great. Neat shapes :) How do the scripts do if you ran it on a map that wasn't flat?

Works fine for descent hills. Some things look strange though (celtic wall towers for example):

post-14196-0-33217500-1331256229_thumb.j

Oh, and celtic walls can fly! :lol:

post-14196-0-24161000-1331256521_thumb.j

Edited by FeXoR
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...