porting, where to begin with?

I'm starting to fancy about porting Box2D onto my basic-dialect, however I don't know where to start!
Any suggestions?, I already have a basic vector library from another project, perhaps I should begin with supporting all this first?.

Will I have to port the whole sources to obtain a result or could I just begin with, let's say; dynamics?

Thanks.
When we did the Java port, we just literally went through everything doing a textual translation, then loaded it up in Eclipse and kept fixing errors until it compiled, then worked out all the bugs until it actually ran correctly. That seemed to work pretty well, but Java is a lot closer to C++ than Basic...you might need to do some more serious restructuring, I'm not sure, it's been many years since I did any Basic.

If you want to leave something out, you probably don't need all the joint types to start, and you can probably leave out the circles. You may also be able to get away without the broadphase (which was a pretty big headache for us...) if you provide a severely trimmed down every-pair-checked broadphase that follows the same interface.

Unfortunately, I think most of everything else needs to be there for the thing to work, or at least there are not too many files you can skip altogether without needing lots of changes in all the other files.

Out of curiosity, what type of Basic are you using? It has classes and inheritance, I hope?
Thanks for your answer!

It's an actual in-house language, I'm afraid I don't have OOP support but I've been writing a pre-processor for it, which as it turns out isn't as advanced as all the OOP support c++ or java does have...

My biggest concern is that, even though I can fake OOP, many things will have to be restructured and that's a big headache right there!.

For instance.. I don't have "Operator" - so I would have to deal with this mess by hand, that's my biggest concern right now.
Umm sorry to double post but I had to ask something else regarding porting:

What tools do you use to compare in-between the different versions of the source files as they get updated on the original SVN?

That's my main concern right now, if I port I want to keep on updating my sources, but I don't have any good tools to spot the original chances...

Thanks
Right, we had to hand-write all the operator stuff in the Java port, too, since you can't redefine operators - it's really not too awful, it just takes a little while the first time through. Just be pretty careful. The trickier things by far were dealing with reference vs. pointer issues and object initialization.

To get updates, I just connect up to the C++ repository via any SVN-aware editor - Eclipse handles this fine, even though it's terrible for actual C++ coding. Then you can compare any version to any other and see the changes, so the problem just becomes figuring out which version you've updated to already. You can also do this online from the sourceforge page's SVN browse - just diff the current files to whatever ones you've already updated to. A little bookkeeping is needed, but it's no huge problem. We're currently one last-digit release behind, which reminds me - I've got to get back on track!

Sounds like a tricky port, though - everyone else has at least ported to some similar Algol-esque syntax language. I wish you the best of luck, feel free to ask for help if you need it, though I'm not much of a Basic expert.

I was also going to suggest to you to check out Diggsey's DarkBasic bindings, but I saw you already posted on that thread, so I assume that's not an option for you.
@nielson
That's a big coincidence! I'm also writing an OOP precompiler for DarkBasic Pro, the language that my wrapper is for! 😮
What a small place the world is 🙂

I'm beginning to think that it'll take longer to implement a stable preprocessor than simply porting the whole thing to a non-oop structure...
😠
In general, it's much better to write some glue that allows your language to call into the existing library, than to try to rewrite the library. (For example, look at the Ruby wrappers for Box2D.)

Why?

* You don't have to mess with, and rewrite, (and re-architect, without OOP) the innards of a large and extremely complicated codebase, just its public API.
* You don't have to keep tracking every single update to Box2D, then translating it into your language and hand-merging it into your code. This is generally considered impractical even when the divergent code is in the same language (it's the reason open-source projects don't fork much.)
* No offense, but rewriting the code in an interpreted language would probably cause it to run at least an order of magnitude slower, possibly two. (See the "Great Computer Language Shootout" website if you don't believe me.) That's bad news for something as compute-intensive as a physics simulator.

Original thread: https://box2d.org/forum/viewtopic.php?t=101