Re: Ocean Simulator: The research continues...

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

simonharvey
Posts: 0
Joined: Tue May 18, 2004 8:11 am

Post by simonharvey » Mon Sep 19, 2005 2:19 am

Well I fired up NEdit again to have another crack as the code (as part of a break from my masters) and did some debugging.

Now the code looks at the bmx directory for modules, it checks for the extensions ".so" for unix and ".dll" for windows. If after doing further checks it finds that it is valid it adds it to a linked list, otherwise it finds the next entry in the directory.

As it is doing this you can just see the status bar move across the bottom of the splash screen (it is very fast) -- and very cool!

Since I havent made any BMX's yet this is as far as I can go for now: The module loading and swapping routines are in place and so is a reasonably capable core API but that will have to wait. but these still need to be debugged.

I have already have in my mind some ideas of how to expand the current API method so as to allow python methods to be called directly from C and C methods to be called directlly from Python however this will have to wait as I would like to get some "clay" to work with before I go about doing any cool stuff.

Anyway, This project still hasn't been forgotten.

Kind Regards
Simon Harvey

jesterKing
Site Admin
Posts: 207
Joined: Fri Oct 18, 2002 12:48 pm
Location: Finland

Post by jesterKing » Mon Sep 19, 2005 8:44 am

simonharvey wrote:I have already have in my mind some ideas of how to expand the current API method so as to allow python methods to be called directly from C and C methods to be called directlly from Python however this will have to wait as I would like to get some "clay" to work with before I go about doing any cool stuff.
I'd be happy if the API for scripting would be as 'generic' as possible. I'm currently working on embedding Lua in Blender (and extending it with Blender data, naturally. See BLU on the wiki). Having a 'generic' API for that could potentially allow for other scripting languages to be added to Blender. I don't know if it is desirable at all (or possible). Anyway, this is probably something that could/should be discussed with the BPy team, too.

/Nathan

simonharvey
Posts: 0
Joined: Tue May 18, 2004 8:11 am

Post by simonharvey » Tue Sep 20, 2005 4:32 am

jesterKing wrote:Anyway, this is probably something that could/should be discussed with the BPy team, too.
Agreed

I am thinking that the only thing that the Bpy team need to know is how to create/access and release an interface, the actual interfaces themselves would be created by individual developers who would not need the blessing of the python team to implement and use other modules.

In terms of implementation details it is going to be more like JNI meets makesdna so it would really be more of an architectual thing (think ton & the gang). However all of this is in the future and should be treated as vaporware for now.

Kind Regards
Simon Harvey

simonharvey
Posts: 0
Joined: Tue May 18, 2004 8:11 am

Post by simonharvey » Fri Oct 28, 2005 6:20 am

Hi All
I thought that an update would be in order: I am almost in at the hand in stage with my Masters, with the last boring parts to do (tedious).

I have been doing some loose coding every now and then on ModBlender: It can now dynamically load up a test BMX however it seems to crash when it gets to the debuging APIs (oh the irony!!!).

I am sorry for the lack of progress and updates over the last several months, I spend about 30min/day on the blender.org forums looking for anything intresting when I could perhaps be doing something alot more fruitful such as coding, debugging or (gasp!!) finishing my masters thesis!!!
Anyway, there are lots of changes that I would like to make to the code but right now it is just trying to get something out of the door.

Kind Regards
Simon Harvey

jesterKing
Site Admin
Posts: 207
Joined: Fri Oct 18, 2002 12:48 pm
Location: Finland

Post by jesterKing » Fri Oct 28, 2005 7:25 am

Do you have any code available for study?

