Copying tiles from sheet
Copying tiles from sheet
Copying tiles from sheet
Copying tiles from sheet
Copying tiles from sheet
Copying tiles from sheet Copying tiles from sheet Copying tiles from sheet Copying tiles from sheet Copying tiles from sheet Copying tiles from sheet Copying tiles from sheet Copying tiles from sheet
Copying tiles from sheet Copying tiles from sheet
Copying tiles from sheet
Go Back  Xtreme Visual Basic Talk > > > Copying tiles from sheet


Reply
 
Thread Tools Display Modes
  #41  
Old 04-08-2012, 11:22 AM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default


I've had the chance to study that Serialization code
and it does dump the whole map array into a file.

The problem that i'm having with it is that i also want
to save 3 variables before saving the map array.

MapWidth, MapHeight, TotalLayers

It appears that i can save them just fine but i don't
know how to retrieve them.

Does serialization only allow for saving structured arrays
and that's it?

I'm saving the variables, like you did with the map array.

Code:
            formatter.Serialize(fs, MapWidth)    '------|
            formatter.Serialize(fs, MapHeight)   '       | - the variables
            formatter.Serialize(fs, TotalLayers)  '------|
            formatter.Serialize(fs, Map)
I'm probably even saving these wrong.

I kow i can save these in a different file but i was hoping
to save and load everything from one file.

Last edited by VB_Alien; 04-08-2012 at 11:45 AM.
Reply With Quote
  #42  
Old 04-08-2012, 12:26 PM
passel's Avatar
passelCopying tiles from sheet passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,024
Default

