Making level editors?

For questions about using Classic.

Post » Tue Dec 01, 2009 5:42 pm

Wasn't sure where the best place to put this was, but Help and Support seemed like the best bet.

Ok, well I've seen more than a few people mention how they've made level editors for their games, rather than just creating the levels directly in construct. I was curious if someone who's done this could explain how? Like, I'm guessing this is so they can use tiles in a quicker fashion right? But how do you set it up to save it out correctly and in a readable format, or do you just save one huge image file (which sounds really unlikely and I hope the latter is not the case!).

Can your level editors do other things too? If so, what?

Have you made other tools in the same way for use in creating your game? If so, what were they?


I'm just curious really as it would be something I wouldn't mind having a go at doing, but creating a working editor from an editor warps my brain a bit right now and I'm not sure how one would work. But they do sound useful, since every game is different and no matter how awesome construct is, having a custom editor for a game you happen to be working on at the time sounds really helpful.
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Tue Dec 01, 2009 6:13 pm

Let me give you a very simple example for some sort of grid-based game.

So you would make your editor in a way that when you clicked somewhere on the playfield, it would create a tile at the current grid position.
Mouse1 clicked -> create tile at floor(MouseX/32)*32, floor(MouseY/32)*32... if your grid resolution was 32 that is. Then you'd have an Array with the correct dimensions: LayoutWidth/32 = Array.SizeX and LayoutHeight/32 = Array.SizeY. And on click or with a loop on saving you could set the value of the array to info that is relating to the object at that position (object name or animation name/frame of the tile for example). To save your level you can simply use the save to file action of the array.

Now in the game you run a For each element loop of the array and create the according objects at Array.CurrentX*32 and Array.CurrentY*32 positions. And then you'd have your game engine on top of that. Voila...

That's for a very simple example. You should also look into Hash tables and INI files, which are usually used to store data outside of the game exe itself too. For more complicated editors an array wouldn't be feasible after all.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Tue Dec 01, 2009 6:24 pm

I've made a full timeline based animation editor/recorder for a complex character rig.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Tue Dec 01, 2009 6:52 pm

[quote="PixelRebirth":2fz8iyzc]Let me give you a very simple example for some sort of grid-based game.

So you would make your editor in a way that when you clicked somewhere on the playfield, it would create a tile at the current grid position.
Mouse1 clicked -> create tile at floor(MouseX/32)*32, floor(MouseY/32)*32... if your grid resolution was 32 that is. Then you'd have an Array with the correct dimensions: LayoutWidth/32 = Array.SizeX and LayoutHeight/32 = Array.SizeY. And on click or with a loop on saving you could set the value of the array to info that is relating to the object at that position (object name or animation name/frame of the tile for example). To save your level you can simply use the save to file action of the array.

Now in the game you run a For each element loop of the array and create the according objects at Array.CurrentX*32 and Array.CurrentY*32 positions. And then you'd have your game engine on top of that. Voila...

That's for a very simple example. You should also look into Hash tables and INI files, which are usually used to store data outside of the game exe itself too. For more complicated editors an array wouldn't be feasible after all.[/quote:2fz8iyzc]

Ahhh! Damn that sounds so useful! So much simpler than I thought too. I suppose with some effort you could even include a custom editor as part of the game too couldn't you? If all the complex bits remained internal, then the editor just let you place things. It's within the realms of possibility isn't it. Dammit this program is cool, lol.
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Tue Dec 01, 2009 7:01 pm

[quote="Lost my Keys":2ztq13kn]
Ahhh! Damn that sounds so useful! So much simpler than I thought too. I suppose with some effort you could even include a custom editor as part of the game too couldn't you? If all the complex bits remained internal, then the editor just let you place things. It's within the realms of possibility isn't it. Dammit this program is cool, lol.[/quote:2ztq13kn]

Of course it's very possible. If everything turns out as intended my next small game will include the level editor. 8)

[quote="Davioware":2ztq13kn]I've made a full timeline based animation editor/recorder for a complex character rig.[/quote:2ztq13kn]

:shock: Sounds like a very cool thing actually.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests