Author Topic: XNA-based Level Editor  (Read 7696 times)

0 Members and 1 Guest are viewing this topic.

Offline warz

  • Hero Member
  • *****
  • Posts: 1134
    • View Profile
    • chyea.org
XNA-based Level Editor
« on: May 26, 2009, 11:01:26 pm »

(update 1's shot)

I'm not quite announcing any finished products or anything, but this editor is going to be for a game I've been working on for the past several months. It's just a fairly simple 3D, isometric-style shooter, reminiscent of Sony's old "Infantry Online" game. What I've been needing to write, though, is an editor that'll just do some basic terrain creating. Initially I plan on being able to create and save heightmaps, or load existing heightmaps and render them to my viewport. I'll have this functionality implemented by the end of tomorrow, at least. I've already got code for this in my game, so that'll be relatively plug-n-go. After that, I'm not quite sure where the next logical step is but I think I'll add in some terrain picking, and work on manipulating the heightmap polygons on-screen - elevate, lower, smooth, whatever. If I get this far I'll add more goals, but I'm going to keep my sights relatively simple for now.

I'll keep updates coming as I work on this. Tomorrow should be a fun update.

Update 1: It took me a lot longer to get working how I wanted it, but I re-wrote the entire thing using a different method of getting XNA to work as a MDI child window. I'm using the Game class now which handles all the game looping, components and services for me. (I also get to use the content pipeline, now). I also threw in my free-moving camera, so now I can fully navigate around the 3D design space. The marker you see in the screenshot is just a simple origin marker placed at (0, 0, 0).

Update 2: http://forum.x86labs.org/index.php/topic,14336.msg177060.html#msg177060
« Last Edit: May 29, 2009, 02:14:58 am by warz »
http://www.chyea.org/ - web based markup debugger

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: XNA-based Level Editor
« Reply #1 on: May 26, 2009, 11:06:16 pm »
Looks nice. I havn't played with XNA in a while, what would be really cool would be XNA + a WPF Editor :).
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline warz

  • Hero Member
  • *****
  • Posts: 1134
    • View Profile
    • chyea.org
Re: XNA-based Level Editor
« Reply #2 on: May 26, 2009, 11:14:37 pm »
Looks nice. I havn't played with XNA in a while, what would be really cool would be XNA + a WPF Editor :).

Yea. I was reading up on that prior to just settling with a Win Forms app.

I came across something that started to talk about having to use IIS and stuff for some type of communication. Thinking back on it now that doesn't make much sense, really, but it kind of turned me off.

I looked at the MS ribbon menu stuff, too. They've got it to where you have to purchase a license to use it? Pretty lame. It would be cool, though. :-P
« Last Edit: May 26, 2009, 11:18:02 pm by warz »
http://www.chyea.org/ - web based markup debugger

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: XNA-based Level Editor
« Reply #3 on: May 26, 2009, 11:21:25 pm »
I think the WPF Ribbon (Including with the WPF Toolkit @ windowsclient.net) but it's pretty basic (No databinding support). With .NET4.0 it will be included standard in WPF.

One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline warz

  • Hero Member
  • *****
  • Posts: 1134
    • View Profile
    • chyea.org
Re: XNA-based Level Editor
« Reply #4 on: May 29, 2009, 02:08:00 am »


Update 2:
Had a busy day because of school, but I managed to spend a few hours coming up with a Heightmap and Terrain class. My Heightmap class is capable of generating vertices and indices for whatever size terrain you want. Right now the Heightmap class only generates a flat quadrilateral because I haven't finished the methods for writing/reading bitmaps, yet. Those are simple and I'm almost finished but I'm at that stage where I'm staring at the monitor just zoning out. Too much programming for me!

The Terrain class uses the Heightmap class to get the Vertex/Index Buffer data. The Terrain class is the class that is physically responsible for rendering the terrain on screen. So, in terms of editing the terrain, this class will invoke the Heightmap class when it's time to save whatever changes have been made to the terrain's height.

Like I mentioned in my original post's edit titled "update 1" - I've got a FreeCamera class in there, too. So, the user is able to navigate the 3D space. Right now, WASD move your forward, left, back, right. SpaceBar and E move you directly up. Q moves you directly down. Holding down LeftControl allows you to use the mouse to change the direction the camera is looking, and moving.
« Last Edit: May 29, 2009, 02:20:48 am by warz »
http://www.chyea.org/ - web based markup debugger