System World Generator

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
> I reckon these terrain generators are pointless

Well, for the most part, I would agree with that. A real person CAN do much better. But it doesn't look BAD by any means. And it's fast. Those are pretty much the pros of the systems. And you might like them if you're a bad terrainer. :p
 

Miz

Administrator
Reaction score
424
Well it is pretty cool for people who don't like to terrain that much
and it does have some cool things :p so I guess +rep...

edit: nvm can't
 

elmstfreddie

The Finglonger
Reaction score
203
Well, I converted it to JASS then "optimized" it, removed waits, etc, and it's done instantly, without crashes, lags, leaks, etc. BUT APPARENTLY it locks up half-way through creating doodads??? It creates doodads on half the map then jams or something. Gonna find out the problem to that. Once it's fixed, I'll post the "JASS Version". The variable setting is still in GUI so it's user-friendlyish

Apparently I can't find the problem... For you JASSers here's the script I wrote so far.
JASS:
function Trig_WorldGenJASS_Actions takes nothing returns nothing
    local integer IndexA = 1
    local integer IndexB = 1
    call DisplayTextToForce(GetPlayersAll(),"Map made by: dhk_undead_lord|nIf you use give me credit!")
    call DisplayTimedTextToForce(GetPlayersAll(),100000.00,"Step 1: Creating Terrain")
    set IndexA = 1
    loop
        exitwhen IndexA > udg_NumberOfChangingsHoricontal
        set IndexB = 1 
        loop
            exitwhen IndexB > udg_NumberOfChangingsVertical
            call SetTerrainType(udg_StartingFromX + (IndexA * 128.00),udg_StartingFromY + (IndexB * 128.00),udg_Terrain_Types[GetRandomInt(1,9)],-1,GetRandomInt(1,3),0)
            set IndexB = IndexB + 1
        endloop
        set IndexA = IndexA + 1
    endloop
    call ClearTextMessages()
    call DisplayTimedTextToForce(GetPlayersAll(),100000.00,"Step 2: Creating Heights")
    set IndexA = 1
    loop
        exitwhen IndexA > udg_NumberOfChangingsHoricontal
        set IndexB = 1
        loop
            exitwhen IndexB > udg_NumberOfChangingsVertical
            if GetRandomInt(1,2) == 1 then
                call TerrainDeformCrater(udg_StartingFromX + (IndexA * 128.00),udg_StartingFromY + (IndexB * 128.00),(128.00 * GetRandomReal(1.00,4.00)),GetRandomReal(-64.00,64.00),1,true)
            endif
            set IndexB = IndexB + 1
        endloop
        set IndexA = IndexA + 1
    endloop
    call ClearTextMessages()
    call DisplayTimedTextToForce(GetPlayersAll(),100000.00,"Step 3: Creating Doodads")
    set IndexA = 1
    loop
        exitwhen IndexA > udg_NumberOfChangingsHoricontal
        set IndexB = 1
        loop
            exitwhen IndexB > udg_NumberOfChangingsVertical
            if GetRandomInt(1,10) == 1 then
                if GetTerrainType(udg_StartingFromX + (IndexA * 128.00),udg_StartingFromY + (IndexB * 128.00)) == 'Zvin' then
                    call CreateDestructable(udg_TerrainTypeRandomDoodads[1],udg_StartingFromX + (IndexA * 128.00),udg_StartingFromY + (IndexB * 128.00),GetRandomReal(0,360),1,GetRandomInt(1,udg_MaxVersion[1]))
                elseif GetTerrainType(udg_StartingFromX + (IndexA * 128.00),udg_StartingFromY + (IndexB * 128.00)) == 'Zgrs' then
                        call CreateDestructable(udg_TerrainTypeRandomDoodads[2],udg_StartingFromX + (IndexA * 128.00),udg_StartingFromY + (IndexB * 128.00),GetRandomReal(0,360),1,GetRandomInt(1,udg_MaxVersion[2]))
                    elseif GetTerrainType(udg_StartingFromX + (IndexA * 128.00),udg_StartingFromY + (IndexB * 128.00)) == 'Zbks' then
                            call CreateDestructable(udg_TerrainTypeRandomDoodads[3],udg_StartingFromX + (IndexA * 128.00),udg_StartingFromY + (IndexB * 128.00),GetRandomReal(0,360),1,GetRandomInt(1,udg_MaxVersion[3]))
                        elseif GetTerrainType(udg_StartingFromX + (IndexA * 128.00),udg_StartingFromY + (IndexB * 128.00)) == 'Zdrg' then
                                call CreateDestructable(udg_TerrainTypeRandomDoodads[4],udg_StartingFromX + (IndexA * 128.00),udg_StartingFromY + (IndexB * 128.00),GetRandomReal(0,360),1, GetRandomInt(1,udg_MaxVersion[4]))
                            elseif GetTerrainType(udg_StartingFromX + (IndexA * 128.00),udg_StartingFromY + (IndexB * 128.00)) == 'Zdtr' then
                                    call CreateDestructable(udg_TerrainTypeRandomDoodads[8],udg_StartingFromX + (IndexA * 128.00),udg_StartingFromY + (IndexB * 128.00),GetRandomReal(0,360),1, GetRandomInt(1,udg_MaxVersion[8]))
                                elseif GetTerrainType(udg_StartingFromX + (IndexA * 128.00),udg_StartingFromY + (IndexB * 128.00)) == 'Zdrt' then
                                        call CreateDestructable(udg_TerrainTypeRandomDoodads[9],udg_StartingFromX + (IndexA * 128.00),udg_StartingFromY + (IndexB * 128.00),GetRandomReal(0,360),1, GetRandomInt(1,udg_MaxVersion[9]))
                endif
            endif
            set IndexB = IndexB + 1
        endloop
        set IndexA = IndexA + 1
    endloop
    call ClearTextMessages()
    call DisplayTimedTextToForce(GetPlayersAll(),100000.00,"Step 4: Creating Animals")
    set IndexA = 1
    loop
        exitwhen IndexA > udg_NumberOfChangingsHoricontal
        set IndexB = 1
        loop
            exitwhen IndexB > udg_NumberOfChangingsVertical
            if GetRandomInt(1,14) == 1 then
                call CreateUnit(Player(15),udg_Animals[GetRandomInt(1, 5)],udg_StartingFromX + (IndexA * 128.00),udg_StartingFromY + (IndexB * 128.00),GetRandomReal(0.00, 360.00))
            endif
            set IndexB = IndexB + 1
        endloop
        set IndexA = IndexA + 1
    endloop
    call ClearTextMessages()
    call DisplayTimedTextToForce(GetPlayersAll(),100000.00,"Completed")
