ZFGC

Resources => Coding => Topic started by: TheRealMethuselah on October 08, 2007, 04:45:57 pm

Title: External Rooms & Objects (GM7)
Post by: TheRealMethuselah on October 08, 2007, 04:45:57 pm
Download:
external.zip (http://barrashomesinc.com/external.zip) (11.7KB)

I first create a room then set the size to 16x16 (just to keep it small). In the creation code of the room:

(http://barrashomesinc.com/rmCreate.gif)

That's all I need to do in the .gmk file, now onto the externals.

The init.txt file contains gml code that is executed.
(http://barrashomesinc.com/init.gif)

I have a small sprite with 7 tiles inside
(http://barrashomesinc.com/sprTiles.gif)
I could have up to 224 tiles inside if I'd like to, as I'm using a sprite based font to tile the room. I use ord('A') as the first character so my sprite based font goes from A-G.

As you can see inside this file, I create a room and execute the code inside of the .txt file
(http://barrashomesinc.com/room0.gif)

I also set the caption and execute an object file.
(http://barrashomesinc.com/objRoom0.gif)

Inside the objRoom0.txt file, you can see a long string of A's, etc. with #, my 256x224 pixel room is made up of 16x14 tiles, each represented by a tile in the sprite based font.

When laid out, these lines look like this
(http://barrashomesinc.com/map.gif)

And when ran, the .gmk file looks like this.
(http://barrashomesinc.com/map2.gif)

You can edit this file to use as many layers as you'd like, just draw them in order in the object. You can also use this as a method to create spawn points for objects.
Title: Re: External Rooms & Objects (GM7)
Post by: Atrius on October 08, 2007, 05:07:21 pm
That's a rather unique way of going about it.  Any reason you went with a sprite based font rather than actual tiles besides than not having to convert the text from the file?

It's also important to note that executing an external text files is a huge security risk to your game.  Anyone with decent knowledge of GML could alter them to make your game do whatever they want, including dumping all your scripts, and resources to external files.
Title: Re: External Rooms & Objects (GM7)
Post by: TheRealMethuselah on October 08, 2007, 05:08:50 pm
You can encrypt the external files, if you'd like. I went with sprite based fonts because you can have unlimited layers.

EDIT: The tutorial is just for ease of use.
Title: Re: External Rooms & Objects (GM7)
Post by: Moon_child on October 08, 2007, 06:31:12 pm
Awesome tutorial as always! you use this for OOT2D?
Title: Re: External Rooms & Objects (GM7)
Post by: Kylink on October 08, 2007, 07:32:20 pm
Wow, very nice...I'm so glad you are back XD You always have awesome sprites and awesome programming skill.
Title: Re: External Rooms & Objects (GM7)
Post by: TheRealMethuselah on October 08, 2007, 08:06:31 pm
Awesome tutorial as always! you use this for OOT2D?
Yep, with 4 layers.

Wow, very nice...I'm so glad you are back XD You always have awesome sprites and awesome programming skill.
Thanx kylink, I appreciate that.
Title: Re: External Rooms & Objects (GM7)
Post by: Kylink on October 08, 2007, 08:55:44 pm
Awesome tutorial as always! you use this for OOT2D?
Yep, with 4 layers.

Wow, very nice...I'm so glad you are back XD You always have awesome sprites and awesome programming skill.
Thanx kylink, I appreciate that.
Don't mention it. ;)
Title: Re: External Rooms & Objects (GM7)
Post by: BuffaloBurgers on October 09, 2007, 01:04:32 am
Just an FYI, this is basically how maps were stored in the Genesis/SNES days. Basically, you have an array which holds data for your map. The data points to your objects, allowing you to create a map.
Title: Re: External Rooms & Objects (GM7)
Post by: Giverny on October 09, 2007, 02:12:28 am
Wow, this is a nice technique. Other than the security risk, that is.
This'll become useful for Final Memory. I'll definitely credit you for this.

~LynkW
Title: Re: External Rooms & Objects (GM7)
Post by: Mamoruanime on October 09, 2007, 05:07:34 am
Nice script TRM ^_^

As for the security risk, meh its not THAT big of a deal--- I dunno if the ability to dump scripts is a new feature though; lol I dont think I've seen anyone do that (nor have I really bothered to try such function); so I'm not particularly worried there :P
Title: Re: External Rooms & Objects (GM7)
Post by: TheRealMethuselah on November 23, 2007, 03:07:26 am
Thanks, sorry, been gone a while
Title: Re: External Rooms & Objects (GM7)
Post by: Antidote on December 02, 2007, 03:25:19 am
Just glad to have you back TRM  :) Although this script isn't as new as you make it seem <.< you posted one so similar to this it isn't funny a long time ago. Nice script though.
Title: Re: External Rooms & Objects (GM7)
Post by: Giverny on December 02, 2007, 06:42:38 am
Heres something I'll try with this engine: try to make a walking engine out of it, using a modified goodnights engine, with collision mapping.


~LynkW
Title: Re: External Rooms & Objects (GM7)
Post by: Mewgull on December 05, 2007, 12:06:43 pm
This is great and all... but is there anyway to actually map the room in the default map maker, rip it out of the game into hex code, and then import it externally through hex?
Title: Re: External Rooms & Objects (GM7)
Post by: Mamoruanime on December 05, 2007, 12:33:20 pm
Nah, it'd have to be made in a seperate program altogether... GM needs a room export function...

But TRM set this up pretty much the same way that the GB zeldas have their maps; I suppose it might be possible to rip that hex from the GB zelda games :P but eh

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