Can't find something like getTerrain function
#1
Posted 29 February 2012 - 06:37 PM
Is there any function for that, can't find it...
THX for you'r pacience
Im Übrigen bin ich der Meinung, dass 0A.D. Auslöser braucht. (IMO 0A.D. needs triggers ASAP.)
#2
Posted 29 February 2012 - 11:58 PM
Wildfire Games Programmer
Contact me: ben@wildfiregames.com
#3
Posted 01 March 2012 - 09:46 AM
Wildfire Games Random Map Designer, Low-level Programmer
Contact me: myops37@yahoo.com
Support Wildfire Games!
#4
Posted 01 March 2012 - 10:28 AM
historic_bruno, on 29 February 2012 - 11:58 PM, said:
I don't mind if it's a function or not, THX a lot, U made my day (and the next!) ^^
Spahbod, on 01 March 2012 - 09:46 AM, said:
Doesn't matter, I can get the terrain for coordinates, everything's fine for me.
Why is it so important to have a function for that as well?
I often directly use the g_Map vars/consts, what is wrong with that?
I don't change them of cause x)
...wouldn't dare to!
Edited by FeXoR, 01 March 2012 - 12:32 PM.
Im Übrigen bin ich der Meinung, dass 0A.D. Auslöser braucht. (IMO 0A.D. needs triggers ASAP.)
#5
Posted 01 March 2012 - 12:55 PM
FeXoR, on 01 March 2012 - 10:28 AM, said:
Why is it so important to have a function for that as well?
I often directly use the g_Map vars/consts, what is wrong with that?
I don't change them of cause x)
...wouldn't dare to!
Wildfire Games Random Map Designer, Low-level Programmer
Contact me: myops37@yahoo.com
Support Wildfire Games!
#6
Posted 01 March 2012 - 02:23 PM
Spahbod, on 01 March 2012 - 12:55 PM, said:
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
Edited by FeXoR, 01 March 2012 - 02:34 PM.
Im Übrigen bin ich der Meinung, dass 0A.D. Auslöser braucht. (IMO 0A.D. needs triggers ASAP.)
#7
Posted 01 March 2012 - 04:05 PM
Wildfire Games Random Map Designer, Low-level Programmer
Contact me: myops37@yahoo.com
Support Wildfire Games!
#8
Posted 01 March 2012 - 04:30 PM
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
Im Übrigen bin ich der Meinung, dass 0A.D. Auslöser braucht. (IMO 0A.D. needs triggers ASAP.)
#9
Posted 01 March 2012 - 04:42 PM
#10
Posted 02 March 2012 - 01:24 PM
areAllies
getPlayerTeam
sortPlayers
checkIfInClass
getDistance
getAngle
getDirection
getTerrainTexture
Also allied players start near each other now.
Wildfire Games Random Map Designer, Low-level Programmer
Contact me: myops37@yahoo.com
Support Wildfire Games!
#11
Posted 02 March 2012 - 03:02 PM
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
historic_bruno, on 29 February 2012 - 11:58 PM, said:
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???!!!
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.
Edited by FeXoR, 02 March 2012 - 03:06 PM.
Im Übrigen bin ich der Meinung, dass 0A.D. Auslöser braucht. (IMO 0A.D. needs triggers ASAP.)
#12
Posted 02 March 2012 - 03:21 PM
Wildfire Games Random Map Designer, Low-level Programmer
Contact me: myops37@yahoo.com
Support Wildfire Games!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












