Archived

This topic is now archived and is closed to further replies.

coding a custom 3d Editor.

This topic is 5173 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everybody, Yes, I decided, I need a custom 3d editor for my game. It will be an horizontal shooter (r-type like, etc...). The thing, is that I´m not used to write this kind of apps, so I don´t know where to start, what funcionality add, etc... I will use MFC in order to code it, and it will based in my 3d engine for rendering, etc... Is there any tutorial, document or something describing more or less the steps to write this kind of editors? that gimme any ideas or tips?. I would like to add objects (enemies, player starting position, emisors, etc... and place them wherever I like), create movement dependencies, apply paths, etc... and be able to have a quick look at how it works and feels. Thanks in advance. HexDump. [edited by - HexDump on October 15, 2003 5:08:27 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by HexDump
Is there any tutorial, document or something describing more or less the steps to write this kind of editors? that gimme any ideas or tips?
There will be, when I get round to writing one. I've been coding a level editor for the past year or so (yeah, it sounds a long time, but it's fully-featured, and I've made some mistakes) for an FPS engine I'm creating, and it's been a very through learning experience. I haven't found any decent level editor tutorials on the net, but then again, I haven't looked around too much.

You've chosen to use MFC. That's a very good start. I started writing my editor in VB, and it's only since I changed to C++/MFC that I've got anywhere with it. You'll probably need two views (CView): one which shows a view of the level you're creating, and one which has a list of all the objects a map can have. I suggest you use a static window splitter (CSplitterWnd), and make two views at the start of your program.

How are you going to render the map? With your game code? It will probably need a little modification, but that's a good idea. You'll need to add selection code, so the user can click things, and you'll definitely need code for moving objects in the level view, and perhaps for rotating and scaling them too. You might want to make the object view a CListView, or you could just make a CView, and render little clickable pictures of your objects into it with whatever API you want to use (GDI, OpenGL, DirectX). Again, you'll need selection code.

Plus, you'll need little tools for each feature you want to implement. Let's take the path tool you want as an example. You'll have a toolbar, most likely, with a Path Tool button on it. When the user clicks this, the Path Tool is activated. When the user clicks in the map view, they specify a path point. Multiple clicks in different places is how the path is defined (actually, Valve's Hammer editor has a nice path tool). When the user is finished, they click the path tool button on the toolbar again.

You might quickly learn that while the implementation of tools on their own is simple, integrating all the tools into one program is rather difficult. Personally, I have a series of pointers which hold (as structures) all the tools my program has (I have tools like Selection, Translation, Roatation, Scaling, Vertex Drag, etc). Each tool's structure contains pointers to the tool's functions, along with other information. When I select a tool, I just put it's address into a CurrTool variable, and call it like so (this one from the OnLButtonDown handler):
g_MyEditor.CurrTool->MouseDown(nFlags, point); 
Finally, you need a menu item which starts your game, sending the map on the command line (c:\MyGame\MyGame.exe -devmap -"New.map", or something). This enables you to test the map. Anyway, like I've said, I'm going to write a little series on level editors (if I get the chance, uni and all), but there's some stuff to get you started...

[Insert witty signature here]

[edited by - iNsAn1tY on October 15, 2003 6:23:31 PM]

Share this post


Link to post
Share on other sites
Digging in the net, I have found that alot of firms write max plugins in order to create their game editors. Has anybody written any?, is it possible to get the same thing you can do if you write your own from groupd up?.


HexDump.

Share this post


Link to post
Share on other sites
quote:
Original post by HexDump
Digging in the net, I have found that alot of firms write max plugins in order to create their game editors. Has anybody written any?,


I''m guessing many use that approach because they want a full 3d level creator, so making map geometry, texturing etc. is already done since they already have it built in to 3dsMax. It is a lot of work to write that yourself (especially making it fast and user friendly) so you might want to leave that out.

For some sort of scrolling shooter, you could import geometry chunks from a file format and just arrange them in the editor to make your level (in kinda the same way you make 2d levels out of predrawn tile images).

Most of the complex stuff you''ll need will be your paths i think. just make sure you get some good core data structure (that you can share with your game engine) and you should be ok.

It may help to think from the perspective of the level designer. For my project i thought "how will a level be made?" which gives you:
1. create level geometry
2. add textures, position textures etc.
3. add entities, link entities together to interact etc.
4. test.

Which nicely lends itself to having a geometry mode, surface/texture mode and an entity mode. So thats what the code looks like as well. You could have something like an object mode (add, move, rotate prefab geometry chunks), a path mode and game object mode (add player start, enemies, powerups etc., some linked to objects or paths).

Share this post


Link to post
Share on other sites
Hello,

From your answer I understand that it is a good idea to use max.

I want to be able to add objects, change properties, and have a look at the result in max (using my 3d engines). But I don´t know where to start to add all this capabilities. Could I do everything in an utility plugin? should I have several ones?... some tips will be really welcomed, beacuse I´m a bit lost in the max sdk / max script.


HexDump.

Share this post


Link to post
Share on other sites
I wouldn''t suggest doing a max plugin, if only because I couldn''t afford the damn thing

If you want to actually view it ''previewed'' in your own engine, just leave the geometry creation to max or whatever and import geometry files into your own stand-along editor. Then in that you mess around with paths and scripting etc. and save the whole thing to your own level file.

Share this post


Link to post
Share on other sites
I think you can use the free Max as long as you dont need to render anything. I remember I read about it the other day in a post and checked up on it. gMax or something.

Share this post


Link to post
Share on other sites
A good point to start to do an exporter from 3DSMax is the ASCII exporter plug-in which is well detailled in the Max SDK.

About the preview plug-in for 3DSMax you should look at gamasutra.com (I saw one article dealing about this...)
IMO, you better try do to a fast and bug proof exporter rather than speeding a lot of time in a preview plug-in. When working with the graphical parts of 3DSMax you will have a lots of crash and it won''t really help you to do this plug-in.
In my case exporting a scene don''t take more than a minute so it doesn''t worth the effort to do a preview plug-in.

Good luck with 3DSMax because you''ll need it...

Share this post


Link to post
Share on other sites
quote:
Original post by Nekhmet
We actually use our game engine as our editor. You put it in configuration mode, and then the interface allows you to move furniture and stuff.
You flash git

[Insert witty signature here]

Share this post


Link to post
Share on other sites
A good point to use the engine as the editor .

So I think I will export things from max and built the level/apply IA, etc...with an editor


HexDump.

Share this post


Link to post
Share on other sites