Btw, I just transferred the contents of OceanSimulator and ModBlender from the old wiki to the new one here and here. If you could check the code bits (my parser/converter didn't handle those that gracefully), we'd be grateful.

/Nathan

simonharvey
Posts: 0
Joined: Tue May 18, 2004 8:11 am

Post by simonharvey » Thu Nov 17, 2005 1:39 am

I have just handed in!

The two WIKI pages look ok, and a release showing the basic functionality:
*module loading
*core API functionality

Shouldn't be far away

Kind Regards
Simon Harvey

simonharvey
Posts: 0
Joined: Tue May 18, 2004 8:11 am

Post by simonharvey » Fri Nov 18, 2005 12:04 am

simonharvey wrote:Shouldn't be far away
Can anybody spare ~12MB of server space on an HTTP server to upload the source files to?

It must have an HTTP interface (ie. web form). I am sorry if this asking for too much but I have tried FTP and SFTP but I am just getting no love with these.

Kind Regards
Simon Harvey

kidb
Posts: 0
Joined: Wed Jul 23, 2003 4:31 pm
Contact:

Post by kidb » Fri Nov 18, 2005 7:55 am

simonharvey wrote:
simonharvey wrote:Shouldn't be far away
Can anybody spare ~12MB of server space on an HTTP server to upload the source files to?

It must have an HTTP interface (ie. web form). I am sorry if this asking for too much but I have tried FTP and SFTP but I am just getting no love with these.

Kind Regards
Simon Harvey
mailto kidb at kidb dot de

jesterKing
Site Admin
Posts: 207
Joined: Fri Oct 18, 2002 12:48 pm
Location: Finland

Post by jesterKing » Fri Nov 18, 2005 1:33 pm

Three cheers for kidb's mirrorring and download services!

/Nathan

simonharvey
Posts: 0
Joined: Tue May 18, 2004 8:11 am

Post by simonharvey » Mon Nov 21, 2005 12:45 am

jesterKing wrote:Three cheers for kidb's mirrorring and download services!
Indeed!

Anyway, I thought that I should write this up just to prepare thoes who have a proper build system of what to expect. These points are in no order.

1. This has been written for my linux system (Fedora Core 1), it uses the blender defiled APIs for DLL loading however there may be some problems on non-UNIX-like operating systems. Code has been added to allow for it to theoretically load up windows DLLs but this of course hasnt been tested.

2. the main code can be found in:
$ROOT$/source/blender/src/module-core.c
most of it hasnt been debugged for this release, just the basics:
* module loading; and
* core API functionality
The module code, ie. MOD_SendMessage() is there, but it just hasnt been debugged because i have been with this project for a very long time now and I just wanted to have something public to show for it.

3. You will need to treat this as a Blender 2.31 installation, since that was the code base that I started off with. I would have tried other, much more recent releases, but I always had TTF library problems (the headers).

4. The status bar on the splash screen whips accross so fast that it looks like it has done nothing, This would change with more modules.

5. The api->error() API write its output to an error log in: $ROOT$/logs (ie. an added directory) which is closed and flushed after every,

Code: Select all

api->error("Some thing really, really bad happened, and after  this error gets written to this file then blender is going to crash\n");
The module that the error happenned and the binary in which it occured in are also added to the error message. The log file is created at program initalisation and whose main purpose is to aid in developers in debugging their eXtensions.

Example:

Code: Select all

 
Module error log, created: Mon Nov 21 12:22:11 2005

*************************************************************
Error:
Error string 7 - my lucky number!
 
Descr: Module ID: 0 Class: NULL
Binary: Trans-application binary
This would have been written with:

Code: Select all

api->error("Error string %d - my lucky number!\n", 7);
6. There is another directory: $ROOT$/bmx that contains the directory with the binaries in it. At boot time this is checked, and if any files contain a *.so (on UNIX) or *.dll (on Windows) then it is loaded with the PIL_dyn_* APIs, the module_init() function is then loaded and then the eXtension gets a change to do version detection and register its services within ModBlender. The function where all of this happens is within MOD_InitSplash(), which is the same as splash() but dows a whole lot more work!

Anyway,
Once kidb get the emails through (hopefully the 10MB limit has not been set on his account!) the two archives will be concatinated and you all can have a play.

Kind Regards
Simon Harvey

kidb
Posts: 0
Joined: Wed Jul 23, 2003 4:31 pm
Contact:

Post by kidb » Mon Nov 21, 2005 7:22 am

simonharvey wrote: Anyway,
Once kidb get the emails through (hopefully the 10MB limit has not been set on his account!) the two archives will be concatinated and you all can have a play.

Kind Regards
Simon Harvey
http://blendertestbuilds.de/index.php?d ... /20051121/

simonharvey
Posts: 0
Joined: Tue May 18, 2004 8:11 am

Post by simonharvey » Mon Nov 21, 2005 9:31 pm


jesterKing
Site Admin
Posts: 207
Joined: Fri Oct 18, 2002 12:48 pm
Location: Finland

Post by jesterKing » Tue Nov 22, 2005 8:17 am

And downloaded :)

/Nathan

ps. explicit expression of implicit thankfulness

simonharvey
Posts: 0
Joined: Tue May 18, 2004 8:11 am

Post by simonharvey » Thu Nov 24, 2005 1:34 am

Well, now that I have handed in and looking for a job I have had some time left over for debugging module-core.c, and in doing so have had to create some extra modules:

Image

The reason why I gan give you this screenshot is because somewhere is an infinite loop causing the bootup sequence to freeze...

The next release will have basically the message passing subsystem working as well as some more of the APIs (memory, DLL loading and the APIs assioacated with module instanting). And, maybe after that some kind of a module build system (based on scons of course) however that is for the future.

I have been playing around with code from JamVM (the JNI stuff) that allows Intel i386 users to call a C style function dynamically (using a function prototype provided at runtime as opposed to compile time). This is going to be handy when a C interface gets added such that you want to call it from python but cant use a specially written C wrapper.


That is all from now,
Kind Regards
Simon Harvey

djfuego
Posts: 16
Joined: Wed Oct 16, 2002 11:30 am
Contact:

Mmmmm

Post by djfuego » Mon Dec 19, 2005 8:11 pm

Is this going to be added to blender before Xmas 05?

Post Reply