SharpFlame Warzone Map Editor
SharpFlame Warzone Map Editor
Hi there,
First off, credit where credit is due:
Flail13 - Original Author of FlaME. -- Thanks for all hard your work on the map editor. As someone porting your code, I can see first hand how much work it took. I'm still amazed to see how far your skills pushed Visual Basic.
And so, announcing SharpFlame. I had some free time and ported over FlaME source code from VB to C#.
SharpFlame GitHub Repository::
https://github.com/bchavez/SharpFlame
All 38,000+ lines of VB ported to C# in all its glory. And it compiles! (but that doesn't mean it works yet).
It's pretty much a one-to-one port right now.
Moving forward, I plan to do MAJOR refactoring of the source code, add serious unit tests, and fix long outstanding bugs. See README.md for full details.
Talking in IRC, there were a few people that mentioned some issues with the original FlaME.
If you know how to reproduce any of those issues please post them here. and I'll get to work squasing them.
Now accepting pull requests.
Fresh SharpFlame builds coming soon.
Thanks,
cowboy
First off, credit where credit is due:
Flail13 - Original Author of FlaME. -- Thanks for all hard your work on the map editor. As someone porting your code, I can see first hand how much work it took. I'm still amazed to see how far your skills pushed Visual Basic.
And so, announcing SharpFlame. I had some free time and ported over FlaME source code from VB to C#.
SharpFlame GitHub Repository::
https://github.com/bchavez/SharpFlame
All 38,000+ lines of VB ported to C# in all its glory. And it compiles! (but that doesn't mean it works yet).
It's pretty much a one-to-one port right now.
Moving forward, I plan to do MAJOR refactoring of the source code, add serious unit tests, and fix long outstanding bugs. See README.md for full details.
Talking in IRC, there were a few people that mentioned some issues with the original FlaME.
If you know how to reproduce any of those issues please post them here. and I'll get to work squasing them.
Now accepting pull requests.
Fresh SharpFlame builds coming soon.
Thanks,
cowboy
Re: SharpFlame Warzone Map Editor
Greetings, looking forward to see what you can come up with.
Not sure how far along you are in the port you are doing (didn't get a chance to compare the repos), but, there was another map editor that was started (and never finished) located here:
https://github.com/Emdek/wz-map-editor
That one is written in Qt & C++, to make it easy to port it to any platform.
viewtopic.php?f=49&t=3087&hilit=diorama was also pretty cool, (python) but, out of date.
There are also some tools located here https://github.com/Warzone2100/warzone2 ... /tools/map that may help you with your progress / understanding of the map format.
I also believe there is another person on here that uses C#, that may be able to help you, Ezio is the forum handle he goes by.
If you got any other questions, feel free to yell at us.
Not sure how far along you are in the port you are doing (didn't get a chance to compare the repos), but, there was another map editor that was started (and never finished) located here:
https://github.com/Emdek/wz-map-editor
That one is written in Qt & C++, to make it easy to port it to any platform.
viewtopic.php?f=49&t=3087&hilit=diorama was also pretty cool, (python) but, out of date.
There are also some tools located here https://github.com/Warzone2100/warzone2 ... /tools/map that may help you with your progress / understanding of the map format.
I also believe there is another person on here that uses C#, that may be able to help you, Ezio is the forum handle he goes by.
If you got any other questions, feel free to yell at us.
/facepalm ...Grinch stole Warzone contra principia negantem non est disputandum
Super busy, don't expect a timely reply back.
Super busy, don't expect a timely reply back.
Re: SharpFlame Warzone Map Editor
Hi
I have a bit of experience with c# and especially java, so maybe I'll be able to help (we made a 3d defend-the-tower shooter in c# and XNA as a school project). I think microsoft visual c# express should be free?
I also have in-depth knowledge about the .pie format as well as shaders, so feel free to ask if there's anything you need to know.
Edit:
So I downloaded the code and it compiled (with the exception of an uncommented comment) but as soon as I try to create a new map, it gets some NullReferenceExceptions from uninitialized list objects etc.
I have a bit of experience with c# and especially java, so maybe I'll be able to help (we made a 3d defend-the-tower shooter in c# and XNA as a school project). I think microsoft visual c# express should be free?
I also have in-depth knowledge about the .pie format as well as shaders, so feel free to ask if there's anything you need to know.
Edit:
So I downloaded the code and it compiled (with the exception of an uncommented comment) but as soon as I try to create a new map, it gets some NullReferenceExceptions from uninitialized list objects etc.
-insert deep philosophical statement here-
Re: SharpFlame Warzone Map Editor
Hey jorzi,
There's still a few issues with the code that didn't 100% port over. I tried creating a new map too and got a NulReference exception.
Still working out the bugs.
Right now, mainly focusing on re-implementing the PIE parser. Since I think that's the most ugly part of the code right now.
cowboy
There's still a few issues with the code that didn't 100% port over. I tried creating a new map too and got a NulReference exception.
Still working out the bugs.
Right now, mainly focusing on re-implementing the PIE parser. Since I think that's the most ugly part of the code right now.
cowboy
- Rman Virgil
- Professional
- Posts: 3812
- Joined: 25 Sep 2006, 01:06
- Location: USA
Re: SharpFlame Warzone Map Editor
.
Hey cowboy...
Can't help with codeing but I've logged an inordinate number of hours using it since it was first released and know it really well as an end user and can help with testing and informed feedback as you move onward.
From day one I thought it superior to Edit World / World Edit however there are deep issues that donot fall under the heading of bugs. Stuff that I've had to become expert at, as in flying Wallendas, quadruple backflip, work-arounds (without a safety net so to speak) to get results that should be stock achievable without those monster workarounds. I think at this early stage of your effort it may not be appropriate for me to get into that stuff. But I'm not sure, really. I do think that at some point it will be relevant to bring up. That'll be your call.
In any case, its great what your doing and fundamentally needed as part of the core of maintaining a bright future for the game, I do believe.
.
Hey cowboy...
Can't help with codeing but I've logged an inordinate number of hours using it since it was first released and know it really well as an end user and can help with testing and informed feedback as you move onward.
From day one I thought it superior to Edit World / World Edit however there are deep issues that donot fall under the heading of bugs. Stuff that I've had to become expert at, as in flying Wallendas, quadruple backflip, work-arounds (without a safety net so to speak) to get results that should be stock achievable without those monster workarounds. I think at this early stage of your effort it may not be appropriate for me to get into that stuff. But I'm not sure, really. I do think that at some point it will be relevant to bring up. That'll be your call.
In any case, its great what your doing and fundamentally needed as part of the core of maintaining a bright future for the game, I do believe.
.
Re: SharpFlame Warzone Map Editor
One feature request: When I did some map editiong in Flame, I noticed problems with getting features (like trees) to the right height. This is due to two separate issues: Current warzone has a center vertex in the tiles while Flame still uses two-triangle tiles with the ability to flip the triangulation. This causes inconsistencies in the height of tile centers. The other thing is that, while the map formats supports adjusting the height offsets of features (afaik) it wasn't implemented in Flame. This would be a nice feature for pro mapmakers.
-insert deep philosophical statement here-
Re: SharpFlame Warzone Map Editor
Well, in FlaME you have a button to flatten ground below objects, as a workaround
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
Re: SharpFlame Warzone Map Editor
Getting there ... baby steps.
But finally got some things to draw on the screen.
http://www.bitarmory.com/temp2/Screen143.png
Everything is still very much under heavy refactoring.
Status:
* New PIE parser complete with unit tests.
But finally got some things to draw on the screen.
http://www.bitarmory.com/temp2/Screen143.png
Everything is still very much under heavy refactoring.
Status:
* New PIE parser complete with unit tests.
- Rman Virgil
- Professional
- Posts: 3812
- Joined: 25 Sep 2006, 01:06
- Location: USA
Re: SharpFlame Warzone Map Editor
If you care to implement the smooth terrain rendering one day (we don't really need the tile-by-tile representation one anymore to stay WYSIWYG, and that can save a lot of UI, i guess), see determineGroundType() in map.cpp to understand how it works, all the color voting and stuff.
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
Re: SharpFlame Warzone Map Editor
Made a new class for drawing terrain with averaged middle vertices on each tile.
It's called clsDrawTileMiddleVertex.cs and is based on clsDrawTileOld.cs
For the code to work I also made the following additions to the sXYZ_sng struct in Definitions.cs:
It's called clsDrawTileMiddleVertex.cs and is based on clsDrawTileOld.cs
Code: Select all
using System;
using OpenTK.Graphics.OpenGL;
using SharpFlame.Mapping.Tiles;
using SharpFlame.Maths;
namespace SharpFlame.Mapping.Renderers
{
public class clsDrawTileMiddleVertex : clsDrawTile
{
public override void Perform()
{
clsTerrain Terrain = Map.Terrain;
clsTileset Tileset = Map.Tileset;
double[] TileTerrainHeight = new double[5];
sXYZ_sng[] Vertices = new sXYZ_sng[5]; //4 corners + center
sXYZ_sng[] Normals = new sXYZ_sng[5];
sXY_sng[] TexCoords = new sXY_sng[5];
int A = 0;
//Texture binding code copied from clsDrawTileOld
if (Terrain.Tiles[TileX, TileY].Texture.TextureNum < 0)
{
GL.BindTexture(TextureTarget.Texture2D, App.GLTexture_NoTile);
}
else if (Tileset == null)
{
GL.BindTexture(TextureTarget.Texture2D, App.GLTexture_OverflowTile);
}
else if (Terrain.Tiles[TileX, TileY].Texture.TextureNum < Tileset.TileCount)
{
A = Tileset.Tiles[Terrain.Tiles[TileX, TileY].Texture.TextureNum].MapView_GL_Texture_Num;
if (A == 0)
{
GL.BindTexture(TextureTarget.Texture2D, App.GLTexture_OverflowTile);
}
else
{
GL.BindTexture(TextureTarget.Texture2D, A);
}
}
else
{
GL.BindTexture(TextureTarget.Texture2D, App.GLTexture_OverflowTile);
}
GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, (int)TextureEnvMode.Modulate);
//Vertex order:
//0 1
// 4
//2 3
TileTerrainHeight[0] = Terrain.Vertices[TileX, TileY].Height;
TileTerrainHeight[1] = Terrain.Vertices[TileX + 1, TileY].Height;
TileTerrainHeight[2] = Terrain.Vertices[TileX, TileY + 1].Height;
TileTerrainHeight[3] = Terrain.Vertices[TileX + 1, TileY + 1].Height;
TileTerrainHeight[4] = (TileTerrainHeight[0] + TileTerrainHeight[1] + TileTerrainHeight[2] + TileTerrainHeight[3]) / 4; //middle height is average of the corners
TileUtil.GetTileRotatedTexCoords(Terrain.Tiles[TileX, TileY].Texture.Orientation, TexCoords[0], TexCoords[1], TexCoords[2], TexCoords[3]);
Vertices[0].X = TileX * App.TerrainGridSpacing;
Vertices[0].Y = (float)(TileTerrainHeight[0] * Map.HeightMultiplier);
Vertices[0].Z = -TileY * App.TerrainGridSpacing;
Vertices[1].X = (TileX + 1) * App.TerrainGridSpacing;
Vertices[1].Y = (float)(TileTerrainHeight[1] * Map.HeightMultiplier);
Vertices[1].Z = -TileY * App.TerrainGridSpacing;
Vertices[2].X = TileX * App.TerrainGridSpacing;
Vertices[2].Y = (float)(TileTerrainHeight[2] * Map.HeightMultiplier);
Vertices[2].Z = -(TileY + 1) * App.TerrainGridSpacing;
Vertices[3].X = (TileX + 1) * App.TerrainGridSpacing;
Vertices[3].Y = (float)(TileTerrainHeight[3] * Map.HeightMultiplier);
Vertices[3].Z = -(TileY + 1) * App.TerrainGridSpacing;
Vertices[4].X = (TileX + 0.5f) * App.TerrainGridSpacing;
Vertices[4].Y = (float)(TileTerrainHeight[4] * Map.HeightMultiplier);
Vertices[4].Z = -(TileY + 0.5f) * App.TerrainGridSpacing;
Normals[0] = Map.TerrainVertexNormalCalc(TileX, TileY);
Normals[1] = Map.TerrainVertexNormalCalc(TileX + 1, TileY);
Normals[2] = Map.TerrainVertexNormalCalc(TileX, TileY + 1);
Normals[3] = Map.TerrainVertexNormalCalc(TileX + 1, TileY + 1);
Normals[4] = (Normals[0] + Normals[1] + Normals[2] + Normals[3])/4; //Linearly interpolate from corner vertices
Normals[4] /= Normals[4].length(); //normalize vector length
GL.Begin(BeginMode.Triangles);
int[] indices = { 1, 0, 4, 3, 1, 4, 2, 3, 4, 0, 2, 4 };
for (int i = 0; i < indices.Length; i++)
{
GL.Normal3(Normals[indices[i]].X, Normals[indices[i]].Y, -Normals[indices[i]].Z);
GL.TexCoord2(TexCoords[indices[i]].X, TexCoords[indices[i]].Y);
GL.Vertex3(Vertices[indices[i]].X, Vertices[indices[i]].Y, -Vertices[indices[i]].Z);
}
GL.End();
}
}
}
Code: Select all
public struct sXYZ_sng
{
public float X;
public float Y;
public float Z;
public sXYZ_sng(float X, float Y, float Z)
{
this.X = X;
this.Y = Y;
this.Z = Z;
}
public static sXYZ_sng operator +(sXYZ_sng a, sXYZ_sng b)
{
sXYZ_sng result = new sXYZ_sng();
result.X = a.X + b.X;
result.Y = a.Y + b.Y;
result.Z = a.Z + b.Z;
return result;
}
public static sXYZ_sng operator /(sXYZ_sng a, float b)
{
sXYZ_sng result = new sXYZ_sng();
result.X = a.X / b;
result.Y = a.Y / b;
result.Z = a.Z / b;
return result;
}
public float length()
{
return (float)Math.Sqrt(X * X + Y * Y + Z * Z);
}
}
-insert deep philosophical statement here-
Re: SharpFlame Warzone Map Editor
I changed drawing of the .pie models so it includes alpha testing:
in clsModel.cs, in the GLDraw() method, add the following lines at the top:
This will prevent the transparent planes in trees & stuff from erasing stuff behind them
in clsModel.cs, in the GLDraw() method, add the following lines at the top:
Code: Select all
GL.AlphaFunc(AlphaFunction.Greater, 0.5f);
GL.Enable(EnableCap.AlphaTest);
-insert deep philosophical statement here-
Re: SharpFlame Warzone Map Editor
Hey Jorzi,
Awesome! Send me a pull request and I'll get it merged back in.
Do you have GitHub? What's your ID? I'll add you as a committer to it.
Going to work on it some tonight.
Awesome! Send me a pull request and I'll get it merged back in.
Do you have GitHub? What's your ID? I'll add you as a committer to it.
Going to work on it some tonight.
Re: SharpFlame Warzone Map Editor
Hi
I currently only have the changes in my local repo.
My github account is also Jorzi
I currently only have the changes in my local repo.
My github account is also Jorzi
-insert deep philosophical statement here-
Re: SharpFlame Warzone Map Editor
Hey Jorzi,
Added you as a contributor/commiter access.
Added you as a contributor/commiter access.