Disclaimer: PBEdit is in no way affiliated to Pushbutton Engine. The name PBEdit does not and should not be considered or called Pushbutton Edit, it’s just simply PBEdit.
Github Repository: https://github.com/rinesh/PBEdit
Zipped source: http://rinesh.in/tools/pbedit/PBEdit_src.rar
PBEdit is an incomplete Pushbutton engine editor. It was a personal project of mine which I started working on in July 2010 and worked on for about 2 months.
This was my first attempt at making a game editor. I wanted to make one for some time now. Later I got busy with work and abandoned the projects. Recently I thought to make the source code public, it might be useful for someone if not the whole thing at least bits and parts of it could be useful to learn from.
I had made 2 small game prototypes in Pushbutton “Keep Me in” and “Rumble Rolls”. While making any game I always feel the need to have an editor at hand. PBE engine has a really nice way of storing levels in XML. I decided to make a GUI for it, thus the ideas of the editor was born.
The editor has two parts,
- Flash part
Which is a Flash Develop project in the. /Editor folder.
2. The C# part
Which is the Visual studio 2008 solution file is in the root directory
I decided to go with C# because it has really good GUI components and I had previous experience with C# also because it’s possible to communicate between flash and dot net.
The Flash Develop project is just like any Pushbutton engine game and has code for communication with the C# code. It has functions to send and receive data. I recommend reading this to understand how this communication is done using external API
Using the external API with an ActiveX container
I have used the ExternalInterfaceProxy C# project from this example to call functions and receive return values. This project is added to the PBEdit solution.
There are 3 projects in the solution PBEdit is the editor, one is the ExternalInterfaceProxy project mentioned above, the PropertyGridEx project which is the custom property grid control I use to display entity components and properties. You can find more information and example of using this control on Codeproject.com. This is a wonderful control and was very useful.
The first thing to do after downloading the opening the solution is to set the variable
String swfPath = “D:\\PBEdit\\PBEdit\\Editor\\bin\\Editor.swf”;
in the MainForm.cs constructor to the swf created by the FlashDevelop project, Relative path didn’t seem to work. When you run the project you should see the swf running inside the widow.
The next thing to do is press the “Refresh” button at the top, this fills out the combo boxes and other controls. Clicking on an entity in the swf fills the PropertyGridEx controls with its components and properties. Selecting an entity from the dropdown combo box shows its components and properties in the same way but doesn’t select it in the swf, this is one of the many things missing.
The project uses LINQ which to create Classes during runtime. It’s a very useful feature, and I learnt it from here.
var elements = from element in arrayXML.Elements()//”_”
childType = element.HasAttributes ? element.Attribute(“type”).Value : childType,
def = element,
Where ever you find code similar to this it uses LINQ.
These are some of the high level details of the project and stuff used. You will have to debug the application and learn more about it. There are a lot of features missing. Hope this was useful.