BBC BASIC for Windows
« BOX2DLIB library (beta) released »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:58pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: BOX2DLIB library (beta) released  (Read 1817 times)
admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx BOX2DLIB library (beta) released
« Thread started on: Jan 28th, 2013, 5:11pm »

I'm pleased to announce a beta release of BOX2DLIB.BBC, the BB4W wrapper library for the Box2D Physics Engine:

http://tech.groups.yahoo.com/group/bb4w/files/Box2D/box2dlib.zip

The ZIP file contains BOX2DLIB.BBC, Box2D itself (as BOX2D221.DLL), BOX2DDBG.BBC (which supports the DebugDraw interface) and an example program 'Hello_Box2D.BBC'. BOX2DLIB.BBC, BOX2DDBG.BBC and BOX2D221.DLL must be copied into your BB4W libraries (LIB) folder; you will require Adminstrative Privileges to do that.

Hello_Box2D.BBC reproduces the functionality described in Chapter 2 of the online Box2D manual here:

http://www.box2d.org/manual.html#_Toc258082968

It incorporates a large amount of descriptive text, adapted from that in the manual, which should be read as an introduction to physics engines in general and Box2D in particular. Further details of Physics Engines can be found on Wikipedia:

http://en.wikipedia.org/wiki/Physics_engine

This beta release of the library provides extensive support for the most important Box2D features, including:

  • Body types: Static, Dynamic, Kinematic.
  • Fixture types: Box, Polygon, Circle, Chain.
  • Joints: Distance, Friction, Gear, Mouse, Prismatic, Pulley, Revolute, Rope, Weld, Wheel.
  • Motors: Prismatic, Revolute, Wheel.
  • Collision detection and filtering, Forces, Sensors, User Data.
A total of twenty sample programs are provided, each illustrating a few features of Box2D. These are supplied as the menu program SAMPLES.EXE which also saves the source files to its directory when run:

http://tech.groups.yahoo.com/group/bb4w/files/Box2D/SAMPLES.EXE

The sample programs all use the DebugDraw interface to display their output.

Richard.


User IP Logged

ScriptBasic
Guest
xx Re: BOX2DLIB library (beta) released
« Reply #1 on: Jan 16th, 2014, 5:49pm »

Richard,

Is there a chance that the files being pointed to on Yahoo Groups files repository be made available here? The Yahoo mailing list/site seems closed and no way to access them as a non-member.

I'm curious what your thoughts are about using Chipmonk 2D Physics instead?

John
« Last Edit: Jan 16th, 2014, 6:55pm by ScriptBasic » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: BOX2DLIB library (beta) released
« Reply #2 on: Jan 16th, 2014, 9:27pm »

on Jan 16th, 2014, 5:49pm, ScriptBasic wrote:
Is there a chance that the files being pointed to on Yahoo Groups files repository be made available here?

Which particular files are you looking for? I copied what I thought were the most important ones into the Wiggio group's folder, from where they can be downloaded even by non-members. But it was a time-consuming process and I only transferred a small subset.

Quote:
The Yahoo mailing list/site seems closed and no way to access them as a non-member.

Only members can access the files, but there's nothing stopping you joining specifically for that purpose. Membership is still open to anybody, even though posting messages is currently disabled.

Quote:
I'm curious what your thoughts are about using Chipmonk 2D Physics instead?

A huge amount of effort went into making Box2D accessible from BBC BASIC, and as it is I'm somewhat aggrieved that (despite the initial enthusiasm) so little use has been made of it. There's not the slightest chance that I would consider spending time interfacing to an alternative 2D physics engine. cry

Can I take this opportunity to ask all BBC BASIC users to take another look at Box2D and the amazing things you can do with it. A couple of compiled BBC BASIC Box2D demos are here:

crates.exe
SAMPLES.EXE

And here's the YouTube video of the Ball Bearing Clock:



Richard.
« Last Edit: Jan 16th, 2014, 10:35pm by admin » User IP Logged

ScriptBasic
Guest
xx Re: BOX2DLIB library (beta) released
« Reply #3 on: Jan 17th, 2014, 01:19am »

Great stuff Richard.

I have downloaded the libs and examples and look forward working with it.

Update

I can get the Box2D chain example to run from the IDE but it can't find the BOX2DLIB.DLL if run from the compiled form. I even tried putting the DLL in the same directory as the program.

« Last Edit: Jan 17th, 2014, 02:06am by ScriptBasic » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: BOX2DLIB library (beta) released
« Reply #4 on: Jan 17th, 2014, 08:41am »

on Jan 17th, 2014, 01:19am, ScriptBasic wrote:
it can't find the BOX2DLIB.DLL if run from the compiled form. I even tried putting the DLL in the same directory as the program.

