Shared brf library

Users who are viewing this thread

Effidian

Recruit
The BRF library is a C++ lib that reads and writes BRF files. There is no graphic components. It is meant to be used by anyone wanting to write an editor that needs information from the BRFs or writing BRFs.

Source for the BRF library is available via 2 methods, a zip file is updated every 6 hours at

http://212.128.140.18/~felipe/mbsources/brflib-latest-src.zip

OR via SVN at:

svn://eudoredlinux.ana.usal.es/brflib/trunk

Quick SVN setup instructions:
-Download and install Tortoise SVN. Reboot.
-Create a new empty folder for each project
-Left click on folder, SVN checkout, put in project url. Everything gets downloaded.

---- INITIAL MESSAGE ----
So, I'm thinking it may be nice to have a shared brf library where we can combine our knowledge of the brf files. I've got one version in the Unofficial editor, Lurb has one in the Model importer, Thorgrim either has his own or uses Lurb's and I know n008 was working on one until he disappeared for a few weeks.

I'd be happy to combine the one I have and Lurb's into a single library. Standard C++ using STL (no .NET stuff).

Would that be useful? If so, send me whatever current version you have (Lurb I know you have updates) and I'll start creating a generic brf reader/writer with an example.
 
I was planning for that too. My current lib just grew up as a crutch while I was trying to read the files, and tidying it up is the first task I have in mind for the next brf tool version.

I'd love to collaborate on it, I've glanced at your source and you seem the kind of clean and methodic guy that keeps me in check when I try to just kludge things.

What do you think about using a subversion repository? I think just mailing the sources back and forth will not work too well, and I can put up one of those pretty fast.

I agree on the plain STL thing and have already a few ideas about the class organization.

I have a big college assignment due tomorrow (Wed 30), but I'll get working on it after that.
 
Subversion is a nice version control tool that keeps track of changes in code and allows shared developement on a project. Like CVS or SafeSource but better.

If you have never used those, i'll explain:
Basically you have a local copy of the source code and when you are happy with your changes, you just upload them to the repository, where it gets merged with what others are doing. You also get the code others have uploaded merged into your local stuff, so everyone is always up to date with the last verion. Even if someone messes up, everything can be brought back to where it was before easily.

It also has a nice and easy to use windows interface.

But first we have to agree on the classes and hierarchy and what they'll do. I hate Software Engineering crap, but a we need at least some "back of an envelope" planning :smile:
 
I figured it was some kind of version control. I've just have never used that one.

Here is how I see the class layout. A .brf file is a collection of resources. So, what we need is a parser that will read an input stream and provide a collection of resources and a formatter which can be used to take a collection of resources and write it to an output stream.

Of course other parsers and formatters can be written to read and write from different formats, using the collection of resources produced.

So here is a very simple class layout (not many members). Let me know what you think. If this seems good to you all, I'll flush it out more and put up an initial version for more comments.

Code:
namespace brf {

enum ResourceType
{
  Rt_Texture,
  Rt_Shader,
  Rt_Material,
  Rt_Skeleton,
  Rt_Body,
};

enum BodyComponentType
{
  Bct_Composite,
  Bct_Sphere,
  Bct_Capsule,
  Bct_Face,
  Bct_Manifold,
};

//
// Resource classes
//
class Resource {};
class Texture : public Resource {};
class Shader : public Resource {};
class Material : public Resource {};
class Skeleton : public Resource {};
class Body : public Resource {};
class BodyResource {};
class Composite : public BodyResource {};
class Sphere : public BodyResource {};
class Capsule : public BodyResource {};
class Face : public BodyResource {};
class Manifold : public BodyResource {};

typedef std::list<Resource*> ResourceList;

class Parser
{
    void parse(std::istream& inp, ResourceList& resL);
};

class Formatter
{
    void format(std::ostream& outp, const ResourceList& resL);
};

}


The only one of these I don't know how to read is the skeleton. The others I can read in and write out (even though I don't know what is in them).
 
Looks great.
I have always had problems with stream oriented I/O, but i'll learn this time

I'd add some kind of ResourcePool class that holds collections of resources maybe one std::map per resource type.

Then, the brf file class can have one of those inside to manage its stuff, but an app that wants to read lots of brfs in can have a standalone resource pool in which to load everything it needs regardless of where it came from.

I'll send you a reader for the skeletons made in python.
 
I'm thinking just now that if we can get the collaboration working I might just try merge the BRF handling with your editor. Unofficial M&B Übereditor mwaharharharhar. :lol:

I was already thinking about moving the UI to .NET, as MFC is dated and plain tiresome to play with, so I might as well add to your fine codebase instead of hacking some ugly crap from scratch myself.

I'll try to get a subversion server up and running tomorrow and we'll see how it all works out. If it doesn't, i'll just try to keep your app layout and most inner workings and replace your stuff with mine.
 
Lurb said:
Looks great.
I have always had problems with stream oriented I/O, but i'll learn this time

I'll probably wrap it in some type of reader/writer class.

I'd add some kind of ResourcePool class that holds collections of resources maybe one std::map per resource type. Then, the brf file class can have one of those inside to manage its stuff, but an app that wants to read lots of brfs in can have a standalone resource pool in which to load everything it needs regardless of where it came from.

I was just going to return a std::list of Resource*. It would be easy enough to walk through the list for specific types if that was desired. Let me think about this a little though.

I'll send you a reader for the skeletons made in python.

Thanks. I'll incorporate that.

Lurb said:
I'm thinking just now that if we can get the collaboration working I might just try merge the BRF handling with your editor. Unofficial M&B Übereditor mwaharharharhar. :lol:

That's fine with me. I've now got it structured in such a way that we shouldn't have many collisions. Plus if we get it under version control that won't be much of an issue anyway.

I was already thinking about moving the UI to .NET, as MFC is dated and plain tiresome to play with, so I might as well add to your fine codebase instead of hacking some ugly crap from scratch myself.

Let me know. If we go to .NET, then I will write the library using the .NET C++. Unless Thorgrim decides he wants to use it to, but doesn't want to go to .NET.

I'll try to get a subversion server up and running tomorrow and we'll see how it all works out. If it doesn't, i'll just try to keep your app layout and most inner workings and replace your stuff with mine.

Sounds good.
 
Well the lib idea sounds great... but if you could keep it in standard C++ for the reading and writing that would be nice. I don’t see why you need any .NET stuff for simple IO anyway :razz:

I don't really mind either way though, the BRFlib Lurb has sent me already works perfectly well, and for now I dont need animated meshes, so its up to you guys.

I did vaguely have a thought about modifying the editor to allow editing BRF meshes... since the editor has the core features of a modelling tool now. But when I had a better think about it, its probably better to leave it up to tools like 3ds max etc.

I'd be happy to help you guys out with the viewer though, like camera control and any OpenGL stuff :smile:
 
Thorgrim said:
Well the lib idea sounds great... but if you could keep it in standard C++ for the reading and writing that would be nice. I don’t see why you need any .NET stuff for simple IO anyway :razz:

We don't. However, if we used a .NET lib with .NET executables, the executable is considerably smaller. That would be the only advantage.

I'll keep it as C++. I can always port it over if I feel like it.
 
I have the repository almost done, just gotta check connectivity past the uni. firewalls.

I was thinking about public read access, but commit rights just for effidian, n008, thorgrim and myself.

The windows client is Tortoise SVN which integrates nicely with the file explorer. I'll mail you the user/passwd and post a few directions about usage, which is pretty straightforward.

Effidian, have you made any changes to the mbedit source since the last update? if not, i'll import that into the repository as a starting point.
 
Meh, the stupid firewall won't let it through and the network guys aren't there, as always. I can sneak my way through it, but I'd rather not, they tend to get pissed :wink:
 
Here is the initial version of the brf library. It will read and write all the .brf files. I had it do the entire CommonRes directory and the output was identical to the input, so I think they are correct.

There is an example project included which does the copy, a dump, and it also duplicates the hex editing work that n00854180t did in that tutorial video.

All the "unk" data members are unknown. Types may be wrong etc. The Mesh and Skeleton are pretty flushed out, thanks to Lurb. I think you guys are going to know what that stuff is better than I, so if you can flush those structure out that would help.

Let me know what you guys think of the structure or whatever. I think it would be simple to use it to have import/export in other formats. Not many comments so let me know anything you are having trouble with.

Visual Studio 6 project. C++/STL only.


Lurb: I'll go update the editor source. The one available is not the most current.
 
Efficient Effidian... wow. I'll have a look at it tonight.

BTW, I see you modded Blade... I went to school in the 80s with one of the main devs of that game. He was friggin' brilliant already back in those days.
 
Lurb said:
Efficient Effidian... wow. I'll have a look at it tonight.

Great.

BTW, I see you modded Blade... I went to school in the 80s with one of the main devs of that game. He was friggin' brilliant already back in those days.

Nice. Blade is by far my favorite melee combat game. I really wish they could have stayed in business and put out another game (or 10).
 
I've been looking at it for a while before dinner, looks awesome, I'm itching to start replacing the "unks", but don't want to touch the code without being sure than we can merge it safely afterwards if you make any changes.
The same with adding new brf related pages to your editor.
 
Lurb said:
I've been looking at it for a while before dinner, looks awesome, I'm itching to start replacing the "unks", but don't want to touch the code without being sure than we can merge it safely afterwards if you make any changes.
The same with adding new brf related pages to your editor.

I just put a new version of the brf library up with a couple minor changes. Grab that and you can work on that. I won't touch it until you get it up on version control.

How do you see the brf pages working in the editor? Would it just allow you to import meshes for the mod you have open? Have we got mod specific meshes working yet?
 
Back
Top Bottom