Jump to content
Sign in to follow this  
TheGuardian

2D Land Generation

Recommended Posts

TheGuardian

Hey, not new to the forum but I created an account so I could post this.

I am a Minecraft player and I played Terraria for a little bit, I decided that I wanted to learn how to work with terrain generation. It also gives me something to do in my marketing class when I have nothing to do.

This is a 2d land generator that can be customized.

A Separate window allows you to change the variables used in the random generation code.

The main window is resizable and the generation will fit it.

I will start working on arrays as right now it doesn't remember where it generated land.

You also may notice on the options GUI that the input boxes marked with an "X" don't work because I haven't done anything with them yet.

I'm up for any tips ideas or even good random numbers to generate it with. I'm going to make it better over time.

Heres the code

[__CODE_PROTECTED]I2luY2x1ZGUgJmx0O0VkaXRDb25zdGFudHMuYXUzJmd0OzxiciAvPgojaW5jbHVkZSAmbHQ7R1VJQ29uc3RhbnRzRXguYXUzJmd0OzxiciAvPgojaW5jbHVkZSAmbHQ7U3RhdGljQ29uc3RhbnRzLmF1MyZndDs8YnIgLz4KI2luY2x1ZGUgJmx0O1dpbmRvd3NDb25zdGFudHMuYXUzJmd0OzxiciAvPgojaW5jbHVkZSAmbHQ7QnV0dG9uQ29uc3RhbnRzLmF1MyZndDs8YnIgLz4KI2luY2x1ZGUgJmx0O0dESVBsdXMuYXUzJmd0OzxiciAvPgo8YnIgLz4KcmVsb2Fkb3B0aW9ucygwKSA7TG9hZCB0aGUgb3B0aW9ucyBHVUk8YnIgLz4KPGJyIC8+CjxiciAvPgojUmVnaW9uICMjIyBTVEFSVCBLb2RhIEdVSSBzZWN0aW9uICMjIyBGb3JtPUM6JiMwOTI7VXNlcnMmIzA5MjtNYXR0JiMwOTI7UGljdHVyZXMmIzA5MjtHaW1wJiMwOTI7R1VJJiMwOTI7Rm9ybTEua3hmPGJyIC8+CiYjMDM2O0Zvcm0xID0gR1VJQ3JlYXRlKCZxdW90O0dlbmVyYXRlIExldmVsJnF1b3Q7LCAxMTAyLCA1MDIsIDE5NCwgMTM5LCBCaXRPUigmIzAzNjtXU19NSU5JTUlaRUJPWCwmIzAzNjtXU19TSVpFQk9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igmIzAzNjtFU19BVVRPSFNDUk9MTCwmIzAzNjtFU19OVU1CRVIpKTxiciAvPgpHVUlDdHJsU2V0VGlwKC0xLCAmcXVvdDtUaGlzIGlzIHBpeGVscyBmcm9tIHRoZSB0b3Agb2YgdGhlIGRyYXdpbmcgYXJlYSZxdW90Oyk8YnIgLz4KR2xvYmFsICYjMDM2O2NoZWNrcmFuZG9tID0gR1VJQ3RybENyZWF0ZUNoZWNrYm94KCZxdW90O1JhbmRvbWl6ZSBHZW4uICMmcXVvdDssIDMyLCAxNjAsIDExMywgMTcpPGJyIC8+Ckdsb2JhbCAmIzAzNjtidG5kZWZhdWx0ID0gR1VJQ3RybENyZWF0ZUJ1dHRvbigmcXVvdDtEZWZhdWx0IFZhbHVlcyZxdW90OywgMjgwLCAzMTIsIDk5LCAyNSwgJiMwMzY7V1NfR1JPVVApPGJyIC8+CkdVSVNldFN0YXRlKEBTV19TSE9XKTxiciAvPgojRW5kUmVnaW9uICMjIyBFTkQgS29kYSBHVUkgc2VjdGlvbiAjIyM8YnIgLz4KPGJyIC8+CkVuZEZ1bmM=[/__CODE_PROTECTED]

A few tips about it.

You can check the Random Gen # to make the terrain even more random.

The Generation works by Randomizing a number between 1-11 then from that it decides what to do using that which can be customized on the options.

Thanks, Sorry if I missed anything important this is my first post.

I would attach a compiled version but Autoit forum is limiting my max upload size.

Last updated on: 8-17

generate.au3

Share this post


Link to post
Share on other sites
TheGuardian

I don't seem to be able to edit my original post sorry about the double post, the autoit code above had html tags stuck into it.

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GDIPlus.au3>

reloadoptions(0) ;Load the options GUI


#Region ### START Koda GUI section ### Form=C:\Users\Matt\Pictures\Gimp\GUI\Form1.kxf
$Form1 = GUICreate("Generate Level", 1102, 502, 194, 139, BitOR($WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))
GUISetBkColor(0x000000)
$btngenerate = GUICtrlCreateButton("Generate!", 464, 472, 179, 25, $WS_GROUP)
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$statuslbl = GUICtrlCreateLabel("Generating 0/0", 648, 472, 172, 17)
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetColor(-1, 0x00FF00)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###




_GDIPlus_Startup()

$hwnd = _GDIPlus_GraphicsCreateFromHWND($Form1)

While 1

$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $btngenerate
        If GUICtrlRead($checkrandom) = $GUI_CHECKED then randomgenops()
        Generateland()
    Case $btndefault
        reloadoptions(1)
EndSwitch


WEnd



Func Generateland()
    _GDIPlus_GraphicsClear($hwnd)
    $hwnd = _GDIPlus_GraphicsCreateFromHWND($Form1)

    $linewidth = GUICtrlRead($inlinesize)
    $greenpen = _GDIPlus_PenCreate(0xFF00FF00,$linewidth)
    $greypen = _GDIPlus_PenCreate(0xFF2B2B2B,$linewidth)
    $brownpen = _GDIPlus_PenCreate(0xFF733D1A,$linewidth)

    $winsize = WinGetPos("Generate Level")


    ;YAY! lets do some math...

    $y = Round(($winsize[3]-50)/2,0) ;offset for bottom, get middle
    $yoff = Round(($winsize[3]-60)/4,0) ; get the quarters
    $y = Random($y-$yoff,$y+$yoff,1) ;use the 2 interquarters
    $x = Round($linewidth/2,0)
    $bottom = $winsize[3]-80
    $bottomlimit = GUICtrlRead($inhmin)
    $counter = 1

Do
    GUICtrlSetData($statuslbl,"Generating "&$counter&"/"&Round($winsize[2]/$linewidth,0))
    $ran = Random(GUICtrlRead($inmainran1),GUICtrlRead($inmainran2),1)
    $toolow = 0
    $tooh = 0
    If $toolow = 1 and $y <= $winsize[3]-$yoff Then $toolow = 0  ;this is to bring level back to normal elevation
    If $tooh = 1 and $y >= $yoff Then $tooh = 0  ;this is to bring level back to normal elevation

    ;Generate Flat
    If $ran >= GUICtrlRead($ingenflat1) And $ran <= GUICtrlRead($ingenflat2) Then
        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0),$greenpen)
        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0)+GUICtrlRead($indirtlayer),$brownpen)

    EndIf
    ;Generate Elevate Up
    If $ran >= GUICtrlRead($ingenelup1) And $ran <= GUICtrlRead($ingenelup2) Then


        If $y - GUICtrlRead($insteph) <= GUICtrlRead($inhmax) Then $tooh = 1;Lets not go too far up yea?
        ;its too high make it have little chance of going back up until a certain elevation is met
        ;this gives it a smaller chance to go back up until its low enough
        If $tooh = 1 And Random(GUICtrlRead($intoohupchance1),GUICtrlRead($intoohupchance2),1) = GUICtrlRead($intoohupchance1) Then $y = $y - GUICtrlRead($insteph)
        If $tooh = 0 Then $y = $y - GUICtrlRead($insteph)


        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0),$greenpen)
        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0)+GUICtrlRead($indirtlayer),$brownpen)

    EndIf
    If $ran >= GUICtrlRead($ingeneldn1) And $ran <= GUICtrlRead($ingeneldn2) Then

        If $y + GUICtrlRead($insteph) >= $bottom - $bottomlimit Then $toolow = 1;Lets not go too far down yea?
        ;its too low make it have little chance of going down until a certain hight is met
        ;this gives it a smaller chance to go back down until its high enough
        If $toolow = 1 And Random(GUICtrlRead($intoolowdnchance1),GUICtrlRead($intoolowdnchance1),1) = GUICtrlRead($intoolowdnchance1) Then $y = $y + GUICtrlRead($insteph)
        If $toolow = 0 Then $y = $y + GUICtrlRead($insteph)

        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0),$greenpen)
        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0)+GUICtrlRead($indirtlayer),$brownpen)


    EndIf

    $counter = $counter + 1
    $x = $x + $linewidth
