Author Topic: Is there any way to merge or copy between two maps?  (Read 4235 times)

arcus

  • Visitor
  • *
  • Posts: 8
    • View Profile
Is there any way to merge or copy between two maps?
« on: 2006-01-05, 12:30:47 AM »
hi, all
I created two games by sgdk, is there any way to merge the two maps into one? Or can I copy one map's layer into another?

Any help and suggestion will be welcome!

Frank

billybob884

  • Contributor
  • Fanatic
  • **
  • Posts: 355
    • AOL Instant Messenger - billybob884
    • View Profile
Re: Is there any way to merge or copy between two maps?
« Reply #1 on: 2006-01-05, 04:58:13 AM »
there may actually be some complex way to do this by editing the two maps as text files, but as far as within the builder, no, there is no way that i know of
"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." :: Hitchhiker's Guide to the Galaxy

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Is there any way to merge or copy between two maps?
« Reply #2 on: 2006-01-05, 07:18:03 AM »
This would be pretty strightforward using a design-time script.  I don't know if you're all aware that GameDev can use scripting not only at runtime but also at design time, like in the map editor.  The sample game that comes with GameDev (with the wizards in the dungeon) has an editing script that gets connected if you choose the "Edit Dungeon Project" shortcut from GameDev's program menu (in the start menu).  It handles automatically filling in the torches and tops of walls.  You just draw the walls on the main layer, and then press "F" to fill the currently visible area of the screen with the wall tops that match the walls you've drawn.  Or press "A" to full the entire map with the wall tops.  You could do something similar to copy tiles from another layer in another map.  Look at the DngnEdit.vbs file to see how this was done.

I believe GameDev 1.4.6 was delivered with a GameDev.vbs file, which contains default script that will connect whenever you use the map editor with any project.  You could add some modifications to this file if that's working.  Or you could copy MapEdit.vbs, a template for designing your own map editing script.

If you need to get the map into the project, you might be able to do it by just creating a similar blank map in your project, then exit GameDev, delete the file containing the blank map and copy your other map file in it's place.  Next time you load the project it will hopefully pick up the map file you copied.  You should probably make sure you have all your project files backed up before you try this.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Is there any way to merge or copy between two maps?
« Reply #3 on: 2006-01-05, 07:29:23 AM »
Oh, also, if you really want to copy a whole layer from one map to another without scripting, you should be able (as billybob hinted) to do that by editing an XML exported version of the projects...
1. Create a new map/layer in project A that will contain the copied layer data.  Make sure it is the same size and uses the same tileset.
2. Export Project A as XML
3. Export Project B as XML
4. Open the XML file fro Project B and search for an XML tag representing the beginning of the map from which you want to copy a layer of tiles (keep in mind, this will not copy sprites or special functions)
5. There should be big blocks of text in here somewhere.  These represent the layers.  Find the beginning of a big block of text and the lat XML tag right before the block begins should indicate the beginning of the layer tile data (I don't remember the name off the top of my head).  Copy the beginning tag, the whole block of text and the ending tag.
6. Open the Project A XML file in notepad.  You should find a similar block in there, except the block of text will probably be just a bunch of "A" characters if the layer is empty.  Replace that block with the block you copied from project B.
7. Save the Project A XML file
8. Import the XML back into GameDev and see if your layer got copied.

If you need more details on searching through the XML and locating your layer data, let me know.  I'll actually try the process myself.  What I've described above is just off the top of my head.

cbass

  • Expert
  • Regular
  • *****
  • Posts: 97
  • script this
    • View Profile
    • Squest RPG
Re: Is there any way to merge or copy between two maps?
« Reply #4 on: 2006-01-05, 10:03:18 PM »
As we are on the subject of XML, I will hijack the post  ;)

Is there no way to edit path's that are already made?  I see we can change the relative position of the paths, and add delays.  But i couldn't find a way in the IDE to: add points, change relative positions between points.  I remember trying to find a way one time, but I ended up editing an XML of the project.

I guess its easy enough to delete paths and recreate them again, but if someone wants the path points to line up better, like perfect 45,90 degree angles, or make certain points sit perfectly on a tile, eyeballing it in the map editor is difficult. :)

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Editing path points
« Reply #5 on: 2006-01-06, 05:57:28 AM »
Maybe I was lazy, but I didn't want to try to figure out the most useful way for someone to be able to edit path points and create a whole new interface for it (or clutter up the existing interface which is already too confusing).  But that's what design-time script is for.  "Someone" (hint hint :)) could probably create a design time script that, for example, latches the nearest path point onto the mouse pointer when you press "P", and releases it when you press "P" again.  But otherwise, right now the easiest way to edit individual path points is to edit the XML or re-create the path.

billybob884

  • Contributor
  • Fanatic
  • **
  • Posts: 355
    • AOL Instant Messenger - billybob884
    • View Profile
Re: Is there any way to merge or copy between two maps?
« Reply #6 on: 2006-01-09, 01:28:26 PM »
...so? im curious now, how has it worked out for you? any luck with either method mentioned?
"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." :: Hitchhiker's Guide to the Galaxy

cbass

  • Expert
  • Regular
  • *****
  • Posts: 97
  • script this
    • View Profile
    • Squest RPG
Re: Is there any way to merge or copy between two maps?
« Reply #7 on: 2006-01-09, 07:06:42 PM »
I haven't tried it myself yet, but I am 100% certain it will work.  Most likely it would be a simple cut and paste, but if that doesn't work due to either layer numbering or sprite templates or special functions getting in the way,, either me or bluemonk could figure it out and reimport the xml's into a working project.

If you are having trouble arcus, feel free to attach your project.