Light Style© by Fisana

Jump to content


Photo

Wall build tool for RMGs


  • Please log in to reply
53 replies to this topic

#1 FeXoR

FeXoR

    Centurio

  • Community Members
  • PipPipPipPipPip
  • 901 posts

Posted 05 March 2012 - 09:41 PM

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.

Attached File  wall_demo.zip   5.08KB   75 downloads

And a screenshot of a small map with 8 players.

wall_demo_full.jpg

Edited by FeXoR, 13 March 2012 - 11:32 AM.

  • 0

#2 Pureon

Pureon

    Primus Pilus

  • 0 A.D. Art Team
  • 3,537 posts

Posted 05 March 2012 - 11:01 PM

Excellent work (y)

The larger wall could work very well around starting bases, while the smaller ones could surround pre-built fortresses or towers.
  • 1

Pureon
0 A.D. Part time Designer / Texturer / 3D Artist
Contact email:
pureon{@}wildfiregames.com


#3 Mythos_Ruler

Mythos_Ruler

    Senator

  • WFG Retired
  • 14,961 posts

Posted 06 March 2012 - 10:07 AM

This would be useful to create "Fortress" variations of random maps.
  • 1

#4 FeXoR

FeXoR

    Centurio

  • Community Members
  • PipPipPipPipPip
  • 901 posts

Posted 06 March 2012 - 11:42 AM

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, 15 March 2012 - 08:44 AM.

  • 0

#5 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,615 posts

Posted 06 March 2012 - 12:42 PM

Very interesting tool, I'll playtest this a bit when I get time.
  • 0
Lancelot de Ferrière le Vayer [ aka Wraitii ]
Wildfire Games Programmer, AI developer, auxiliary map designer, dealing with anything water.
Contact me: wraitii@wildfiregames.com

Also the world's only three-dimensional poodle.

#6 Spahbod

Spahbod

    Triplicarius

  • WFG Programming Team
  • 585 posts

Posted 06 March 2012 - 01:03 PM

This reminds me that we really need to redesign GUI for more rms options.
  • 1
Omid Davoodi [ aka Spahbod ]

Wildfire Games Random Map Designer, Low-level Programmer
Contact me: myops37@yahoo.com


Support Wildfire Games!

#7 Wijitmaker

Wijitmaker

    0 A.D. Old Timer

  • WFG Retired
  • 9,536 posts

Posted 06 March 2012 - 03:06 PM

Hmm, is anyone else thinking what I'm thinking? This RMS logic could be replicated for play in game to allow simple wall shapes to be auto placed by the player (through the UI) as well as the computer AI.
  • 0

Jason Bishop [ aka Wijitmaker ]

0 A.D. Founder

Contact me: jason@wildfiregames.com


#8 Mythos_Ruler

Mythos_Ruler

    Senator

  • WFG Retired
  • 14,961 posts

Posted 06 March 2012 - 07:14 PM

Hmm, is anyone else thinking what I'm thinking? This RMS logic could be replicated for play in game to allow simple wall shapes to be auto placed by the player (through the UI) as well as the computer AI.

If we do that, we might as well make a real wall system.
  • 0

#9 FeXoR

FeXoR

    Centurio

  • Community Members
  • PipPipPipPipPip
  • 901 posts

Posted 07 March 2012 - 04:47 AM

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.

Attached File  wall_demo2.zip   7.93KB   59 downloads

wall_demo_cart.jpg wall_demo_celt.jpg wall_demo_hele.jpg
wall_demo_iber.jpg wall_demo_pers.jpg wall_demo_pali.jpg

Edited by FeXoR, 07 March 2012 - 01:19 PM.

  • 0

#10 FeXoR

FeXoR

    Centurio

  • Community Members
  • PipPipPipPipPip
  • 901 posts

Posted 07 March 2012 - 05:47 AM

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, 15 March 2012 - 11:08 AM.

  • 0

#11 FeXoR

FeXoR

    Centurio

  • Community Members
  • PipPipPipPipPip
  • 901 posts

Posted 07 March 2012 - 05:08 PM

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, 07 March 2012 - 05:15 PM.

  • 0

#12 FeXoR

FeXoR

    Centurio

  • Community Members
  • PipPipPipPipPip
  • 901 posts

Posted 07 March 2012 - 05:21 PM

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, 15 March 2012 - 11:11 AM.

  • 0

#13 Mythos_Ruler

Mythos_Ruler

    Senator

  • WFG Retired
  • 14,961 posts

Posted 07 March 2012 - 07:46 PM

What do you mean by upkeep?
  • 0

#14 Wijitmaker

Wijitmaker

    0 A.D. Old Timer

  • WFG Retired
  • 9,536 posts

Posted 07 March 2012 - 09:51 PM

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

Jason Bishop [ aka Wijitmaker ]

0 A.D. Founder

Contact me: jason@wildfiregames.com


#15 FeXoR

FeXoR

    Centurio

  • Community Members
  • PipPipPipPipPip
  • 901 posts

Posted 08 March 2012 - 10:54 AM

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, 15 March 2012 - 11:12 AM.

  • 0

#16 feneur

feneur

    Cartographer of imaginary worlds

  • 0 A.D. Project Leader
  • 7,756 posts

Posted 08 March 2012 - 01:36 PM

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 ;) )
  • 1

Erik Johansson [ aka feneur ]

Wildfire Games
Contact me: feneur@wildfiregames.com



Support Wildfire Games!


#17 FeXoR

FeXoR

    Centurio

  • Community Members
  • PipPipPipPipPip
  • 901 posts

Posted 09 March 2012 - 12:22 AM

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.
  • 0

#18 FeXoR

FeXoR

    Centurio

  • Community Members
  • PipPipPipPipPip
  • 901 posts

Posted 09 March 2012 - 12:47 AM

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
Attached File  fortresses_v0.1_and_wall_demo.zip   10.11KB   59 downloads

fortresses_v0.1_-_5_players-small.jpg

Edited by FeXoR, 09 March 2012 - 02:03 AM.

  • 0

#19 feneur

feneur

    Cartographer of imaginary worlds

  • 0 A.D. Project Leader
  • 7,756 posts

Posted 09 March 2012 - 12:50 AM

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:
angled_walls_and_tower.jpg
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?
  • 0

Erik Johansson [ aka feneur ]

Wildfire Games
Contact me: feneur@wildfiregames.com



Support Wildfire Games!


#20 FeXoR

FeXoR

    Centurio

  • Community Members
  • PipPipPipPipPip
  • 901 posts

Posted 09 March 2012 - 01:01 AM

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:
angled_walls_and_tower.jpg
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, 09 March 2012 - 01:36 AM.

  • 0