Until $x >= $winsize[2]
    GUICtrlSetData($statuslbl,"Generated!")
EndFunc


Func randomgenops()
    $ran = Random(2,5,1)
    GUICtrlSetData($ingenelup2,$ran)
    GUICtrlSetData($ingenflat1,$ran+1)
    $ran = Random($ran+2,$ran+6,1)
    GUICtrlSetData($ingenflat2,$ran)
    GUICtrlSetData($ingeneldn1,$ran+1)

    Random(7,11,1)
EndFunc

Func reloadoptions($x)
    If $x = 1 Then GUIDelete($Form2)

#Region ### START Koda GUI section ### Form=
Global $Form2 = GUICreate("Options", 391, 417, 100, 80)
Global $inmainran1 = GUICtrlCreateInput("1", 80, 8, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label1 = GUICtrlCreateLabel("Main Random", 8, 8, 70, 17)
$Label2 = GUICtrlCreateLabel("--", 120, 8, 10, 17)
Global $inmainran2 = GUICtrlCreateInput("11", 128, 8, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
Global $ingenflat1 = GUICtrlCreateInput("4", 80, 40, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label3 = GUICtrlCreateLabel("Gen Flat", 32, 40, 44, 17)
$Label4 = GUICtrlCreateLabel("--", 120, 40, 10, 17)
Global $ingenflat2 = GUICtrlCreateInput("8", 128, 40, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
Global $ingenelup1 = GUICtrlCreateInput("1", 80, 64, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label5 = GUICtrlCreateLabel("Gen Elev. Up", 8, 64, 68, 17)
$Label6 = GUICtrlCreateLabel("--", 120, 64, 10, 17)
Global $ingenelup2 = GUICtrlCreateInput("3", 128, 64, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
Global $ingeneldn1 = GUICtrlCreateInput("9", 80, 88, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label7 = GUICtrlCreateLabel("Gen Elev. Dn", 8, 88, 68, 17)
$Label8 = GUICtrlCreateLabel("--", 120, 88, 10, 17)
Global $ingeneldn2 = GUICtrlCreateInput("11", 128, 88, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
Global $ingenhill1 = GUICtrlCreateInput("X", 80, 112, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label9 = GUICtrlCreateLabel("Gen Hill", 32, 112, 41, 17)
$Label10 = GUICtrlCreateLabel("--", 120, 112, 10, 17)
Global $ingenhill2 = GUICtrlCreateInput("X", 128, 112, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
Global $ingendip1 = GUICtrlCreateInput("X", 80, 136, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label11 = GUICtrlCreateLabel("Gen Dip", 32, 136, 43, 17)
$Label12 = GUICtrlCreateLabel("--", 120, 136, 10, 17)
Global $ingendip2 = GUICtrlCreateInput("X", 128, 136, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label13 = GUICtrlCreateLabel("Height Min.", 16, 184, 59, 17)
Global $inhmin = GUICtrlCreateInput("10", 80, 184, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
GUICtrlSetTip(-1, "This is pixels from bottom of drawing area")
$Label14 = GUICtrlCreateLabel("Line Size", 24, 232, 47, 17)
Global $inlinesize = GUICtrlCreateInput("4", 80, 232, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
Global $inhillstop = GUICtrlCreateInput("X", 288, 40, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label15 = GUICtrlCreateLabel("Hill Stop Chance", 200, 40, 84, 17)
Global $inrand1 = GUICtrlCreateInput("1", 288, 16, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label16 = GUICtrlCreateLabel("Random", 240, 16, 46, 17)
$Label17 = GUICtrlCreateLabel("--", 328, 16, 10, 17)
Global $inrand2 = GUICtrlCreateInput("9", 336, 16, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
Global $indipstop = GUICtrlCreateInput("X", 288, 64, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label18 = GUICtrlCreateLabel("Dip Stop Chance", 200, 64, 84, 17)
Global $maxhillh = GUICtrlCreateInput("X", 288, 104, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label19 = GUICtrlCreateLabel("Max Hill Height", 208, 104, 76, 17)
Global $maxhillw = GUICtrlCreateInput("X", 288, 128, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label20 = GUICtrlCreateLabel("Max Hill Width", 208, 128, 76, 17)
Global $maxdiph = GUICtrlCreateInput("X", 288, 152, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label21 = GUICtrlCreateLabel("Max Dip Height", 208, 152, 76, 17)
Global $maxdipw = GUICtrlCreateInput("X", 288, 176, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label22 = GUICtrlCreateLabel("Max Dip Width", 208, 176, 76, 17)
$Label23 = GUICtrlCreateLabel("Step Size", 24, 256, 49, 17)
Global $insteph = GUICtrlCreateInput("4", 80, 256, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
Global $indirtlayer = GUICtrlCreateInput("4", 240, 216, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label24 = GUICtrlCreateLabel("Dirt Offset", 188, 216, 49, 17)
Global $inrocklayer1 = GUICtrlCreateInput("X", 240, 240, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label26 = GUICtrlCreateLabel("Rock Layer", 176, 240, 62, 17)
$Label27 = GUICtrlCreateLabel("--", 280, 240, 10, 17)
Global $inrocklayer2 = GUICtrlCreateInput("X", 288, 240, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
Global $intoolowdnchance1 = GUICtrlCreateInput("1", 160, 296, 25, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label25 = GUICtrlCreateLabel("Elev. Dn chance if toolow =1", 8, 298, 148, 17)
$Label28 = GUICtrlCreateLabel("of", 192, 298, 13, 17)
Global $intoolowdnchance2 = GUICtrlCreateInput("5", 208, 296, 25, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
Global $intoohupchance1 = GUICtrlCreateInput("1", 160, 320, 25, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label29 = GUICtrlCreateLabel("Elev. Up chance if tooh =1", 8, 322, 147, 17)
$Label30 = GUICtrlCreateLabel("of", 192, 322, 13, 17)
Global $intoohupchance2 = GUICtrlCreateInput("5", 208, 320, 25, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label31 = GUICtrlCreateLabel("Height Max", 16, 208, 58, 17)
Global $inhmax = GUICtrlCreateInput("20", 80, 208, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
GUICtrlSetTip(-1, "This is pixels from the top of the drawing area")
Global $checkrandom = GUICtrlCreateCheckbox("Randomize Gen. #", 32, 160, 113, 17)
Global $btndefault = GUICtrlCreateButton("Default Values", 280, 312, 99, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

EndFunc

Share this post


Link to post
Share on other sites
H4CK3D

Add a pair of rare cliff and it will be cool. :mellow:

@edit

Can you make map generator? That will be cool too ;P xD FOR THE GAMES!

Edited by H4CK3D

Share this post


Link to post
Share on other sites
enaiman

Good work :mellow:

Personally, I think that "random" is not good enough sometimes so we need to "help" a little.

I am talking about some corrections like:

- consider the following example:

_|__ or similar (mirrored) where you have a "false" peak or a false valley - if you level that with the neighbours, it will look better. However, if the peak is a "true" one ( _|_ ) - only one pixel either side - then you keep that as it is. It does require a bit of thinking, but you already said that you have enough time :)


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
TheGuardian

Sorry not quite sure what you're saying, maybe you could word it differently or show me a picture?

Though this code (if ran in continuous and random #'s checked)

1. Will Randomize the Gen options (elevation and flatness)

2. Run cycles till it gets too high or low then set gen options to normal

3. When it reaches towards the middle will generate new random gen options

4. Uncomment line 276 for it to randomize new options every loop. (;randomgenops()) (a little too speratic)

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GDIPlus.au3>
#include <Array.au3>

#Region ### START Koda GUI section ### Form=C:\Users\Matt\Pictures\Gimp\GUI\Form1.kxf
$Form1 = GUICreate("Generate Level", 1102, 502, 194, 139, BitOR($WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))
GUISetBkColor(0x000000)
$btngenerate = GUICtrlCreateButton("Generate!", 464, 472, 179, 25, $WS_GROUP)
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$statuslbl = GUICtrlCreateLabel("Generating 0/0", 648, 472, 172, 17)
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetColor(-1, 0x00FF00)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

reloadoptions() ;Load the options GUI





GUICtrlSetState($checkcontinue,$GUI_CHECKED)
GUICtrlSetState($checkrandom,$GUI_CHECKED)

_GDIPlus_Startup()

$hwnd = _GDIPlus_GraphicsCreateFromHWND($Form1)
Global $greenpen, $blackpen ,$brownpen
Dim $mapx[1]
Dim $mapy[1]



While 1

$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $btngenerate
        If GUICtrlRead($checkrandom) = $GUI_CHECKED then randomgenops()
        If GUICtrlRead($checkcontinue) = $GUI_CHECKED then
            Generateinfinite()
        Else
            Generateland()
        EndIf

    Case $btndefault
        reloadoptions()
EndSwitch


WEnd


Func btngenerate()
    If GUICtrlRead($checkrandom) = $GUI_CHECKED then randomgenops()
        If Not $running = 1 Then
            If GUICtrlRead($checkcontinue) = $GUI_CHECKED then
                Generateinfinite()
                $running = 1
            Else
                Generateland()
            EndIf
        Else
            $running = 0
        EndIf
EndFunc



Func Generateland()
    Dim $mapx[1]
    Dim $mapy[1]
    _GDIPlus_GraphicsClear($hwnd)
    Global $hwnd = _GDIPlus_GraphicsCreateFromHWND($Form1)

    $linewidth = GUICtrlRead($inlinesize)
    $greenpen = _GDIPlus_PenCreate(0xFF00FF00,$linewidth)
    $brownpen = _GDIPlus_PenCreate(0xFF733D1A,$linewidth)
    $blackpen = _GDIPlus_PenCreate(0xFF000000,$linewidth)
    $winsize = WinGetPos("Generate Level")


    ;YAY! lets do some math...

    $y = Round(($winsize[3]-50)/2,0) ;offset for bottom, get middle
    $yoff = Round(($winsize[3]-60)/4,0) ; get the quarters
    $y = Random($y-$yoff,$y+$yoff,1) ;use the 2 interquarters
    $x = Round($linewidth/2,0)
    $bottom = $winsize[3]-80
    $bottomlimit = GUICtrlRead($inhmin)
    $counter = 1

Do
    GUICtrlSetData($statuslbl,"Generating "&$counter&"/"&Round($winsize[2]/$linewidth,0))
    $ran = Random(GUICtrlRead($inmainran1),GUICtrlRead($inmainran2),1)
    $toolow = 0
    $tooh = 0
    If $toolow = 1 and $y <= $winsize[3]-$yoff Then
        $toolow = 0  ;this is to bring level back to normal elevation
        randomgenops()
    EndIf
    If $tooh = 1 and $y >= $yoff Then $tooh = 0  ;this is to bring level back to normal elevation

    ;Generate Flat
    If $ran >= GUICtrlRead($ingenflat1) And $ran <= GUICtrlRead($ingenflat2) Then
        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0),$greenpen)
        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0)+GUICtrlRead($indirtlayer),$brownpen)

    EndIf
    ;Generate Elevate Up
    If $ran >= GUICtrlRead($ingenelup1) And $ran <= GUICtrlRead($ingenelup2) Then


        If $y - GUICtrlRead($insteph) <= GUICtrlRead($inhmax) Then
            $tooh = 1;Lets not go too far up yea?
            GUICtrlSetData($ingenelup2,"3")
            GUICtrlSetData($ingenflat1,"4")
            GUICtrlSetData($ingenflat2,"7")
            GUICtrlSetData($ingeneldn1,"8")
        EndIf
        ;its too high make it have little chance of going back up until a certain elevation is met
        ;this gives it a smaller chance to go back up until its low enough
        If $tooh = 1 And Random(GUICtrlRead($intoohupchance1),GUICtrlRead($intoohupchance2),1) = GUICtrlRead($intoohupchance1) Then $y = $y - GUICtrlRead($insteph)

        If $tooh = 0 Then $y = $y - GUICtrlRead($insteph)


        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0),$greenpen)
        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0)+GUICtrlRead($indirtlayer),$brownpen)

    EndIf
    ;Generate Elevate Down
    If $ran >= GUICtrlRead($ingeneldn1) And $ran <= GUICtrlRead($ingeneldn2) Then

        If $y + GUICtrlRead($insteph) >= $bottom - $bottomlimit Then
            $toolow = 1;Lets not go too far down yea?
            GUICtrlSetData($ingenelup2,"4")
            GUICtrlSetData($ingenflat1,"5")
            GUICtrlSetData($ingenflat2,"8")
            GUICtrlSetData($ingeneldn1,"9")
        EndIf
        ;its too low make it have little chance of going down until a certain hight is met
        ;this gives it a smaller chance to go back down until its high enough
        If $toolow = 1 and Random(GUICtrlRead($intoolowdnchance1),GUICtrlRead($intoolowdnchance2),1) = GUICtrlRead($intoolowdnchance1) Then $y = $y + GUICtrlRead($insteph)

        If $toolow = 0 Then $y = $y + GUICtrlRead($insteph)

        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0),$greenpen)
        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0)+GUICtrlRead($indirtlayer),$brownpen)


    EndIf

    _ArrayAdd($mapx,$x)
    _ArrayAdd($mapy,$y)
    $counter = $counter + 1
    $x = $x + $linewidth
Until $x >= $winsize[2]
    _ArrayAdd($mapx,$x)
    _ArrayAdd($mapy,$y)
    ;_ArrayDisplay($mapx)
    GUICtrlSetData($statuslbl,"Generated!")
    Global $mapxy[UBound($mapx)][2]
    For $i = 1 To UBound($mapx)-1
        $mapxy[$i][0] = $mapx[$i]
        $mapxy[$i][1] = $mapy[$i]
    Next
    ;_ArrayDisplay($mapx)
    $mapx = 0
    $mapy = 0

;_ArrayDisplay($mapxy)



EndFunc

Func Generateinfinite()

    _GDIPlus_GraphicsClear($hwnd)
    Global $hwnd = _GDIPlus_GraphicsCreateFromHWND($Form1)
    $linewidth = GUICtrlRead($inlinesize)

    $greenpen = _GDIPlus_PenCreate(0xFF00FF00,$linewidth)
    $brownpen = _GDIPlus_PenCreate(0xFF733D1A,$linewidth)
    $blackpen = _GDIPlus_PenCreate(0xFF000000,$linewidth)

    $winsize = WinGetPos("Generate Level")


    ;YAY! lets do some math...

    $y = Round(($winsize[3]-50)/2,0) ;offset for bottom, get middle
    $yoff = Round(($winsize[3]-60)/4,0) ; get the quarters
    $y = Random($y-$yoff,$y+$yoff,1) ;use the 2 interquarters
    $x = Round($linewidth/2,0)
    $bottom = $winsize[3]-80
    $bottomlimit = GUICtrlRead($inhmin)
    $counter = 1

Do

    GUICtrlSetData($statuslbl,"Generating "&$counter)
    $ran = Random(GUICtrlRead($inmainran1),GUICtrlRead($inmainran2),1)
    $toolow = 0
    $tooh = 0
    If $toolow = 1 and $y <= $winsize[3]-$yoff Then
        $toolow = 0  ;this is to bring level back to normal elevation
        randomgenops()
    EndIf
    If $tooh = 1 and $y >= $yoff Then $tooh = 0  ;this is to bring level back to normal elevation


    _GDIPlus_GraphicsDrawLine($hwnd,$x+20,$bottom,$x+20,1,$blackpen) ;get rid of land infront
    ;Generate Flat
    If $ran >= GUICtrlRead($ingenflat1) And $ran <= GUICtrlRead($ingenflat2) Then


        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0),$greenpen)
        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0)+GUICtrlRead($indirtlayer),$brownpen)

    EndIf
    ;Generate Elevate Up
    If $ran >= GUICtrlRead($ingenelup1) And $ran <= GUICtrlRead($ingenelup2) Then


        If $y - GUICtrlRead($insteph) <= GUICtrlRead($inhmax) Then
            $tooh = 1;Lets not go too far up yea?
            GUICtrlSetData($ingenelup2,"3")
            GUICtrlSetData($ingenflat1,"4")
            GUICtrlSetData($ingenflat2,"7")
            GUICtrlSetData($ingeneldn1,"8")
        EndIf
        ;its too high make it have little chance of going back up until a certain elevation is met
        ;this gives it a smaller chance to go back up until its low enough
        If $tooh = 1 And Random(GUICtrlRead($intoohupchance1),GUICtrlRead($intoohupchance2),1) = GUICtrlRead($intoohupchance1) Then $y = $y - GUICtrlRead($insteph)

        If $tooh = 0 Then $y = $y - GUICtrlRead($insteph)


        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0),$greenpen)
        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0)+GUICtrlRead($indirtlayer),$brownpen)

    EndIf
    ;Generate Elevate Down
    If $ran >= GUICtrlRead($ingeneldn1) And $ran <= GUICtrlRead($ingeneldn2) Then

        If $y + GUICtrlRead($insteph) >= $bottom - $bottomlimit Then
            $toolow = 1;Lets not go too far down yea?
            GUICtrlSetData($ingenelup2,"4")
            GUICtrlSetData($ingenflat1,"5")
            GUICtrlSetData($ingenflat2,"8")
            GUICtrlSetData($ingeneldn1,"9")
        EndIf
        ;its too low make it have little chance of going down until a certain hight is met
        ;this gives it a smaller chance to go back down until its high enough
        If $toolow = 1 and Random(GUICtrlRead($intoolowdnchance1),GUICtrlRead($intoolowdnchance2),1) = GUICtrlRead($intoolowdnchance1) Then $y = $y + GUICtrlRead($insteph)

        If $toolow = 0 Then $y = $y + GUICtrlRead($insteph)

        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0),$greenpen)
        _GDIPlus_GraphicsDrawLine($hwnd,$x,$bottom,$x,$y + Round($linewidth/2,0)+GUICtrlRead($indirtlayer),$brownpen)


    EndIf

    $counter = $counter + 1
    $x = $x + $linewidth
    If $x >= $winsize[2] then
    ;randomgenops()
    $x = Round($linewidth/2,0)
    $blackpen = _GDIPlus_PenCreate(0xFF000000,40)
    _GDIPlus_GraphicsDrawLine($hwnd,1,$bottom,1,1,$blackpen) ;get rid of land infront in the beginning
    $blackpen = _GDIPlus_PenCreate(0xFF000000,$linewidth)
    EndIf

Until GUIGetMsg() = $btngenerate
    GUICtrlSetData($statuslbl,"Generated!")
EndFunc

@H4CK3D,

You can uncomment line 178 (_ArrayDisplay($mapxy)) then run it in non infinite mode and it will give you coordinates to the top layer. I have been getting sidetracked about turning this into a game example but with those coords you can get something basic going.

Edited by TheGuardian

Share this post


Link to post
Share on other sites
enaiman

Well, I hope the attached pic will explain it better.

post-18882-0-74792200-1314055511_thumb.j


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
TheGuardian

Well, I hope the attached pic will explain it better.

post-18882-0-74792200-1314055511_thumb.j

Ahh, yes I see that now. Well I can work on smoothing it out a little. But lately I've been working on

getting it to generate 4 snapshots of the 800width generation and combining all of them into one BMP.

That can be made into a sprite and used to scroll across the screen in a game.

If you wanted to help improve the smoothing a bit I can give you a few tips on it.

1. You can use the XY coords that are generated with the generation.

2. Use those and have it determine nearby pixels.

3. Since it uses crappy gdi-lines your going to want to draw a blackline over the $x line and replace it with a new line with the new $y

I'll hop around to that but if you or anyone else wanted a project to do and offer your help, it would be cool.

heres what I've gotten it to do. (image) (i couldn't get forum to upload it ;/)

This is using Line size 25, dirt and step are 10.

http://dl.dropbox.com/u/24325730/Images/mainlevel.png

Edited by TheGuardian

Share this post


Link to post
Share on other sites
enaiman

I'm not interested in using it atm - I was just giving you an idea to improve that a little bit.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
TheGuardian

Oh, it's all good maybe when I'm in the mood to dive back in I can add some terrain smoothing, it's in my head I just don't feel like scripting it atm.

I've just been figuring out how I'm going to get collision and stuff like that for the game, never done a game before :/

___Mapping the terrain from a .BMP file.___

I have an idea of ditching the array that's initially created instead,

I can have it do some sort of pixel search line by line to determine the terrain

then from there it gets mapped into coords to use for collision.

Advantages of this could be making your own level with like paint or something and adding decorations and stuff and being able to share the map.

Disadvantages is that its a little more work, it can be glitchy if done wrong, and it may be a little slow as I know pixel searching is slow. (may be able to counter this)

Edited by TheGuardian

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×