Jump to content

FeXoR

WFG Retired
  • Posts

    1.426
  • Joined

  • Last visited

  • Days Won

    28

Posts posted by FeXoR

  1. 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

  2. Your functions overlap with new rmgen functions. But the odd part is that there aren't any warnings/errors. Rename them to something like dfGetDistance and it will work. Only these three are the problem:

    getDistance

    getDirection

    getAngle

    I found notepad's replace function useful here.

    Thx, I thought so, I'll rename them... 

    BTW: I hope you mean @ least notepad++ :D

  3. Actually, I am getting this:

    This is strange!

    I use alpha 8, perhaps that's it...

    All functions I used are inside the map, perhaps some rmgen libs changed...

    I have no clue, I generated the screenshots of my previous post with the downloaded version and didn't change any files...

    EDIT: U'r screenshot shows No hight mapping(hills/lakes/paths), no texture (base, path, woods, lakes) and no entities but the start entities and start resources...

    Checking the 2 functions that didn't seam to run at all...

  4. Hmmm... it generates a map, but with no forests. Bug or feature? ;)

    Huh??? :eek:

    I'll test the download today, didn't check it...

    EDIT: Yes, U'r right somehow, it's a feature :lol:

    Adding some screenshots of what happened to you, I think:

    On tiny maps:

    post-14196-0-77066800-1330933606_thumb.j post-14196-0-32643000-1330933635_thumb.j post-14196-0-17473800-1330933670_thumb.j post-14196-0-94000000-1330933696_thumb.j

    If you have more then 3 players on a tiny map, the map will be quite empty.

    Similar with small maps and more then 5 players.

    In addition to that 'expansion' metal (normally outside the start locations) is very near to each other when you have many players on small maps.

    Should scale the path's more with map size and perhaps the base size.

    EDIT: Scaled the maximum tree density with the map size for future versions...

  5. Yeah, the existing checks in rmgen don't exactly match up with the passability criteria. Atlas has similar problems, you can place entities within the circle but not reachable.

    I don't think it's a bad idea to have some space at the border, looks better, the shadows for example and map doesn't end so abrupt.

    But it should have no game impact. Perhaps those objects could be shown but marked as non-interactable so no player/AI/Unit AI tries to interact with them... and fails. 

  6. The only rms with this problem I found was guadalguivir that was fixed in the last svn update. Are you sure you've seen such a thing in other maps?

    In beta 8 (installed with 0ad-r10803-alpha-win32.exe) yes.

    EDIT: Perhaps should install on linux and use the svn version to keep track of the actual development...

    - latium, tiny, players 2, seed 0, bottom on the cliff is a tree.

    - Cantabrian Highlands, tiny, players 2, seed 0, right bottom of the blue players start location is a tree.

    - Neareastern bad lands, tiny, players 2, seed 0, bottom left below the red players start location

    ...did'nt even need to seed to find some...

  7. The trig functions are being replaced with safe versions, I have done sin and cos, and will be doing atan2 sometime soon. The replacements should be pretty accurate (about 10 decimal places) and reasonably fast, if you avoid using them in big loops then it should be fine.

    Vector maths is a general area of mathematics, for map making you would only need a basic knowledge though, I don't know where you would go to learn it though. I don't think there are any libraries used in javascript for the game, I just wrote the operations myself when working on the advanced attack code.

    I don't have problems with vector maths, I have the problem that I don't want to what Ykkrosh told me to avoid. And I don't know how to avoid it.

    If you wrote functions with about 4 decimal points higher accuracy (The error in trigonometric functions in JS in different OS I rad about in posts was about 10**(-6)) wouldn't it be a good idea to include them in other areas of the game as well?

  8. Be careful that trigonometric functions in JS don't return precisely identical results on different platforms (Windows vs Linux etc), so they'll probably cause out-of-sync errors in multiplayer. It's best to avoid them entirely if at all possible (and prefer using vectors maths rather than trigonometry); otherwise we'll probably have to replace the standard versions of the functions with 'safe' (but likely slow and imprecise) versions.

    After a little wile I noticed that it's quite impossible avoiding placing objects on coordinates (z and z in floats).

    So where can I find a documentation of that 'vector maths' you are suggesting.

    I only found vector math libraries but don't know if there's a default lib in JS for it and which one you use allrdy (if so).

    I noticed though that may functions in the rmgen libs use trigonometric functions.

    Please, answer this one quick so I avoid doing things I have to rewrite.

    Thanks.

  9. On some random maps (I didn't check all the scenarios) interactable objects are so close to the map border that no units can walk there.

    I think the the general functions should warn if an entity is placed to close to the map border so that map/rmg designers are made aware of.

    In my circular rmgs I define a 'playable map radius' variable and set it to 'g_map.getMapSize()/2 - 5' and always check against it if placing entities.Walkable map area my be a bit bigger but I didn't notice units could walk behind a tree placed at this radius. Have to check though.

  10. After a rough night I got further...

    The story about that night can be found here.

    The outcome is this:

    deep_forest_v0.3.zip

    Bugs:

    - Resources are not really implemented at all (The resources at start position are more artefacts of the previous version then inclusions of this map)

    - Didn't find a way to lower the water level, so I raised all tiles - one by one - by one (Sounds strange but it's correct, I guess).

    EDIT: Now I know, THX howlingflute!

    Issues:

    - Still lags on big maps due to the number of entities.

    - Takes a bit long to generate due to some self-written functions (they are not necessarily bad but can be made faster)

    - Map code has to be tidied up!

    NOTE: I got no 'out of memory' problems but I only made 'normal' sized maps (All maps lag on my labtop when bigger then 'medium')

    Poor design/things to add or comment:

    - There are too many trees in somehow unused map areas near the map border that only causes laag. Cliffs or Lakes should be added there. (Spahbod's suggestion)

    - Map border is not designed at all, cliffs/lakes/terrain should be added (I wanted to ensure no chopable tree or other interactive thing is unreachable for units because it causes lags caused by AI, unit AI and/or pathfinding, gatherers pile up there) [cause, cause, cause x)]

    - To many/broad roads. With many players they will nearly fill the area between start positions. Should be somehow scaled with number of players.

    - Outer roads should be dragged to the border to enlarge the playable map area. 1 of the 2 roads between 2 given players should follow a 'circumventing' not a 'straight' path.

    - Roads are to straight IMO. They are generated with a type of 'directed random walk'. If I raise the possible angle the next step directs too much, they might never reach there destination. On bigger maps they might stop somewhere on the map because steps are caped at 1000. (Further tests needed)

    - A general hight map should be added. I would like nice, smooth hills. Raising the terrain in the map center and lowering it at the map border would suggest lakes at the border rather then hills/cliffs, but we will see...

    - The forest's floor is to dense.

    - The forest floor is to uniform. Some sand/dirt should be added.

    - A 'forest border' should be added with bushes and longer grass surrounding the forests.

    - The forest hight should be raised in a wider radius. Will be implemented with the 'forest border'.

    - Terrain textures has to be chosen more wisely. I like the 'mud_slide_2' texture for road borders and bases (looks like dung ^^) but it occurs to often. Single textures of the same type tend to look squared. Have to finetune textures and perhaps rather place them on small areas then single tiles. Available textures are awesome though, great work!

    - Player's start positions should be randomized more, especially the angle. Increase the angle offset will do IMO but an added absolute radius offset scaled with the squared map radius could help too (tuned for 'giant' maps which I can't test though...)

    And some screenshots:

    post-14196-0-47863400-1330704923_thumb.j post-14196-0-63452600-1330704961_thumb.j post-14196-0-13352300-1330704986_thumb.j

    post-14196-0-47939500-1330705013_thumb.j post-14196-0-95941300-1330848740_thumb.j

  11. To say it first: It was my fault!

    I should have read all the rmgen functions.

    I shouldn't have asked, I should have read the code...

    Well, I didn't...

    The result was about 5 hours writing and changing code with very strange outcome (I wont annoy you with that but I have to tell my odyssey to get rid of my aching head)

    ...that had an effect similar to what I wanted but with terrible side effects and left me totally confused (and I still don't know why the hell it somehow worked)

    If you don't want to waste your time skip the rest of the post...

    But if you want something to read, here's

    The Story

    Somehow it goes back to

    QUOTE

    I don't know of any function for that, but we could add them to rmgen: getTerrainTexture(x, z) getTerrainObjects(x, z). In the meantime, you can access the data directly with g_Map.texture[x][z] and g_Map.terrainObjects[x][z]

    I was grateful and in the late evening started to rewrite my deep forest RMG, where I wanted to have paths going through deep wooded hills. Note that I paint the paths first, since I couldn't find a way to remove trees and wasn't very familiar with terrain back then, and first had tried to lower the terrain of the paths a bit and used the sunken terrains height to avoid placing trees and textures on roads and so. This resulted in water on the roads and that U couldn't build there any more. But with the new 'knowledge' I was determined to do this with the 'g_Map.texture' and/or 'g_Map.terrainObjects' functions by avoiding to place things on road terrain. I had seen the avoidance implementations more commonly known as constraints, but I wanted to do this myself! So I wrote pages over pages and added some functions here that could be useful and the 'g_Map.texture' to check versus my path terrain strings. As I was finished I tested a bit, removed some typos and finally the RMG run through. But there were still trees on the roads. Maybe I swapped some conditions... turned them from false into true and from 'and' into 'or', though I didn't thought it would work cause it felt strange, and tested and, AND... well it looked OK! Really what I had in mind! Woods thinned out at a circle at half the map radius and, finally, no trees or forest floor on roads! I felt relived and thought 'tomorrow you will post this, much better then the last one'. Though I was tired I tried to raise the density of the woods cause somehow it was much thinner than I had in mind. I didn't fear any kind of problem since I lowered the tree density often for generating bigger maps on my old laptop and to avoid lags while viewing the map. But as I looked closer to the code, the density was already at 0.5 (50%, about each second tile) what was quite tight. I reviewed the map in the editor and it was definitely NOT every second tile! I reviewed my tree derivation function, read it over and over again to find the mistake, but everything seamed in order. I added tons of log code to output the actual tree density for every single tile (on the x axis to be correct). But everything was fine. Hm, Perhaps still something wrong with the 'g_Map.texture' condition, well it felt strange. OK, let's take a look... log said it return... UH, numbers! And why does it work... well lets see the function's code. Oh, IDs... I only use strings and arrays of strings... And why does it... ah, let's get the terrain ID by 'g_Map.texture' for every road tile I place and store it into an array so I can check against. ...one hour later with my tired head barely raised above the keyboard the map ran through and... took ages to generate! No warning, no error, no out of memory... it just lasted... and finally run through! But now there where trees on the roads again. Angry I commented out the checks and generated, just to see what happens, nothing special on my sluggish mind. Took a while... why ever... - Oh, trees everywhere, packed so tight I couldn't even scroll, what's up???!!! :wacko:My tree derivation function did everything right, but the check versus the list of values got by 'g_Map.texture' at every tree placed just thins out the bunches of trees to barely deserve to be called woods! I deleted my hole check implementation, just was to frustrated. 'IT SEAMED TO WORK' it cried in my head. 'IT seamed!' :sorry:I stared at my code a bit, seeing nothing. Then started to read through all the rmgen files still determined to at least get the 'is road' check right this day. not to mention that it was already 4:50... Most code I already knew but then, out of the nowhere, I stumbled across a Map.getTexture function!!! It was there! All the time I was trying to enforce it by abominable functions and horrible workarounds, it was there.

    Took me less then five minutes to figure out that it indeed returns a texture string, that 'g_Map' is an instance of 'Map' and to implement the 'not a path' checks needed with simply using 'g_Map.getTerrain'... which I COULD HAVE GUESSED!!!

    Five hours versus 5 minutes. That's... I'm so bloody incompetent, a dull mangy cur.

    I was relived though and added some base texture, tried to figure out a good derivation for secondary resources but finally dropped dad in bed.

    And historic_bruno said 'I don't know of any function' not 'there is no function'...

    Hope I learned from it though... well, hope dies last.

  12. True, for groups of object these functions are very helpful.

    But they use sin/cos like I do (for example createObjectGroups) which is not really a good idea as I got to know in an other post you where involved in (THX for your time) :

    getDistance(point1, point2) and getDirection(point1, point2) from one point to another

    Sometimes units are very tight packed though.

    I used functions that only uses tiles to place something but I doubt this is practicable for generating whole maps.

    I look forward to the beta 9 :worship:

  13. So the thing to do is only setting objects on tiles (eventually by rounding but only if necessary), never on coordinates (pair of floats) and hope that no missmatch will occur.

    Things to avoid are then:

    - ceil and floor (small missmatches of a natural number would often cause inconsistence)

    - Using polar coordinates for entity/terrain placement (as I have done in my RMG, even if I round afterwards this would not be wise)

    ...and for sure other things I've done allrdy. :banger:

    I will learn... ;)

  14. It is not bad. In fact, it's good as it improves performance. But we want random map scripts be simple and understandable for newcomers. So all of the dirty work should go into rmgen library.

    OK, Totally agree!

    But I find many functions inside the rmgen libs HARDER to understand and use then the more basic functions.

    In fact most of them take or need more arguments...

    Example:

    I mainly use "placeObject" to place entities.

    It takes 5 arguments:

    - x-coordinate(float)

    - y-coordinate(float)

    - template name(string, base filename)

    - player index(integer, 0 for gaia, 1 for player 1 with default color blue, ...)

    - orientation(float, 0 for top, PI/4 for top left 45°, PI/2 for right, ...)

    Everything simple and clear to me.

    In the RMGs included (for example latinum, great work BTW) uses:

    	var group = new SimpleGroup(	// elements (type, min/max count, min/max distance, min/max angle)
    [new SimpleObject(civEntities[0].Template, 1,1, 0,0, BUILDING_ANGlE, BUILDING_ANGlE)],
    true, null, ix, iz
    );
    createObjectGroup(group, id);

    Oooooookkkkkkkkk.... let me see.

    "SimpleGroup" (astonishing name for that ^^) needs 5 arguments from witch one is "SimpleObject" (even better x)) that takes 7 arguments.

    Even the RMG's author added a comment for the arguments...

    This is not "simple" in my book, but AFAIK that was the purpose of that function...

    Well, still getting to know the functions available better and try to get your idea behind it...

    So, to say it clearly: U'r doing a great job!

    I just don't always get it :sorry:

  15. Be careful that trigonometric functions in JS don't return precisely identical results on different platforms (Windows vs Linux etc), so they'll probably cause out-of-sync errors in multiplayer. It's best to avoid them entirely if at all possible (and prefer using vectors maths rather than trigonometry); otherwise we'll probably have to replace the standard versions of the functions with 'safe' (but likely slow and imprecise) versions.

    Uh, didn't think of it! But isn't the map generated on the hosting computer and then passed to the other players?

    And that kind of functions are used in many (if not all) RMGs like sin and cos.

    I don't what to argue about how to implement them (and that my code sucks and is only meant as an example) but I feel they are really needed!

    About the ";" thx for the statements, I'll read it when I have time (x)) but I closely listen to your advises!

    As I said before I am creating more functions for rmgen. But currently my rmgen library and random map scripts are full of buggy things related to the new features I'm planning for alpha 10.

    I have no problem with that, I'll be patient and rewrite my files when it's added.

    But until then I "have" to use my own functions even if my RMGs only work in single player... because I'm hot now and I admire it :crazy:

    Is there anything wrong with that? :blink:

×
×
  • Create New...