tslusny Posted August 5, 2012 Author Share Posted August 5, 2012 So hey who ever wanted Instanced maps? This is almost completed base for that. I will update this post when i release some news for this or some new seeds etc. So lets go for tutorial:So first download attachment and add modSeeds and modMapGenerate to your Server project. As you can see, tileset used for this is number 42 so you can freely rename it but you must edit it later in modSeeds.I done this tutorial in rush to post all bugs you will found under this post**Screenshot of map generator in action**>! ![](http://i.imgur.com/LD6UG.png)**Screenshot of map generator utillity server side (its not main function i maked this utillity too for easy testing and map gnerating)**![](http://i.imgur.com/oGP4C.png)SERVER SIDE:**Form work****frmServer new tab:**```Caption: Map Generator```**New label:**```Caption: Map Generator Log```**New listbox:**```Name: ldung```**Add this item to list:**```******************Welcome in Deathbeams Map generator. Enjoy******************```**2 new labels:**```first caption: Seed numbersecond caption: Map number```**Under 2 labels 2 new textboxes:**```First Name:txtSeedNumSecond name:txtMapNum```**new Command button:**```Name:cmdGenerateCaption:Generate New Dungeon```**Source work****Add this into cmdGenerate:**```GenerateFromSeed Val(txtSeedNum.Text), Val(txtMapNum.Text)```**modtypes: at top add:**```Public Dungdata(1 To MAX_MAPS) As DungRec```**at bottom add:**```Public Type DungRec  x As Long  y As Long  DoorT As Long  DoorB As Long  DoorL As Long  DoorR As Long  DoorTDone As Boolean  DoorBDone As Boolean  DoorLDone As Boolean  DoorRDone As Boolean  totaldoors As Long  RoomDone As Boolean  RoomUsed As BooleanEnd Type```**Now find Public Type MapRec****At bottom of that type add:**```Seed As Long```**Now find:**```Sub SaveMap(ByVal MapNum As Long)```i**n that sub above this:**```Close #F```**add this:**```Put #F, , Map(MapNum).Seed```**Now find:**```Sub LoadMaps()```**in that sub above this:**```Close #F```**add this:**```Get #F, , Map(i).Seed```**Now find:**```Sub HandleMapData(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)```**in that sub above this:**```Call SendMapNpcsToMap(MapNum)```**add this:**```Map(MapNum).Seed = Buffer.ReadLong```**Now find:**```Public Sub MapCache_Create(ByVal MapNum As Long)```**in that sub above this:**```MapCache(MapNum).Data = Buffer.ToArray()```**add this:**```Buffer.WriteLong Map(MapNum).Seed```**Now find:**```Sub ServerLoop()```**in that sub above this:**```If Not CPSUnlock Then Sleep 1```**add this:**```' Randomly generates maps every 10 minutes - Can be tweaked    If Tick > MapGenTimer Then      For i = 1 To MAX_MAPS        If Map(i).Seed > 0 Then          GenerateFromSeed Map(i).Seed, i        End If      Next      MapGenTimer = GetTickCount + 600000    End If```CLIENT SIDE:**Form work****frmMapEditor_Properties new label:**```Caption: Map Seed```**New textbox:**```Name: txtMapSeed```**Source work****Now find**```.BossNpc = scrlBoss.value```**Under it add:**```.Seed = Val(txtMapSeed.Text)```**Now find Public Type MapRecAt bottom of that type add:**```Seed As Long```**Now find:**```Public Sub SendMap()```**in that sub above this:**```SendData Buffer.ToArray()```**add this:**```Buffer.WriteLong Map.Seed```**Now find:**```Public Sub SaveMap(ByVal MapNum As Long)```**in that sub above this:**```Close #f```**add this:**```Put #f, , Map.Seed```**Now find:**```Public Sub LoadMap(ByVal MapNum As Long)```**in that sub above this:**```Close #f```**add this:**```Get #f, , Map.Seed```**Now find:**```Public Sub MapEditorProperties()```**in that sub above this:**```' show the map npcs```**add this:**```.txtMapSeed.text = Map.Seed```**Now find:**```Sub HandleMapData(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)```**in that sub above this:**```ClearTempTile```**add this:**```Map.Seed = Buffer.ReadLong```And voila… Done Link to comment Share on other sites More sharing options...
clark Posted August 5, 2012 Share Posted August 5, 2012 Can i kiss you :O? Oh that's true i'm a boy … ^^ i will try this later actually it's 6:07 here lol !but anyways nice contribution !! Link to comment Share on other sites More sharing options...
tslusny Posted August 5, 2012 Author Share Posted August 5, 2012 @clark:> Can i kiss you :O? Oh that's true i'm a boy … ^^ i will try this later actually it's 6:07 here lol !> but anyways nice contribution !!:P Link to comment Share on other sites More sharing options...
hisherwin Posted August 5, 2012 Share Posted August 5, 2012 Can you show some screenshot of map that it generate? Link to comment Share on other sites More sharing options...
tslusny Posted August 5, 2012 Author Share Posted August 5, 2012 @Sherwin:> Can you show some screenshot of map that it generate?Yea updated main post Link to comment Share on other sites More sharing options...
Zopto Posted August 5, 2012 Share Posted August 5, 2012 death so this is somting like rendom dungeons(maps?) Link to comment Share on other sites More sharing options...
tslusny Posted August 5, 2012 Author Share Posted August 5, 2012 @Zopto:> death so this is somting like rendom dungeons(maps?)I used some subs from that and tileset too but no, this will generate only one map and you can choose Seed for map in map properties and if Map(MapNum).Seed is hightr than zero then every 10 minutes it will randomize that map with that seed Link to comment Share on other sites More sharing options...
Zopto Posted August 5, 2012 Share Posted August 5, 2012 hmmm nice i think i need this…one more question what will heppend if player is on map more then 10 min dose map going to chage?? Link to comment Share on other sites More sharing options...
tslusny Posted August 5, 2012 Author Share Posted August 5, 2012 @Zopto:> hmmm nice i think i need this…one more question what will heppend if player is on map more then 10 min dose map going to chage??Map just respawn and message will show: A new map layout has been generated Link to comment Share on other sites More sharing options...
Dawntide Posted August 5, 2012 Share Posted August 5, 2012 What is the sense behind this? It looks like it cant generate complex maps, so whats the point of a map with the ground layer filled with 1 tile? Link to comment Share on other sites More sharing options...
kibbelz Posted August 5, 2012 Share Posted August 5, 2012 Your missing sub GenerateFromSeed and the part where you declare MapGenTimer. Really you only have the packets done, form work and recs.~Kibbelz Link to comment Share on other sites More sharing options...
JohnPony Posted August 5, 2012 Share Posted August 5, 2012 This is not instanced maps, rather randomly generated maps.And this has already been done and released in the resource board. Link to comment Share on other sites More sharing options...
tslusny Posted August 6, 2012 Author Share Posted August 6, 2012 @kibbelz:> Your missing sub GenerateFromSeed and the part where you declare MapGenTimer. Really you only have the packets done, form work and recs.> > ~KibbelzEverything is in attachment omg and i rewrite tutorial becouse i made some mistakes in itOK Tutorial fixed Link to comment Share on other sites More sharing options...
kibbelz Posted August 6, 2012 Share Posted August 6, 2012 @Deathbeam:> Everything is in attachment omgYes NOW everything is in the attachment, considering it has no downloads and you just edited your original post. It was not there earlier. Link to comment Share on other sites More sharing options...
tslusny Posted August 7, 2012 Author Share Posted August 7, 2012 @kibbelz:> Yes NOW everything is in the attachment, considering it has no downloads and you just edited your original post. It was not there earlier.It was there earlier i just reuploaded fixed version when i said i fixed tut**And for everyone who wanna make Sandbox Eclipse game:** http://www.touchofdeathforums.com/smf2/index.php/topic,82167.0.html Link to comment Share on other sites More sharing options...
PVJsquad Posted August 7, 2012 Share Posted August 7, 2012 Variable not defined "MapGenTimer" Link to comment Share on other sites More sharing options...
tslusny Posted August 7, 2012 Author Share Posted August 7, 2012 @GoldSide:> Variable not defined "MapGenTimer"add it under other dims in sub serverloop at top: Dim MapGenTimer as Long Link to comment Share on other sites More sharing options...
Zopto Posted August 11, 2012 Share Posted August 11, 2012 did you going to add a option tfor party instance ? to just ppl who ar ein party can go in inctance? Link to comment Share on other sites More sharing options...
tslusny Posted August 13, 2012 Author Share Posted August 13, 2012 No not yet i dont have much time now im working on CS:DE gui for EN and on converting my game to EN and on Project sandbox etc Link to comment Share on other sites More sharing options...
Ganjika Posted November 20, 2012 Share Posted November 20, 2012 Ambigious named detected : Sub LoadMaps.(modDatabase)```Sub LoadMaps() Dim filename As String Dim i As Long Dim f As Long Dim x As Long Dim y As Long Call CheckMaps For i = 1 To MAX_MAPS filename = App.Path & "\data\maps\map" & i & ".dat" f = FreeFile Open filename For Binary As #f Get #f, , Map(i).Name Get #f, , Map(i).Music Get #f, , Map(i).Revision Get #f, , Map(i).Moral Get #f, , Map(i).Up Get #f, , Map(i).Down Get #f, , Map(i).Left Get #f, , Map(i).Right Get #f, , Map(i).BootMap Get #f, , Map(i).BootX Get #f, , Map(i).BootY Get #f, , Map(i).MaxX Get #f, , Map(i).MaxY ' have to set the tile() ReDim Map(i).Tile(0 To Map(i).MaxX, 0 To Map(i).MaxY) For x = 0 To Map(i).MaxX For y = 0 To Map(i).MaxY Get #f, , Map(i).Tile(x, y) Next Next For x = 1 To MAX_MAP_NPCS Get #f, , Map(i).Npc(x) MapNpc(i).Npc(x).Num = Map(i).Npc(x) Next Get #f, , Map(i).BossNpc [b]Sub LoadMaps()[/b] Get #f, , Map(i).Seed Close #f CacheResources i DoEvents NextEnd Sub``` Link to comment Share on other sites More sharing options...
Ertzel Posted November 20, 2012 Share Posted November 20, 2012 A few things.1) Your images fail at life and lead to dead links, may want to fix that in your main post.2) From what I can tell by looking over your code, this isn't instanced maps at all, it's as your title says: a Map Generator….(I haven't looked into the code to much so this question may not apply)3) When your map refreshes, you say it gives a message to those players that the map has refreshed. But as I assume these generated maps will have some blocked tiles (again, haven't tried it so if this is wrong, nvm), what if when the map re-generates the player is now stuck behind a blocked area? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now