endfunction

//===========================================================================
function InitTrig_WorldGenJASS takes nothing returns nothing
    set gg_trg_WorldGenJASS = CreateTrigger()
    call TriggerRegisterTimerEventSingle(gg_trg_WorldGenJASS,0.01)
    call TriggerAddAction(gg_trg_WorldGenJASS,function Trig_WorldGenJASS_Actions)
endfunction
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
> It creates doodads on half the map then jams or something.

The triggers are hitting the execution limit. It seems that waits get rid of that problem. I don't know for sure, though.

EDIT: Adding waits will stop the trigger from freezing up.
 

elmstfreddie

The Finglonger
Reaction score
203
Okay, but then it doesn't run instantly, which destroys the purpose of it being JASS. I might as well make each loop it's own function, then the main thing just calls the 4 functions. Terrain, height, destructables, then units. lol :p


Now you might be wondering why I re-wrote it in JASS...
half because I was bored
half because I wanna prove how much better JASS is than GUI for redundant multiple action triggers like this ;)
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
> Okay, but then it doesn't run instantly, which destroys the purpose of it being JASS.

Ok. Does it really matter? It works. Besides, I <3 GUI. :p

> I might as well make each loop it's own function, then the main thing just calls the 4 functions.

I made each of mine separate triggers. No big deal, I suppose.
 

elmstfreddie

The Finglonger
Reaction score
203
Sorry for not doing it to yours Ghan btw, I did it to this one only because it had more features... lol
If you want I can do the same to yours, it doesn't take very long.


zomg >_<
It still locks up halfway through doodads.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
> It still locks up halfway through doodads.

With waits, even? Odd. Does it actually stop the game, or does the generation just stop?

> If you want I can do the same to yours, it doesn't take very long.

Well, post in my thread. This one is for dhk_undead_l. ;)
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
I increased the size of the map, and the trigger froze up after creating about 1/6 of the terrain and stopped there.
 

Anachron

New Member
Reaction score
53
Really? With new version? =/ (=> then I should make an additional system that checks how fast the steps can be done ) :p
Edit: I know how I will fix that. I simply seperate regions, checking at first playable area size.
After that, I will create terrain for all of this smaller regions after the before region.
But I am really currently to lazy to do that lol :p.
( Maybe its because I have holidays and fly with my girlfriend in our holidays! :) )
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top