CRPL Question

Started by Jackeea, October 28, 2013, 07:42:31 PM

Previous topic - Next topic

Jackeea

Hi all,
I was wondering, for the "Magnetar" mission (I forget the name), I can remember Virgil saying that he used a CRPL script to make the circular asteroid. Now, I've attempted to do the same thing, and the code was relatively easy to make:
$Range:35 #Radius of the asteroid
$Terrain:2 #Terrain level
CurrentCoords <-Range RandCoordsInRance <-Terrain SetTerrain
However, this script made my computer REALLY laggy (which I am aware of, because SetTerrain is awful when you're using it like this), and I was wondering if there was anyway to make the script less laggy for my computer, and also, quicker. Running on x4 speed, this script made a 60 radius asteroid in 10 minutes game time, or 2:30 in IRL time. The map I was making required 6 levels of terrain, and afking, it took about 30 minutes to make the basis for the map that I needed. Is there any easy way to speed this process up, of making circular terrain?

Grauniad

You can do SetTerrain for any one level to get the outline. Then you  can hand-edit details into it. 
A goodnight to all and to all a good night - Goodnight Moon

knucracker

I used something like the following (it was throw away so I hard coded the constants).
I'm not sure I totally follow your method, but it looks like you might be changing the terrain height of random locations?  That would take forever... :)

It still isn't a speed demon to loop over every cell in the map and call SetTerrain (or SetVoid), but it doesn't really take that long for a one time operation.


once
PlaySound("Retro26")
endonce

if (<-row lt (MapHeight))
@DoRow
<-row add(1) ->row
endif


:DoRow
do(MapWidth 0)
Distance(90 70 I <-row) ->distance
if (<-distance gte(75))
SetTerrain(I <-row 5)
#SetVoid(I <-row)
else if (<-distance asint eq(65) )
SetTerrain(I <-row 10)
endif endif
loop

Jackeea

#3
Quote from: virgilw on October 28, 2013, 08:12:58 PM
I used something like the following (it was throw away so I hard coded the constants).
I'm not sure I totally follow your method, but it looks like you might be changing the terrain height of random locations?  That would take forever... :)

It still isn't a speed demon to loop over every cell in the map and call SetTerrain (or SetVoid), but it doesn't really take that long for a one time operation.

[snip code] -G.

Yeah, I didn't know how to do it, and wasn't really that interested in coding a ton, so I basically decided to try the simple solution of changing the terrain for all the locations in range, but randomly. But anyway, I'll give that script a go, thanks!