Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: 1 2 3 [4] 5 6   Go Down

Author Topic: [Program] GMare (Game Maker Alternative Room Editor)  (Read 38541 times)

0 Members and 1 Guest are viewing this topic.
Re: [Screens]GMare (Game Maker Alternative Room ...
« Reply #60 on: February 06, 2011, 07:41:36 am »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Posts: 728
Hmmmm, been messing with the binary file that GMare exports. I was wondering how I was going to use the creation code part of the instances. Since instances have no way of setting the creation code. I sort of have a hackish way of executing the code, but it doesn't mimic the behavior of native instance creation code. The code is executed right AFTER the the instance's create event. Which for me, is just fine, but it might not be for everyone else. Any solutions welcomed. Any who, I pretty much have that done. As well as a some sample projects on how to load a GMare .bin file.

The binary file load script: (Pretty straight forward)

Code: [Select]
//-----------------------------------------------------------------------------
// A standard room load from a GMare .bin file.
//-----------------------------------------------------------------------------

_file = argument0;        // STRING: The GMare .bin file path.
_room = argument1;        // STRING: The name of the room to load.
_background = argument2;  // REAL:   The background to use for the room.

// If the file does not exist, exit.
if (!file_exists(_file))
{
    // Show error.
    show_message("ERROR: The GMare binary file: " + _file + " does not exist.");
    exit;
}

// Open the .bin file to read.
_stream = file_bin_open(_file, 0);

// The GMare binary file magic number.
_magic_number = "";

// Read four character bytes.
repeat (4)
{
    _magic_number += chr(file_bin_read_byte(_stream));
}
   
// If not a valid GMare binary file, exit.
if (_magic_number != "GBIN")
{
    // Show error, close file stream.
    show_message("ERROR: The file is not a valid GMare .bin file.");
    file_bin_close(_stream);
    exit;
}

// The offset to the actual room data beyond the header.
_data_offset = -1;

// The amount of rooms in the file.
_room_count = scr_read_bytes(_stream, 2, true);

// Iterate through rooms in the GMare binary file header.
repeat (_room_count)
{
    // Read room name.
    _search = scr_read_string(_stream, 1);

    // Read the room data offset.
    _offset =  scr_read_bytes(_stream, 4, true);
   
    // If the search string matches the desired room string.
    if (_search == _room)
    {
        // Set data offset, and break loop.
        _data_offset = _offset;
        break;
    }
}

// If the desired room was not found, exit.
if (_data_offset == -1)
{
    // Show error, close file stream.
    show_message("ERROR: The room: " + _room + " was not found.");
    file_bin_close(_stream);
    exit;
}

// Seek, to the desired room data.
file_bin_seek(_stream, _data_offset);

// Room data:
_columns = scr_read_bytes(_stream, 2, true);          // The number of tile columns in the room.
_rows = scr_read_bytes(_stream, 2, true);             // The number of tile rows in the room.
_tile_offset_x = file_bin_read_byte(_stream);         // the horizontal tile offset of the background.
_tile_offset_y = file_bin_read_byte(_stream);         // The vertical tile offset of the background.
_tile_separation_x = file_bin_read_byte(_stream);     // The horizontal separation of the background.
_tile_separation_y = file_bin_read_byte(_stream);     // The vertical separation of the background.
_tile_width = file_bin_read_byte(_stream);            // Width of a single tile in the background.
_tile_height = file_bin_read_byte(_stream);           // Height of a single tile in the background.
_tile_columns = scr_read_bytes(_stream, 2, true);     // The number of coulmns of the background.
_layer_count = scr_read_bytes(_stream, 4, true);      // The number of layers in the room.     
_instance_count = scr_read_bytes(_stream, 4, true);   // The number of instances in the room.
_collision_count = scr_read_bytes(_stream, 4, true);  // The number of collisions in the room.
   
// Iterate through layers.
repeat (_layer_count)
{
    // Get layer depth.
    _layer_depth = scr_read_bytes(_stream, 4, true);

    // If the layer uses the sector method, instead of the tile method.
    if (file_bin_read_byte(_stream) == 0)
    {
        // Iterate through rows.
        for (_row = 0; _row < _rows; _row += 1)
        {
            // Iterate through columns.
            for (_column = 0; _column < _columns; _column += 1)
            {
                // Get source tile id from file.
                _tile_id = scr_read_bytes(_stream, 2, true);

                // Calculate tile destination position.
                _dest_x = _column * _tile_width + _tile_offset_x;
                _dest_y = _row * _tile_height + _tile_offset_y;

                // If the tile id is not empty.
                if (_tile_id != -1)
                {
                    // Calculate tile source position.
                    _src_x = (_tile_id - (floor(_tile_id / _tile_columns)) * _tile_columns) * _tile_width;
                    _src_y = floor(_tile_id / _tile_columns) * _tile_height;

                    // Adjust with tile offsets and separations.
                    _src_x += (floor(_src_x / _tile_width) * _tile_separation_x) + _tile_offset_x;
                    _src_y += (floor(_src_y / _tile_height) * _tile_separation_y) + _tile_offset_y;
                   
                    // Add tile to room.
                    tile_add(_background, _src_x, _src_y, _tile_width, _tile_height, _dest_x, _dest_y, _layer_depth);
                }
            }
        }
    }
    else  // Tile mode.
    {
        // The number of tiles in tile mode.
        _tile_count = scr_read_bytes(_stream, 4, true);
       
        // Iterate through tiles.
        repeat (_tile_count)
        {
            // Get source tile id from file.
            _tile_id = scr_read_bytes(_stream, 2, true);
           
            // Read destination position.
            _dest_x = scr_read_bytes(_stream, 4, true);
            _dest_y = scr_read_bytes(_stream, 4, true);
           
            // Calculate tile source position.
            _src_x = (_tile_id - (floor(_tile_id / _tile_columns)) * _tile_columns) * _tile_width;
            _src_y = floor(_tile_id / _tile_columns) * _tile_height;

            // Adjust with tile offsets and separations.
            _src_x += (floor(_src_x / _tile_width) * _tile_separation_x) + _tile_offset_x;
            _src_y += (floor(_src_y / _tile_height) * _tile_separation_y) + _tile_offset_y;
                   
            // Add tile to room.
            tile_add(_background, _src_x, _src_y, _tile_width, _tile_height, _dest_x, _dest_y, _layer_depth);
        }
    }
}

// Iterate through instances.
repeat (_instance_count)
{
    _object = scr_read_bytes(_stream, 4, true);  // Instance object id.
    _x = scr_read_bytes(_stream, 4, true);       // Horizontal coordinate.
    _y = scr_read_bytes(_stream, 4, true);       // Vertical coordinate.
    _code = scr_read_string(_stream, 4);         // Instance creation code.

    // If the object does not exist.
    if (object_exists(_object) == false)
    {
        // Show error, continue.
        show_message("ERROR: The object with id: " + _object + " does not exist.");
        continue;
    }

    // Create a new instance of the object.
    _inst = instance_create(_x, _y, _object);
   
    // If there is creation code, execute it.
    if (_code != "")
    {
        // A heck to make sure the code executes within the instance.
        // Problem being is this executes after the creation event.
        // Solution is needed to emulate native behavior.
        _code = string_insert("with (_inst) {", _code, 1);
        _code = string_insert("}", _code, string_length(_code));
        execute_string(_code);
    }
}

// Close file stream.
file_bin_close(_stream);

In the WIP, I use a script within GMare to move the selected shrub to the left.
Logged
  • Pyxosoft
Re: [Screens]GMare (Game Maker Alternative Room ...
« Reply #61 on: February 06, 2011, 10:44:54 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Posts: 728
An alpha release has been uploaded: http://gmare.codeplex.com/
Also the source is available for download.

For a list of bugs, use GMare's codeplex space and click the issue tracker tab. Report them as well, it'd be nice. :)
The release also includes an example GM project.
Logged
  • Pyxosoft

Mamoruanime

@Mamoruanime
Re: [Screens]GMare (Game Maker Alternative Room ...
« Reply #62 on: February 07, 2011, 12:39:30 am »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
It crashes on room creation for me :( I think that's always been the case with GMare and me though XD

One feature that would be particularly awesome to have (but not so much useful for the GM side of it D: ) is the ability to customize what the exporter saves per-tile... Like for example, lets say there's an option that says "Change Tile Fields", it'll let me add whatever I want (along with default values), and set them individually in the map editor. This would primarily benefit other game dev tools because then you can set collision data, palette values (RGB ftw), and other stuff right from the editor.
Logged
Re: [Screens]GMare (Game Maker Alternative Room ...
« Reply #63 on: February 07, 2011, 12:47:04 am »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Posts: 728
I see what you mean. I will come up with something. Is there anyway you can run the source to see what the problem is? Or if there is any information at all about the crash?
Logged
  • Pyxosoft

Mamoruanime

@Mamoruanime
Re: [Screens]GMare (Game Maker Alternative Room ...
« Reply #64 on: February 07, 2011, 01:52:27 am »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
It's the exact same error I used to get, but lemme see what I can pull :P

I'll edit this with stuffs

EDIT: Here's the dump from JIT; not really sure how useful it is but *shrugs*. I'll keep digging :p
Quote
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at GMare.Forms.RoomForm.tsb_Ok_Click(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3615 (GDR.050727-3600)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
GMare
    Assembly Version: 1.0.0.0
    Win32 Version: 0.1.0.0
    CodeBase: file:///C:/DOCUME~1/ADMIN/LOCALS~1/Temp/Rar$EX00.202/Release/GMare.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3614 (GDR.050727-3600)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.


« Last Edit: February 07, 2011, 01:59:34 am by Mamoruアニメ »
Logged
Re: [Screens]GMare (Game Maker Alternative Room ...
« Reply #65 on: February 07, 2011, 01:57:15 am »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Posts: 728
That would be awesome.
Logged
  • Pyxosoft
Re: [Screens]GMare (Game Maker Alternative Room ...
« Reply #66 on: February 07, 2011, 02:52:34 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Posts: 61
Wow, that's great. Finally a release!
This seems to be an awesome room editor. I haven't figured out, how to use the created rooms in GM Projects yet (I can't open the example GM project because I only have GM7), but once I do, I'm sure this will make room creating much easier.

I love the features like flood fill tiling, moving tiles around and collisions on different layers.

I found some bugs, too:

When I select Edit Mode Collisions and try to place collisions they always appear at 0,0. I can move them around, but it's still very annoying.

Another, really minor one: When you use the Selection tool for tiles and start a selection at the bottom right corner of the area which you want to select, and then move the mouse to the top left corner, the grid inside the selection is supposed to dissapear. Instead it removes the grid starting at the bottom right corner and moving further right and down.
Hope that wasn't too confusing. I added a screenshot to show what I mean.
Logged
Re: [Screens]GMare (Game Maker Alternative Room ...
« Reply #67 on: February 07, 2011, 09:31:57 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Posts: 728
Sorry the collision editor is not done in this version of GMare. This is noted under the download description on codeplex. Mainly I didn't implement it because I wanted a clear path on what the collisions could be used as. As in, do I use it for just points, or maybe a line list for line collisions? Or some other idea that may be nice for users.

Thank you for reporting the bug! For anymore bugs, gmare @ codeplex has an issue tracker, (which I already put a bunch of bugs to fix in there) so that you can see what bugs have already been reported. GMare also has a fill option for a selection after you make one. This is handy to fill a room with the selection copy. I forgot to mention it.

EDIT: I will eventually make a GM7 version of the binary importer. Exporting to a GM project is fairly straight forward.

Also mammy, I just found a bug on room creation. Try changing the room size to something other than the default.  I missed a null reference check on if the room has changed. Which will force another version to be uploaded.
« Last Edit: February 07, 2011, 09:51:33 pm by Xfixium »
Logged
  • Pyxosoft
Re: [Screens]GMare (Game Maker Alternative Room ...
« Reply #68 on: February 10, 2011, 05:17:27 am »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Posts: 728
An updated version of GMare has been uploaded. http://gmare.codeplex.com/
Logged
  • Pyxosoft

Mamoruanime

@Mamoruanime
Re: [Screens]GMare (Game Maker Alternative Room ...
« Reply #69 on: February 10, 2011, 05:25:40 am »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
Works great now :D Pretty sweet. Like I said, I'd probably use this for all of my projects if there were an option to add custom values to tiles (namely Surface; which requires pixel information per tile D:). Very awesome stuff :D

Probably my favorite feature so far is being able to change the grid size without messing with actual placement. Comes in handy :D
Logged
Re: [Screens]GMare (Game Maker Alternative Room ...
« Reply #70 on: February 10, 2011, 05:31:44 am »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Posts: 728
Cool, thought for sure it was going to crash on ya. :P Yeah, we will have to collaborate a bit further on what your looking for. Maybe some custom user variables per tile? That would change things a bit, but I sort of anticipated it.
Logged
  • Pyxosoft

Mamoruanime

@Mamoruanime
Re: [Screens]GMare (Game Maker Alternative Room ...
« Reply #71 on: February 10, 2011, 05:37:52 am »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
Cool, thought for sure it was going to crash on ya. :P Yeah, we will have to collaborate a bit further on what your looking for. Maybe some custom user variables per tile? That would change things a bit, but I sort of anticipated it.
Yeah that would be awesome; really you'd just have to add a few things to the header; something like 'custom variable count' 'custom variable name (index)' (maybe even 'custom variable type (index)' too), then for each tile depending on that have it write the values. Shouldn't require too much work in the long run ;3
Logged
Re: [Program]GMare (Game Maker Alternative Room ...
« Reply #72 on: February 24, 2011, 06:06:23 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 160
I tried to export to GM8 and i'm not sure what to expect , the tiles don't appear in the room .
Logged
Nubcake now uses Purebasic!
Re: [Program]GMare (Game Maker Alternative Room ...
« Reply #73 on: February 25, 2011, 09:49:21 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Posts: 728
Hmmmmm, can you share the project and I can see what's up?
Logged
  • Pyxosoft
Re: [Program]GMare (Game Maker Alternative Room ...
« Reply #74 on: February 25, 2011, 10:04:16 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 160
Hmmmmm, can you share the project and I can see what's up?
Sorry , i deleted it and can't find it because i got a problem with my recycle bin , anyway i tried exporting it and it sort of messed up the gmk , i couldn't get an object to stay visible , the tileset appeared though but the objects didn't , did you try experimenting?
Logged
Nubcake now uses Purebasic!
Re: [Alpha]GMare (Game Maker Alternative Room Ed...
« Reply #75 on: February 25, 2011, 10:14:08 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Posts: 728
You couldn't get an object to stay visible. As in they don't show up in the room that was exported, or not within the project tree? Not completely following you.
Logged
  • Pyxosoft
Re: [Alpha]GMare (Game Maker Alternative Room Ed...
« Reply #76 on: February 25, 2011, 10:19:48 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 160
after i tried exporting it more than 3 times i created an object in GM but it wasn't visible in the room so i wasn't sure what was causing that problem.
Logged
Nubcake now uses Purebasic!
Re: [Alpha]GMare (Game Maker Alternative Room Ed...
« Reply #77 on: February 25, 2011, 10:29:05 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Posts: 728
I tried doing a bunch of things on the sample projects to try and see if I could re-create the problem, but I couldn't make it behave differently from what was expected. So it must be an option specifically with your GMK that GMare could be writing back incorrectly. I could test the gmk.
Logged
  • Pyxosoft

Mamoruanime

@Mamoruanime
Re: [Alpha]GMare (Game Maker Alternative Room Ed...
« Reply #78 on: February 25, 2011, 11:20:02 pm »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
I can't even recreate the problem, and in general I have the most error-prone computer in existence :P
Logged
Re: [Alpha]GMare (Game Maker Alternative Room Ed...
« Reply #79 on: February 25, 2011, 11:38:49 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Posts: 728
I can't even recreate the problem, and in general I have the most error-prone computer in existence :P

 XD

Yeah I gave it a go, but no luck, there are many options within GM, and I cannot test for them all. So it still could be an issue with your project that GMare is having, based on your project settings. In that case I would have to have a copy of the GMK and find it through the reader / writer parts of GMare.
Logged
  • Pyxosoft
Pages: 1 2 3 [4] 5 6   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.408 seconds with 74 queries.