{edit: You posted while I was called away to lunch, so you've probably figured out some of the stuff below. I would have to investigate multiple outputs to a file, because I was thinking along the same lines as you.
But, in this particular case, as can seen below, the three items you want to save are related to the bounds of the three dimensional array, so you technically would not need to store them separately. Once you read the data back into the array, you can examine the bounds of the array to see what the bounds are, as I do in the Map_Load function.
Plus, I forgot to attach the project, which I'll do now.}

Yes, the second attachment works.
It didn't have the test maps though, which your previous attachment did, so I copied them over so had some pre-built maps to look at.

Well, it is up to you, but I don't know that using the BinaryFormatter is more complicated than what you are doing, just unfamiliar.

Perhaps seeing the basics in action in your own code, without the exception handling around it (which you should have for completeness, but is not absoulutely necessary assuming your code won't fail).

I'll attach the modified project, but a preview of writing and reading using your existing code I'll paste here.
Your Save_Map code:
Code:
    Private Sub Save_Map(ByVal File_Name As String)

    ' Error trap
    If File_Name = "" Then Exit Sub

    ' Access the Stream Writer
    Dim file As System.IO.StreamWriter


    ' If file does exist then delete it.
    If IO.File.Exists(File_Name) = True Then
      IO.File.Delete(File_Name)
    End If

    ' Open the file to be written to.
    file = My.Computer.FileSystem.OpenTextFileWriter(File_Name, True)

    ' Write the map width and height to file
    file.WriteLine(MapWidth)
    file.WriteLine(MapHeight)

    ' Save all the map data
    For w As Integer = 0 To MapWidth - 1
      For h As Integer = 0 To MapHeight - 1

        file.WriteLine(Map(w, h).DestX)
        file.WriteLine(Map(w, h).DestY)
        file.WriteLine(Map(w, h).SourceX)
        file.WriteLine(Map(w, h).SourceY)
        file.WriteLine(Map(w, h).PrevTileX)
        file.WriteLine(Map(w, h).PrevTileY)
        file.WriteLine(Map(w, h).Walkable)
        file.WriteLine(Map(w, h).Transparent)
        file.WriteLine(Map(w, h).Animated)
        file.WriteLine(Map(w, h).Animation_Direction)

      Next
    Next

    ' We are done writing, close the file.
    file.Close()

    File_Name = ""
    End Sub
becomes:
Code:
  Private Sub Save_Map(ByVal File_Name As String)

    ' Error trap
    If File_Name = "" Then Exit Sub

    Dim fs As New filestream(File_Name, FileMode.Create)
    Dim formatter As New BinaryFormatter

    formatter.Serialize(fs, Map)   'write the map to the file
    fs.Close()                     'close the file
  End Sub
The Load_Map routine:
Code:
  Private Sub Load_Map(ByVal File_Name As String)

    ' Error trap
        If File_Name = "" Then Exit Sub

    ' Access the Stream Reader
    Dim file As System.IO.StreamReader


    ' Open the file to be read from.
    file = My.Computer.FileSystem.OpenTextFileReader(File_Name)

    ' Get the map width & height from file
    MapWidth = file.ReadLine()
    MapHeight = file.ReadLine()

    ' Call sub that will redimension the map structure
    ReDimension_Map(MapWidth, MapHeight)

    ' Change picDest Width and Height
    picDest.Width = MapWidth * 32
    picDest.Height = MapHeight * 32

    ' Create the bitmap for picDest
    DestBmp = New Bitmap(MapWidth * 32, MapHeight * 32)
    picDest.Image = DestBmp  'Create a "back buffer" to hold the output map, which is displayed when picDest is Painted

    ' Read all the game data and populate
    ' the Game Map structure.
    For w As Integer = 0 To MapWidth - 1
      For h As Integer = 0 To MapHeight - 1

        Map(w, h).DestX = file.ReadLine()
        Map(w, h).DestY = file.ReadLine()
        Map(w, h).SourceX = file.ReadLine()
        Map(w, h).SourceY = file.ReadLine()
        Map(w, h).PrevTileX = file.ReadLine()
        Map(w, h).PrevTileY = file.ReadLine()
        Map(w, h).Walkable = file.ReadLine()
        Map(w, h).Transparent = file.ReadLine()
        Map(w, h).Animated = file.ReadLine()
        Map(w, h).Animation_Direction = file.ReadLine()

      Next
    Next

    ' We are done reading from the file, close it.
    file.Close()

    Draw_Map()

    File_Name = ""
  End Sub
becomes
Code:
  Private Sub Load_Map(ByVal File_Name As String)

    ' Error trap
    If File_Name = "" Then Exit Sub

    Dim fs As New FileStream(File_Name, FileMode.Open)
    Dim formatter As New BinaryFormatter

    Map = DirectCast(formatter.Deserialize(fs), GameMap(,))  'Map is automatically dimensioned properly here to match what was written
    fs.Close()

    MapWidth = UBound(Map, 1) + 1      'pull the width and height from the array dimensions, since you use them elsewhere
    MapHeight = UBound(Map, 2) + 1

    ' Change picDest Width and Height
    picDest.Width = MapWidth * 32
    picDest.Height = MapHeight * 32

    ' Create the bitmap for picDest
    DestBmp = New Bitmap(MapWidth * 32, MapHeight * 32)
    picDest.Image = DestBmp  'Create a "back buffer" to hold the output map, which is displayed when picDest is Painted

    Draw_Map()

    File_Name = ""    'I don't believe this is necessary
  End Sub
Essentially, the code does the same thing you're familiar with in VB6, the main difference is that VB6 hid the Serializer/DeSerializer and casting of the read data into the array.
So, don't let the new terms prevent you doing something simple, because it is unfamiliar.
Attached Files
File Type: zip Map Maker-Version 1p.zip (119.5 KB, 7 views)
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.

Last edited by passel; 04-08-2012 at 12:33 PM.
Reply With Quote
  #43  
Old 04-08-2012, 02:22 PM
hDC_0Copying tiles from sheet hDC_0 is offline
Contributor

* Expert *
 
Join Date: Feb 2004
Posts: 559
Default Re: new Map Maker-Version 1p.zip attachment

Quote:
Originally Posted by VB_Alien
That second attachment should work.
No. It does not.
Even the newest posted "Map Maker-Version 1p.zip" is still missing
the "basis.data" file (see attached screenshot#1).
This exception is thrown at runtime right after using
File menu > Load Tile Sheets, and selecting the default
"Basis.bmp" tile sheet.

Note: surfR2911's commenting-out "patch" instructions, though, still allow it to work.

Can you post the basis.data file as a zip?

In addition The "Map Maker-Version 1p.zip" is showing a new
serialization exception at runtime (see attached screenshot#2),
when attempting to use File menu > Load Map to load the "water.map".

Just in case anyone notices:
In screenshot 2, the "unused local variable" warning is referring to this line:
Code:
Dim file As System.IO.StreamReader '   "file" is highlighted with squiggly underlining
Although most .Net programmers probably choose to turn off
this annoying warning until all debugging is complete,
I found it helpful as a "clean up as you go" reminder..
Attached Images
File Type: jpg Basis_dot_data_still not found.JPG (166.3 KB, 5 views)
File Type: jpg serializationexception_upon_loading_water_map.JPG (137.9 KB, 5 views)

Last edited by hDC_0; 04-08-2012 at 03:27 PM.
Reply With Quote
  #44  
Old 04-08-2012, 07:27 PM
passel's Avatar
passelCopying tiles from sheet passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,024
Default

The basis.data file is in my zip, and in VB_Alien's last zip, which is the one I modified.
I just redownloaded my zip to check, and it is there.
Perhaps look at the zip in a zip extractor to see the file. I'm not sure how you can be loosing it.
I'm on a different machine now (was on a Windows 7-64 bit laptop).
Now I'm on an old XP laptop.
So, I extacted the zip, double clicked on the solution, and it brought up VB 2010 express on this machine (even though Visual Studio 2010 is installed, I guess I haven't changed the default association).
So I ran it and it worked fine.

The unused variable I wasn't worried about because I commented out a lot of the existing code, so an unused variable is not that unlikely.
Wanted to leave the existing code in place, but comment out, for comparison.
And I don't know if programmers turn off this warning, I don't, but I do just ignore them if I know the variable is just termporarily unused.
If permanently unused, then I remove them.

The map files without the "t" at the end of the name are the original map files created by the original code. The ones ending in "t" are the "binary" ones that work with my code.
I original changed the "Save" routine, used the old "Load" routine to load each of the four maps, and re-save in the "Binary" format (with the "t" added to the name).
I then changed the Load routine over to the Binary read.

I should have noted that in my post, and I thought there was more I wanted to post, and even considered just removing the old maps, but we had Easter guests in the house and my wife was calling to get me out of the basement, and I had already been called earlier to lunch, so rather than wait a few more hours, just sent it out "as is".

So, the exception is because you were trying to read the "text" based map file with the "binary" reader.
If I kept the exception handling in, then that would have trapped it, but at the time, since the previous post looked complicated, again I was paring it down to the essentials, without the protections that should be in place.

Let us know if you figure out why your run can't find the basis.data file, as I've now tried it on both Visual Studio 2010 and VB 2010 Express, without issue, and from the posted zip.
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #45  
Old 04-08-2012, 10:26 PM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default

I'm not sure yet but i may know why hDC is having
trouble finding the map file and maybe other stuff.

I noticed that when i go to the bin folder, i can't see
any of my map files either. When using my map maker,
the commondialog control sees it but to go to the bin
folder and look yourself, it's not there.

Anyway, i found the files in the bin folder by doing a
search of my laptop for *.map files. I pulled them out
that way and zipped them up for anyone having the same trouble.
Attached Files
File Type: zip Basis.zip (73.3 KB, 2 views)
Reply With Quote
  #46  
Old 04-08-2012, 10:56 PM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default

OK passel. That serialization save code works great.
It does save, load and then draw a map file. Best of
all, it dumps everything that is in the array, into a file,
at one time, instead of writing each and every property
of the structured array, one line at a time.

I was trying to think of a way to pull the "Mapwidth"
and "MapHeight" out of the array itself, and low and
behold, you have already done that for me. Thank-you.

I understand what your doing except for one part of it.

Your code is:
'pull the width and height from the array
' dimensions, since you use them elsewhere
MapWidth = UBound(Map, 1) + 1
MapHeight = UBound(Map, 2) + 1

Why is there a "+1" at the end? If the number
pulled was suppose to be 15, without adding
"+1", would that code only pull out the number 1?

Also, now that i added one more dimension to the
array - "TotalLayers" could i use this code to pull
it out?

TotalLayers = UBound(Map, 1) + 1 ' 1st dimension in the array
MapWidth = UBound(Map, 2) + 1 ' 2nd dimension in the array
MapHeight = UBound(Map, 3) + 1 ' 3rd dimension in the array

Thanks a lot for your help passel.
Reply With Quote
  #47  
Old 04-09-2012, 10:13 AM
passel's Avatar
passelCopying tiles from sheet passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,024
Default

UBound returns the UpperBound of that dimension of an array.
so if you have a map that is 15 tiles wide, the dimension of the array associated with width would be dimensioned (0 to 14).
All .Net arrays, unless forced with an odd syntax I'm not going to go into, start at 0.
So the LBound is 0, and the UBound is 14, but the Width (in this case) is 15 so, UBound + 1.

And, yes on the usage with 3 dimensions.

And, I assume when you say bin, you really mean bin/Debug
You run out of either bin/Debug or bin/Release, depending on the type of build you're doing.
Currently, you've been doing Debug builds, so Basis.Bmp and Basis.Data were under there. In post#37 you had maps, but were missing the "My Project" directory.
In post #39, the "My Project" directory was present, and in the "bin/Debug" directory the Basis.Bmp and Basis.Data were still there, but the maps were no longer there. You also left some of the support generated exe's there, but I let it slide.
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.

Last edited by passel; 04-09-2012 at 10:26 AM.
Reply With Quote
  #48  
Old 04-09-2012, 10:42 AM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default

Well. I guess this does work and it's correct:

TotalLayers = UBound(Map, 1) + 1 ' 1st dimension in the array
MapWidth = UBound(Map, 2) + 1 ' 2nd dimension in the array
MapHeight = UBound(Map, 3) + 1 ' 3rd dimension in the array

and i figured out what the "+ 1" is for.

Ubound gets the correct, lets say, the TotalLayers number. In
my code, lets say TotalLayers = 4, ok?

But since array's start at the number 0 and count up from
there, TotalLayers would really be 5, unless i put a minus
1 behind TotalLayers.

TotalLayers = 4 ' 0, 1, 2, 3, 4 - this is 5 layers

Redim TotalLayers - 1 = 0, 1 , 2, 3, which equals 4 layers
in my program.

Adding "+ 1" to TotalLayers was for the benefit of my
program, so that i wouldn't have to change all my code.

Ubound still pulls out the correct amount of layer numbers
but TotalLayers is always one number more than that.

That is why the "+ 1" was added to UBound.

Thank-you passel. I'm learning more every day.


I suppose, it would be better if i just put in the real
number of layers. If i wanted 3 layers, then my number
of layers in TotalLayers should be 2. ' 0, 1, 2.

I don't know if adding 1 number less or adding 1 number
more, really makes a difference though.

I suppose i could Redim my array by doing this:
Redim Map(1 to TotalLayers, 1 to MapWidth, 1 to MapHeight)

By doing it this way, i get rid of the array starting at 0.
Reply With Quote
  #49  
Old 04-09-2012, 10:51 AM
passel's Avatar
passelCopying tiles from sheet passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,024
Default

Note, since we overlapped posts, that you can't Redim (1 to something) in .Net.
All arrays start at 0.
Normally, TotalLayers, mapWidth, and MapHeight would be set to what they are, and the arrays would be dimensioned to -1.
Redim Map (TotalLayers-1, MapWidth-1, MapHeight - 1)
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #50  
Old 04-09-2012, 11:31 AM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default

OK. Thanks for that information about arrays. I guess
that VB6 and VB 2010 are a bit different now. Every
array starts at 0 now, no exceptions.

I still don't understand what to take out of VB files before
i can post my projects.

I thought that EXE's and Dll's were the only things that needed
to be removed.

Is there a list that i could review that spells out what to remove
from VB 2010 project files? Honestly, i'm not leaving unwanted
files in the folders, on purpose. I really don't understand what
to take out. I just now, figure out that i can see every file and folder
in the solution explorer by clicking on "Show All Files". Maybe you
could give me a list of stuff that doesn't get zipped when posting
projects here.

As for the Basis.data and map files, i don't understand where they are
going to. Even in my folders, the map files seem to disappear. I can
only find them by doing a system search for *.map files and them copy
them from there to somewhere else.

Did you do a search in the bin/debug folder, to see if the map files are there?
I don't think i deleted them, either time that i post my project here.

When i run my program and use the common dialog to open a map file,
it shows up as being there but when i physically go to the debug folder,
they aren't there. Now i'm really wondering what is going on here.
Reply With Quote
  #51  
Old 04-09-2012, 12:46 PM
passel's Avatar
passelCopying tiles from sheet passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,024
Default

Well, I don't know either.
I just look at the contents of the zip file.
For instance, I've just downloaded the two zip files again, and did an "Extract All..." (from right clicking on the file) on each in a tmp directory.
I then open a cmd window in the directory and do a "tree /f" to get a tree of the directory with files.
Code:
C:\Work\vbforum\VB_Alien\tmp\MapMaker  Version 1>tree /f
Folder PATH listing for volume LatitudeD630.XP
Volume serial number is xxxxxxxxxxxxx
C:.
└───Map Maker-Version 1
    │   MapMaker.sln
    │
    └───MapMaker
        │   frmChipset.Designer.vb
        │   frmChipset.resx
        │   frmChipset.vb
        │   frmMain.Designer.vb
        │   frmMain.resx
        │   frmMain.vb
        │   frmNewMap.Designer.vb
        │   frmNewMap.resx
        │   frmNewMap.vb
        │   MapMaker.vbproj
        │   MapMaker.vbproj.user
        │
        └───bin
            ├───Debug
            │       Basis.bmp
            │       Basis.data
            │       Test1.map
            │       Test2.map
            │       Test3.map
            │       Water.map
            │
            └───Release
That is from the zip in post #37, and it is missing the "My Projects" directory, but has the maps, and the Basis.* files.
It also doesn't have any executable obj type files (.exe, .o, .ocx, .dll, etc...)
You've deleted the obj directory and only kept the files you've added to the bin/Debug directory, which is good.

The zip file in post #39 tree looks like:
Code:
C:\Work\vbforum\VB_Alien\tmp\Map Maker-Version 1>tree /f
Folder PATH listing for volume LatitudeD630.XP
Volume serial number is xxxxxxxxx
C:.
└───Map Maker-Version 1
    │   MapMaker.sln
    │
    └───MapMaker
        │   frmChipset.Designer.vb
        │   frmChipset.resx
        │   frmChipset.vb
        │   frmMain.Designer.vb
        │   frmMain.resx
        │   frmMain.vb
        │   frmNewMap.Designer.vb
        │   frmNewMap.resx
        │   frmNewMap.vb
        │   MapMaker.vbproj
        │   MapMaker.vbproj.user
        │
        ├───bin
        │   ├───Debug
        │   │       Basis.bmp
        │   │       Basis.data
        │   │       MapMaker.pdb
        │   │       MapMaker.vshost.exe
        │   │       MapMaker.vshost.exe.manifest
        │   │       MapMaker.xml
        │   │       WindowsApplication1.pdb
        │   │       WindowsApplication1.vshost.exe
        │   │       WindowsApplication1.vshost.exe.manifest
        │   │       WindowsApplication1.xml
        │   │
        │   └───Release
        ├───My Project
        │       Application.Designer.vb
        │       Application.myapp
        │       AssemblyInfo.vb
        │       Resources.Designer.vb
        │       Resources.resx
        │       Settings.Designer.vb
        │       Settings.settings
        │
        └───obj
            └───x86
                └───Debug
                    │   DesignTimeResolveAssemblyReferences.cache
                    │   DesignTimeResolveAssemblyReferencesInput.cache
                    │   GenerateResource.read.1.tlog
                    │   GenerateResource.write.1.tlog
                    │   MapMaker.pdb
                    │   MapMaker.vbproj.FileListAbsolute.txt
                    │   MapMaker.xml
                    │   WindowsApplication1.frmChipset.resources
                    │   WindowsApplication1.frmMain.resources
                    │   WindowsApplication1.frmNewMap.resources
                    │   WindowsApplication1.pdb
                    │   WindowsApplication1.Resources.resources
                    │   WindowsApplication1.vbproj.FileListAbsolute.txt
                    │   WindowsApplication1.xml
                    │
                    └───TempPE
So, now you have the "My Project" directory, but you also have the .obj directory (but the .exes seem to have been removed from the obj directory, but I usually just delete the obj directory, so prune that branch off the tree).
But, the main issue is the bin/Debug directory still has a lot of files that you didn't add, and a number of them are an exe object format file of one type or another.
You should have kept the Basis.bmp and Basis.data files since they are needed, but got rid of the rest.
And since this version (at least for me) ran, it would have been convenient for you to have left those test maps in the bin/Debug directory as well.
But since I knew they were in the previous zip, I just copied them over into this tree.
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #52  
Old 04-09-2012, 05:43 PM
hDC_0Copying tiles from sheet hDC_0 is offline
Contributor

* Expert *
 
Join Date: Feb 2004
Posts: 559
Default File-I/O and app pathing intricacies crop up..

Quote:
Originally Posted by VB_Alien
I noticed that when i go to the bin folder, i can't see
any of my map files either.
When using my map maker,
the commondialog control sees it but to go to the bin folder and look yourself, it's not there.
Interesting..

Looking closer at the code I would suggest using some kind of VB.Net code
which acts something like VB6's App.path.

I found this thread which mentions:
System.IO.Directory.GetCurrentDirectory (can change though..)
Application.StartupPath

I have also seen
Quote:
AppDomain.CurrentDomain.BaseDirectory
Environment.CurrentDirectory
System.Reflection.Assembly.GetExecutingAssembly().CodeBase
Return System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutin gAssembly().GetName().CodeBase
and the one I used most recently was:
Quote:
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutin gAssembly().Location())
I think you can create a "Data" folder at runtime with something like:
Code:
    Dim szTmpPath As String = System.IO.Path.Combine(Application.StartupPath, "Data")
    Dim dirInfo As New System.IO.DirectoryInfo(szTmpPath)
    '   if folder not exist, create
    If Not dirInfo.Exists Then dirInfo.Create()
In any case I think retrieving the path of the .exe file would be helpful so that
any sub-paths (folders) can be clearly/cleanly designated in the code.

Looking at the "1p" code it looks like "Path_to_Structure_Data" is being set by "ChangeString(filename)"
where "filename" is assigned: "CMD1.FileName",
in "mnuLoadTileSheets_Click", but there is
no code for specifically identifying/finding the application's pathing.

So I think retrieving the path of the .exe file would be helpful so that any sub-paths (data folders) can be clearly/cleanly designated in the code..
perhaps before calling the openfile dialog
set a filter which explicitly designates the application path using the FileDialog.InitialDirectory Property.
Quote:
Originally Posted by passel
The map files without the "t" at the end of the name are the original map files created by the original code. The ones ending in "t" are the "binary" ones that work with my code.
I original changed the "Save" routine, used the old "Load" routine to load each of the four maps, and re-save in the "Binary" format (with the "t" added to the name).
I then changed the Load routine over to the Binary read.

I should have noted that in my post..
So, the exception is because you were trying to read the "text" based map file with the "binary" reader.
Yes. That was what was generating the exception.

I don't know if both text based map files as well as binary based map files
are going to be supported in parallel
(as the project continues to evolve),
but if that is the design decision then
separate load and save menu items for each map file type
might be prudent.

Last edited by hDC_0; 04-09-2012 at 05:59 PM.
Reply With Quote
  #53  
Old 04-09-2012, 06:37 PM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default

So, what you are saying then,is to delete everything
in the bin\debug folder, except for the Basis.bmp.
Basis.data and any map files that i create. Then i
just delete the Obj folder completely. I'm i correct?

Oh! And the MyProject folder. Can i leave everything
in the folder?

Last edited by VB_Alien; 04-09-2012 at 07:12 PM.
Reply With Quote
  #54  
Old 04-09-2012, 06:45 PM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default

Honestly, i don't know what happened with the
Basis.bmp, Basis.data and the map files.

I could have sworn that i left all of those in place.

All i can say now, is to make your own map files
and see how it works.

I've been playing around with the gamedata structure
by adding stuff to it, creating a map with that structure
and when i didn't get the results that i wanted, i removed
anything that i recently added from the structure. If you
did happen to get a map file and it won't load, that is the
reason why.

I hope the map files that i uploaded still work in the first version.
Reply With Quote
  #55  
Old 04-10-2012, 03:45 AM
surfR2911 surfR2911 is offline
Contributor
 
Join Date: Oct 2009
Posts: 719
Default stuff to leave in place when uploading future versions of map editor..

Quote:
So, what you are saying then,is to delete everything
in the bin\debug folder, except for the Basis.bmp.
Basis.data and any map files that i create. Then i
just delete the Obj folder completely. I'm i correct?

Oh! And the MyProject folder. Can i leave everything
in the folder?
Yes. This is correct.

Quote:
If you did happen to get a map file and it won't load, that is the reason why.
So you are not planning to support both
text and binary map data file formats in the future (as the map editor evolves)?
Reply With Quote
  #56  
Old 04-10-2012, 12:17 PM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default

No. My plan from the beginning was to save and load
the maps in binary format. I only saved in a text format
because i didn't know how to use the new binary step up
in VB 10.

From know on, everything will be saved in binary.

I only posted my project, so that passel could do a review
of it. It wasn't meant to be downloaded as a usable program.

As for missing map files, i finally figured out what happened,
do to a suggestion of yours surf. I found out that i was saving
my map files in another folder in another version of my map
maker. I took your suggestion a set the initial directory in the
common dialog control and now i don't have that problem any
more. I should have done that in the beginning but i got lazy.

Once i get a problem resolved, that i'm having right now, i'll post
another version of my program for passels review.

Passel:

If you can, could you just delete my other attachments. They are
causing more trouble than they are worth.

Thank-you
Reply With Quote
  #57  
Old 05-05-2012, 10:31 PM
surfR2911 surfR2911 is offline
Contributor
 
Join Date: Oct 2009
Posts: 719
Default Time marches on...

Hopefully VB_Alien hasn't forgotten about this thread, while he has been distracted by the "Which database to use" thread.

To extent the lifetime of this thread a little further I've decided to post a little revision
to VB_Alien's original MapMaker (which doesn't exist anymore because passel deleted it).

The old version required many steps by the user to get to the point where you could actually edit the map.
This revision auto-maps things a little including being able to right click on a
source tile and have the FillMapWithTile function be available via a right click menu.

Since the CreateMap function is automated it also gets rid of having
the startup map present a half tile issue at the bottom.

Oh and you can probably see from the screenshot I added some
branded graphics (had to dump the splitter panel setup to do so however..)

This was all done to try and encourage VB_Alien to keep going and evolve this tool into a playable VB.Net rpg.
Attached Images
File Type: jpg screenshotVB_Alien_MapMaker_rev_1-dot_1.JPG (67.3 KB, 11 views)
Attached Files
File Type: zip VB_Alien_MapMaker-rev_1_dot_1.zip (771.6 KB, 8 views)
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Copying tiles from sheet
Copying tiles from sheet
Copying tiles from sheet Copying tiles from sheet
Copying tiles from sheet
Copying tiles from sheet
Copying tiles from sheet Copying tiles from sheet Copying tiles from sheet Copying tiles from sheet Copying tiles from sheet Copying tiles from sheet Copying tiles from sheet
Copying tiles from sheet
Copying tiles from sheet
 
Copying tiles from sheet
Copying tiles from sheet
 
-->