To successfully embed the DLL in the compiled EXE it must be in one of two places: either in the BB4W library directory (@lib$) or in the same directory as the program (@dir$) - or in a sub-directory of one of those places.

So long as that is the case the only remaining requirement is to ensure that the DLL is correctly embedded when the program is compiled. The best way is probably to incorporate a REM!Embed compiler directive in the program, but if you don't want to bother with that you can simply add the DLL manually in the Compile dialog (Add @dir$ or Add @lib$ buttons).

http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin1.html#directives
http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin1.html#embedded

Richard.
« Last Edit: Jan 17th, 2014, 09:03am by admin » User IP Logged

ScriptBasic
Guest
xx Re: BOX2DLIB library (beta) released
« Reply #5 on: Jan 17th, 2014, 4:07pm »

The compile dialog showed the two library resources being included. All the library related files where put in the LIB directory of BBC4W. When the compiled app didn't work, I copied the DLL to the same directory as the .exe. I then copied it to the sysWOW64 directory with no luck. Works fine running from the IDE.

User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: BOX2DLIB library (beta) released
« Reply #6 on: Jan 17th, 2014, 4:23pm »

on Jan 17th, 2014, 4:07pm, ScriptBasic wrote:
The compile dialog showed the two library resources being included.

There should be three embedded resources in total for CHAIN.BBC to work. If your Compile dialog shows only two that will be why it isn't working!

Here's a version I compiled: chain.exe

And for those who missed it the first time round, here's Svein's 'Pintograph' drawing machine with my added Meccano (TM) graphics: pintograph.exe

Richard.
User IP Logged

ScriptBasic
Guest
xx Re: BOX2DLIB library (beta) released
« Reply #7 on: Jan 17th, 2014, 5:41pm »

Your chain.exe works fine. I added the BOX2DGFX.BBC to the lib include listbox (making 3 resources) but I'm still getting the same error.

User Image

I checked the temp directory created and there was no BOX2D221.DLL present. I copied from the LIB but it still doesn't work.

Can I assume that compiling BBC4W applications really means packing up the interpretive files into a bundle and executed with the runtime when uncompressed by the packaging code?

Update

I added the BOX2D221.DLL to the project and it now works from the exe created directory. Just to undo the confusion, these are library files needed to make chain.exe work standalone.

BOX2D221.DLL
BOX2DDBG.BBC
BOX2DLIB.BBC

FYI - When running the chain.exe it uses 50% of of both of my CPU cores. I would guess if I had a single core processor, I would be running at 100% CPU utilization.

« Last Edit: Jan 17th, 2014, 7:29pm by ScriptBasic » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: BOX2DLIB library (beta) released
« Reply #8 on: Jan 17th, 2014, 7:59pm »

on Jan 17th, 2014, 5:41pm, ScriptBasic wrote:
Can I assume that compiling BBC4W applications really means packing up the interpretive files into a bundle and executed with the runtime when uncompressed by the packaging code?

Indeed so.

Quote:
I added the BOX2D221.DLL to the project and it now works from the exe created directory.

As I mentioned, the safest method is to add a compiler directive in the source program:

Code:
REM!Embed @lib$+"BOX2DLIB.BBC", @lib$+"BOX2DDBG.BBC", @lib$+"BOX2D221.DLL" 

Quote:
I would guess if I had a single core processor, I would be running at 100% CPU utilization.

It shouldn't - there's a WAIT 1 (10 millisecond sleep) in the main loop. On my Windows 8.1 laptop (1.9 GHz Intel Core i7) it uses about 8% CPU. Does Wine support hardware-accelerated graphics?

Richard.
« Last Edit: Jan 17th, 2014, 8:18pm by admin » User IP Logged

ScriptBasic
Guest
xx Re: BOX2DLIB library (beta) released
« Reply #9 on: Jan 17th, 2014, 9:55pm »

Quote:
Does Wine support hardware-accelerated graphics?


Supposedly for OpenGL/SDL. Not sure what Box2D is using.

« Last Edit: Jan 17th, 2014, 9:55pm by ScriptBasic » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: BOX2DLIB library (beta) released
« Reply #10 on: Jan 17th, 2014, 10:02pm »

on Jan 17th, 2014, 9:55pm, ScriptBasic wrote:
Supposedly for OpenGL/SDL. Not sure what Box2D is using.

GDI+ for the Debug Draw interface (which is what chain.bbc is using).

The idea is to use Debug Draw during development, because it makes everything 'visible', but when all the physics is working as it should you switch that off and then render the final graphics however you prefer.

The crates and pintograph examples happen to use a mixture of custom assembler and GDI (in the BOX2DGFX library), but could just as well use SDL or OpenGL, in principle.

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls