Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
gggmork

easiest way to read doombuilder 1/2 source?

Recommended Posts

So far I suspect they're c# .cs file(s), obviously downloadable at the doombuilder website but haven't tried yet.

Should I download "vim" or "emacs" or "notepad++" or something to read them (Maybe a dumb question, but all I really know is drpython for python files)?

Also, can anyone make c# programs for free or is it required to buy some sort of microsoft programming software or something?

I basically want to see how the data for point/line/sector is implemented in doombuilder. For example, having 2 sectors share a line seems a bit tricky as to where to divide the objects into units. My guess is a sort of global list of named points and the sectors merely store the name of the points, thus being able to refer to the same global point that another sector shares with it. That's what worked for me in a pygame program but I'm an amateur.
Or another question like if a sector is merely a list of points (maybe it isn't, I don't know):
[p1,p2,p3,p4], perhaps 'closed' with p4 connected back to p1, then how do you implement line 'objects' with their own methods?
Or is the whole map a single data object, but I doubt it because you can select different sector objects apparently. And that would be a complex object. Still, maybe that would make more sense since otherwise you'd have separate objects sharing lines and points with other objects in a confusing mish mash.

--

In pygame I made a class called Connectoid() that has a list of named points roughly like this (inverted y axis, btw):

class Connectoid():
pointList = [Point(0,0,'topLeft'), Point(10,0,'topRight'), Point(0,10,'bottomLeft'), Point(10,10,'bottomRight')]

Then a list of connections (aka lines), the data of which is the NAMES of the lines 2 endcap points:
connectionList = [Connection('bottomLeft', 'topRight'), Connection('bottomLeft', 'topLeft'), Connection('bottomLeft', 'bottomRight')]
(that data would mean 3 lines drawn from the bottom left point to each of the other 3 points).
That way you can move the bottom left point and the others will continue to draw to its location, because there is only one actual point there, and all the connection names refer to the same one by name, instead of having their own separate points.
That's more abstract data than a sector/shape I guess because any point can connect to any other one, not limited to a closed polygon.

The string names make it easier to speak slightly more english to the bit speaking alien computer I guess but not sure if the whole concept is good.

Share this post


Link to post

Doom Builder is in Visual Basic. Doom Builder 2 is in C#.


The source code is in text files, so you can pretty much use anything that can read text files. Even a word processor, but that'd be dumb. Something like Notepad++ is a good idea because it'll give you syntax highlighting which makes the code easier to read. Make your shopping here.

For compiling C# programs, you can use MS Visual C# Express. It's free (as in gratis). There are also free software alternatives, but don't expect them to handle all C# programs because there will be API issues too.

Doom Builder 2 requires .NET and some third-party library called SlimDX. It's a lot less portable than a python script.

Share this post


Link to post

.NET is actually more portable than most people think, but DB2 makes use of the Windows namespace and SlimDX (which is a DirectX API) which are (obviously) Windows-only libraries. So that is my 'fault'. For the game project I am currently involved in, I made a dedicated server in .NET which runs fine on both Windows and Linux. But that is offtopic.

The way DB2 works is similar to how Doom level structures work: A map has Vertices which are basically just coordinates. Then there are Linedefs which are the lines in between vertices. A line always has 1 start vertex and 1 end vertex. Each linedef also has 2 Sidedefs: Front and Back. These sidedefs make up the shape of the Sectors, a single sector has 1 or more sidedefs (it can technically have 0 sidedefs, but it would be just a waste as the sector data would have no location nor shape in the map that it would apply to).

DB2 has an object-oriented programming which is similar to this. On top of that, the classes in DB2 have references to all associated elements. So not only does a linedef have references to the 2 vertices that it is connected to, the vertices also have a list of references to the lines that are connected to them. A sidedef has a reference to the linedef it is on and has a reference to the sector that it is part of. Each sector has a list of sidedefs that make up its shape. This is needed for fast searching through the structures by the various methods that can run on this data.

Don't look at the DB1 source code. It is old and crap, a bad programming example for these days. I was young and naive and that language (VB) didn't have proper features for object-oriented programming, so it's all structures and separate methods, just like the Doom source code. Horrible.

I hope that answers your question a bit.

Share this post


Link to post

That's a helpful explanation about references, thanks. In python its not really obvious to use references because they get created 'automatically' and not really explicitly, so they're kind of a nuisance occurring when you don't expect them to, and you never know for sure if something is a reference or separate real object without doing side tests (unless you memorize the rules of using them). But maybe I just need more experience in using them.

From the end user perspective at least, DB1 is a great program too, and might also be useful source code for me because I need guidance in both OOP and Imperative/Procedural/whatever its called. And to learn to code, people say you should READ CODE (which I hardly ever do and need to start I guess). Reading books ABOUT how to code (even the most recommended ones) hasn't proved very useful for me.

Well, I just downloaded notepad++ so will try to check them out, thanks.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×