Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / The Matrix1Utils plugins collection

Author
Message
Ermes
16
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 6th Apr 2011 01:56
hi, any example on this?

FILL x, y, Fill Colour
FILL x, y, Fill Colour, Border Colour

is from util_30, the second fill didn't find the border Colour,
i'm going to use this plugin to make filled irregulars polygons.

BTW, any plugin for filled irregulars n-gons???

many thanks!


Ciao facce da sedere!
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 6th Apr 2011 16:04 Edited at: 6th Apr 2011 16:10
Quote: "the second fill didn't find the border Colour"

Yeah, it appears to be a difference in how difference graphics cards pass back colours to the fill routine - some pass back a colour with alpha (my code assumes this), and some pass it back without the alpha.

I'll see if I can change the code to ignore alpha when looking for a border pixel.

I don't have any routines for drawing irregular filled polygons - I'll add it to my list.

Ermes
16
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 7th Apr 2011 11:53
Quote: "I don't have any routines for drawing irregular filled polygons - I'll add it to my list.
"


Great!


Ciao facce da sedere!
Zergei
14
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 8th Apr 2011 18:28
@IanM : Is it ok for the MEMORY SIZE command from the Matrix1Util_04 to return the size of the allocated memory, despite having free it with the FREE command?



Also, if it's posible to reduce in size allocated memory in the following way...



Further on my stuff at...
TurboSquid.com
The3dStudio.com
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Apr 2011 19:45
No, to both questions.

Raw memory allocation, using those commands, most definitely comes under the heading of 'unsafe'.

As soon as you free the memory, it is no longer your memory, and you should do nothing with it at all - no memory access of any type in any way (including reading from it!), which definitely includes the MEMORY SIZE function. Basically, don't do that.

You should only ever free a memory address you allocated - you didn't allocate 'ID+1', so that not an address you can free. You certainly can't resize an allocation in that way - if you want to reduce your allocation size, then you should use the REALLOC or REALLOC ZEROED functions, which may return either the same address, or a completely different one, but with the same content either way.

In addition, depending on the OS, the minimum allocation units are either chunks of 16 bytes or 32 bytes anyway, so a lot of reallocations are a wasted effort.

The reason that those kinds of checks aren't built into that plug-in is that they are faster without checks and also do not use extra memory. If you want safe commands, you should use either memblocks or memory banks instead - almost anything you can do with raw memory can be done with memblocks or memory banks.

I think I'm going to rename that plug-in from 'Raw Memory access and String Allocation' to 'Unsafe memory access' to make a point. I'll add the above to the help files too.

Zergei
14
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 8th Apr 2011 20:51
Thanks IanM for the detailed explanation.

The reason for my question was that i'm trying to emulate any-type arrays (that is, array that can store any type of data, including other arrays, in the same array). I was almost achieving this by using you 'Raw Memory access' functions, and being very carefull not to have memory leaks or accessing memory i shouldn't. (The previous post code where just examples, not real code)

However, i didn't knew there was a minimum allocation unit, and that gets me worried that all i've done has to be restructured to contemplate this, or even dumped.

Sorry to throw this on your thread, but do you have any thoughts/advice about this?

Further on my stuff at...
TurboSquid.com
The3dStudio.com
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Apr 2011 23:08 Edited at: 8th Apr 2011 23:09
Without any detail, I'm not sure that I have any advice to give. Except for one piece: I suggest that you always wrap your raw memory accesses in functions, purely to add some safety.

Here's a basic doubly-linked list that stores a single value as an example (could store a number as I've done, or a pointer to another list or object etc):


Zergei
14
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 8th Apr 2011 23:40
Thanks IanM a lot. The approach you took is by far easier and faster than mine, although it uses up more alloc memory.

I'm intrigued to know if you already had this functions, or if you cooked them up just now. Either way, i think this functions would help out many.

If you haven't showed them of, then you should, or at least those are my thoughts.

Once again, thanks.

Further on my stuff at...
TurboSquid.com
The3dStudio.com
GIDustin
11
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 10th Apr 2011 06:23
IanM:

Noticed a possible bug today. I do not think your datafile commands look in attached media for the file. I want to "open datafile to read" a text file that is attached to the EXE and it keeps failing.

Thanks!

IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Apr 2011 14:30
Yeah, I kinda ducked that one deliberately, and I'll try to explain why.

DBPro file IO works like this:
OPEN TO READ - uses the attached media
OPEN TO WRITE - does NOT use the attached media

That means that when you write a file, then re-open it to read it later, you can get the contents of a different file. Admittedly, that usage isn't going to happen often, but imagine your program is driven using a settings file - you want to have your default settings file attached, but allow the user to change it. You can't do that easily with the DBPro file commands.

My file IO works like this:
OPEN DATAFILE TO READ - does not use attached media
OPEN DATAFILE TO WRITE - does not use attached media
OPEN DATAFILE TO APPEND - does not use attached media
OPEN DATAFILE TO UPDATE - does not use attached media

That means that whatever you write can be read back, but there's no automatic way of reading attached media.

However, there is a way to read attached media if you need to. If you have a file called 'xyz.txt' and want to read it:


If all you want to do is read the file, then just do something like that (warning: Won't work with DBPro encrypted exe's).

Using the settings file example again, when you open the file to read it you can check if the local file exists, and if not, open the attached media file instead. Or you can copy it to the local directory before opening it (using the DBPro COPY FILE command).

GIDustin
11
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 10th Apr 2011 22:01
My problem was that I had a directory full of images that I wanted to loop through, but since all the files in the directory were included in the exe, "find first" couldn't see them. So I thought, why not make a text file with all the files listed, and just loop that, but your commands couldn't open that.

The file isn't that big. I will just use the standard file commands to open it. I do see where you are coming from with leaving that feature out of yours.

And thanks for that temp() command. Didn't notice that one.

GIDustin
11
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 12th Apr 2011 08:18
IanM:

I am glad you pointed me to "DIR DBPRO TEMP()". I went to the help file to see what else was there. I saw you had a "DIR DOCUMENTS", but when I call it with Windows 7 64 bit, it returns an empty string. I can test the other directory commands tomorrow but I know at least that one isn't working. The built in "MYDOCDIR$()" works fine.

=PRoF=
16
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 12th Apr 2011 09:47
@GIDustin:
I think u need to update your Matrix1 plugin set. IanM fixed that bug with the newest version.

IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Apr 2011 12:55
Anyone planning on updating might want to wait until the end of the week (unless it's urgent of course) - I'm working to get a new release ready right now.

RiiDii
14
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 14th Apr 2011 17:46
Hey IanM, I am back coding and have found a need for a command that others might also find useful. Unfortunately it might create a new category in your utilities, but maybe you have some other ideas as well.

If you have an object and want to manipulate it's position by only a single axis, you have to read the object's other two axises and then reposition the object with the new axis. See the code snippet for an example.

It would be great to have a command that can accomplish this without the extra reading of the object's position. This would create three new commands, for example:

Position Object X ObjectID, PosX#
Position Object Y ObjectID, PosY#
Position Object Z ObjectID, PosZ#

Code snippet for Position_Object_X function.


Thanks for all the other commands you've created - they have been extremely useful.
BatVink
Moderator
16
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 14th Apr 2011 17:50
You already have:

MOVE OBJECT (Z)
MOVE OBJECT LEFT (X)
MOVE OBJECT UP (Y)


RiiDii
14
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 15th Apr 2011 08:09 Edited at: 15th Apr 2011 08:10
Unfortunately, those are all based on the object's current orientation. If the object is rolled 90 degrees, Move Object Left will move the object along the y-axis, not the x-axis.
RiiDii
14
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 16th Apr 2011 17:50
Batvink, your advice did give me an idea for some more commands that could fit into the same category.

Move Object X. Move Object Y. Move Object Z.
These commands would move the object along the designated axis. There could be two versions, commands that just moves the object, and functions that return the new axis position.

Example 1: Move Object X ObjectID, Distance
Example 2: Return Float = Move Object X(ObjectID, Distance)

These commands would reduce the number of lines needed when programming momentum physics.
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Apr 2011 21:28 Edited at: 17th Apr 2011 01:21
Those commands you suggest seem to be very specific to you and not a lot of use to others - right now I'm not inclined to add them, unless you can give me a good reason to.

Anyway, new release!

Here are the details:

Release 20110416b

Matrix1Util_01 - 1.1.0.6
- Added RESERVE FREE BANK, RELEASE RESERVED BANK and BANK RESERVED commands/functions.

Matrix1Util_02 - 1.1.0.11
- Added RESERVE FREE TICKER, RELEASE RESERVED TICKER and TICKER RESERVED commands/functions.

Matrix1Util_03 - 1.1.0.7
- Added RESERVE FREE SYSOBJ, RELEASE RESERVED SYSOBJ and SYSOBJ RESERVED commands/functions.

Matrix1Util_05 - 1.1.0.9
- Switch to alternate & much faster versions of FIND FREE XXX, where XXX means:
-- ANIMATION, BITMAP, CAMERA, DLL, FILE, LIGHT, MATRIX, MEMBLOCK, MESH,
-- MUSIC, PARTICLE, EFFECT, PIXEL SHADER, VERTEX SHADER, SOUND, TERRAIN.
- Added RESERVE FREE XXX, RELEASE RESERVED XXX and XXX RESERVED commands/functions, where XXX means:
-- ANIMATION, BITMAP, CAMERA, DLL, FILE, IMAGE, LIGHT, MATRIX, MEMBLOCK,
-- MESH, MUSIC, PARTICLE, EFFECT, PIXEL SHADER, VERTEX SHADER, SOUND,
-- SPRITE, TERRAIN.
- Removed RESOURCE SEARCH command as is no longer necessary.
- Revised all ranges to comply with the DBPro source code.

Matrix1Util_07 - 1.1.0.8
- Added DEGTORAD and RADTODEG functions for floats and double floats.

Matrix1Util_08 - 1.1.0.5
- Added RESERVE FREE RNG, RELEASE RESERVED RNG and RNG RESERVED commands/functions.

Matrix1Util_16 - 1.1.0.9
- Modify TRIMLEFT$, TRIMRIGHT$ and TRIM$ to trim all whitespace types, not just space.
- Modify DELIMIT CSV$ to protect all leading/trailing whitespace types, not just space.

Matrix1Util_18 - 1.1.0.12
- Fixed texturing bug in MAKE OBJECT PLANE.
- OBJECT GLUED LIMB now returns -1 if not glued instead of 0 (can glue to limb 0).

Matrix1Util_19 - 1.1.0.9
- Added RESERVE FREE OBJECT, RELEASE RESERVED OBJECT and OBJECT RESERVED commands/functions.
- Revised resource range to comply with the DBPro source code.

Matrix1Util_20 - 1.1.0.11
- Fixed resource string for COROUTINE EXIST.
- Added code to capture returned results from function calls on a per-coroutine basis.
- Added RETURNED [type] functions to retrieve saved results on a per-coroutine basis.
- Added RESERVE FREE COROUTINE, RELEASE RESERVED COROUTINE and COROUTINE RESERVED commands/functions.

Matrix1Util_21 - 1.1.0.7
- Added RESERVE FREE ZONE, RELEASE RESERVED ZONE and ZONE OBJECT commands/functions.

Matrix1Util_22 - 1.1.0.13
- Fixed cleanup of file handles when the plug-in shuts down.
- Added RESERVE FREE DATAFILE, RELEASE RESERVED DATAFILE and COROUTINE DATAFILE commands/functions.
- Update of code to use my standard error trapping.

Matrix1Util_28 - 1.1.0.1
- Corrected help for the NET FORMAT TO [type] functions.

Matrix1Util_30 - 1.1.0.3
- Floodfill to border was filling 1 pixel short of the right-hand side.
- Floodfill to border will now ignore the alpha value of the colour when searching for the border.

Matrix1util_31 - 1.1.0.2
- Added RESERVE FREE LOOKUP, RELEASE RESERVED LOOKUP and LOOKUP RESERVED commands/functions.
- Fixed errors when null strings are passed in (treat them as empty strings).
- Added GET LOOKUP SET MODE/SET LOOKUP SET MODE for dealing with empty key or value fields when setting lookups.

Matrix1Util_32 - 1.1.0.3
- Added RESERVE FREE VECTOR, RELEASE RESERVED VECTOR and VECTOR RESERVED commands/functions.
- Revised resource range to comply with the DBPro source code.
- Removed unnecessary internal mode changes in matrix4 commands.
- Added SET VECTOR3 TO MATRIX4 POSITION/ROTATION commands.
- Added VECTOR3 TO RADIANS/DEGREES commands.
- Renamed OBJECT LIMB MATRIX4 to SET MATRIX4 TO LIMB.
- Added commands SET VECTOR3 TO LIMB POSITION/OFFSET/DIRECTION/ROTATION.
- Renamed OBJECT MATRIX4 to SET MATRIX4 TO OBJECT.
- Added commands SET VECTOR3 TO OBJECT POSITION/ROTATION.

Adding all of those extra resource commands, and in fact, rewriting an entire plug-in for that purpose, took me far longer than I originally thought it would (I was hoping not to have to rewrite plug-in 5) - that's 116 new or replacement commands! In addition, the resources all now work using my super-fast algorithm and none of them carry out linear searches.

In addition, I've added a few new vector3 and matrix4 commands. Take care to read the help files for them, as for the rotation commands, there's a mixture of degrees/radians in there that reflects the usage within the standard DBPro commands (ie, reading rotation from the camera for example would be in degrees, but calculations on matrices are carried out using radians - I've reflected that, as much as I didn't really want to).

Attachments

Login to view attachments
GIDustin
11
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 16th Apr 2011 23:35
IanM:

I updated to your new set of DLLs today, and now alot of the sprites in my game are not working. I revert back to some 2010 version and the sprites work again. I have all my sprites hidden and "paste sprite" when I need them. The effected sprites do not seem to "paste" when I ask them too, almost as if they are invisible. It seems to be the same ones each time as well.

The game is rather large and I cannot figure out why it is working with the old set of DLLs and isn't working with the new set. Hopefully you can figure something out. I will see if I can come up with something, but exchanging your whole DLL set between the new and the old is what causes / fixes the problem.

IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Apr 2011 23:55
Can you try an reproduce the problem with a small piece of code?

Does the following work? If it does, can you tweak it until you can reproduce your problem?


What version of DBPro are you using?

While I think of it, can you make sure that you are drawing to the correct bitmap? (SET CURRENT BITMAP 0).

GIDustin
11
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 17th Apr 2011 00:17
IanM, I went through and determined which DLL is causing the problem. Its #20... I do make extensive use of function pointers, but I can't see why it affects my sprites and nothing else... I replaced every DLL I have with your newest version EXCEPT #20 and my game runs fine. I update #20 and I get the problems.

As for your questions, the above code runs fine. I am using the latest beta build. My bitmap never leaves "0" after my media is loaded, and all my other media displays fine. It isn't all sprites, but certain sprites. The code above also runs fine if I throw in some "get ptr to function" command to force it to load your newest #20.

The version of 20.dll that works is 1.1.0.9, your newest is 1.1.0.11. What all changed with those commands recently?

IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Apr 2011 00:50
.10 included minor changes to the stack allocation of coroutines.
.11 was a change to how returned values can be passed back by called functions. There are new functions for retrieving those values, which are stored on a per-coroutine basis, but unless you are using those new functions then nothing else should have changed.


I've attached a new copy of that plug-in with a minor change - see if that makes any difference to you (it already does for returning double float - they are correct in this version).

Attachments

Login to view attachments
GIDustin
11
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 17th Apr 2011 01:03
Quote: "I've attached a new copy of that plug-in with a minor change - see if that makes any difference to you"


The attached version solves the problem. The sprites work again. What was the problem?

And thanks for the fast response!

IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Apr 2011 01:15 Edited at: 17th Apr 2011 01:22
It appears that I was overflowing the floating-point stack, due to the changes I made for storing and returning values from a called function. The new code automatically clears the stack when returning a value (which is correct - on returning from a function the stack should be empty, unless you are returning a double float result - I am always returning a double float value, because I can't know what was actually returned).

I'll just double-check and make sure I've made all necessary changes, and then re-upload the zip file.

*** DONE ***

GIDustin
11
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 17th Apr 2011 03:36
Quote: "It appears that I was overflowing the floating-point stack, due to the changes I made for storing and returning values from a called function"


Here I thought you were some kind of mechanical alien with how much you work around TGC. It's reassuring to know that you too, are in fact human.

Quote: "*** DONE ***"


Thanks again!

RiiDii
14
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 17th Apr 2011 03:52 Edited at: 17th Apr 2011 03:54
Admittedly, the 'overall' usefulness is not much more than saving a few lines of code and maybe shaving off a few miliseconds of cycle time.

The reason why these would be useful to more folks than just myself is that these commands feel like they belong in DBPro and just have not been included. The Matrix utilities already include a few commands along these same lines - *edit*(that is, the reasons for adding them).

The first set of commands would probably quickly replace Position Object by most folks whenever a single axis is being changed - it is simply easier than having to pull, or store, current location data only to plug it right back in.

The second set of commands was an afterthought based on BatVink's feedback to the first set of commands. There are commands in DBPro that move the object relative to the object's orientation - why not have commands that move the object relative to the global orientation? Anyone programming momentum-based physics (and not using a physics add) may find these commands far more convenient than pulling current position data, calculating new coordinate positions, and then feeding the results back into a Position Object command.

The following three lines would be a solid base almost any momentum-based physics simulation from pinball to a space flight sim:

Move Object X ObjectID, MomentumX#
Move Object Y ObjectID, MomentumY#
Move Object Z ObjectID, MomentumZ#

The same code without these commands is more complex.

Thanks for considering the recommendations.
gwheycs62egydws
10
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 19th Apr 2011 01:10
IanM

project posted on Posted: 29th Jul 2006 09:55

Memory banks - expanded memblocks .

conflict with StyxCore.dll


Duplicate TRIM$ in StyxCore.dll and Matrix1Util_16.dll!
Command in 'StyxCore.dll' command-table unrecognized (TRIM$[%SSS%TrimStr)

it seems that StyxCore.dll and Matrix1Util_16.dll
have a similar command

if I take out StyxCore.dll every thing works fine
put it back and the error shows up again

If a thought is Just a thought ~ so whats the main thought ?
Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 19th Apr 2011 01:29
@Resourceful
This has been mentioned a number of times through this thread. IanM's version of trim existed first, and so on principle he's not going to change it. If you want to use styx, you have to remove Matrix1Util_16.dll from the plugins-user folder.

[b]
gwheycs62egydws
10
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 19th Apr 2011 01:57
Diggsey

I did not know IanM's existed first

it just I payed money for Styx and would like to use
every thing I collected to get the most out of every thing
gotten

I'd switch over to c++ or similar but it's beyond my understanding
at this point I am finally starting to understand how DBP works

I'm even fixed a couple of older examples of other people code
so that they work again

some thing I could not do a year ago but can do now

If a thought is Just a thought ~ so whats the main thought ?
GIDustin
11
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 19th Apr 2011 02:10
Quote: "If you want to use styx, you have to remove Matrix1Util_16.dll from the plugins-user folder"


You don't have to remove either. I have both, working side by side, for a long time now. The error specifically states that "trim$" is in both DLLs, and it tells you which version it will use. It still compiles and runs just fine.

BatVink
Moderator
16
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 19th Apr 2011 09:19
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 20th Apr 2011 01:06 Edited at: 20th Apr 2011 01:08
@enderleit,

In case you missed it, the new plug-ins include your requested functionality for resources.

Where you currently code the following for objects:


You can now code:


If you release an id, but the entity (object, sprite etc) it refers to still exists, then the entity will not be released back to the pool. The usual delete command for that entity will automatically release back to the pool as it has always done.

gwheycs62egydws
10
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 20th Apr 2011 01:20
thanks BatVink

the ResHacker did the trick now I can use both

"Styx" and "Matrix1Utility plug-ins"

I renamed trim$ to trima$
so if I use the command I just have to remember the change
I tried to make the change in Styx but was unable to locate the command

in 2 of the file for it I kept getting a kerne32.dll error
when went to look in a folder

but now I can do what I need

I would post the edited version of the "Matrix1Util_16.dll"

but I am not shire I would not receive flack for such

I updated the ini and the help for it so now I am all set

If a thought is Just a thought ~ so whats the main thought ?
freight hopper
15
Years of Service
User Offline
Joined: 26th Dec 2003
Location: Just beyond the Dunsmuir yard limits
Posted: 20th Apr 2011 06:23
I've depended on Matrix1Util_29 for years and my code would be glacial without it. Have an idea for you. I currently have a need to populate many and various pre-defined UDT arrays from a huge text file. Your "UDT Array format" subsection has a lot of useful commands, like GET ARRAY FORMAT. Any chance you could create a SET ARRAY FIELD(array element index, field index) command that would allow the user to load data into a particular field of the UDT? He could traverse the output of GET ARRAY FORMAT (LLLSSSDD) to get the type, transform the text data to match, and stick in the UDT without having to mess with the array field name. Lacking this I must specifically re-code for each UDT encountered. (Waah!) It seems like you have every other type of command . . . How 'bout a few more SETS? Thanks again for your amazing efforts.

IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 20th Apr 2011 21:49
To be honest, I'm not sure that it's needed


Admittedly, you do need to have a low-level of understanding of arrays to make this kind of thing work though.

Manson_NS
15
Years of Service
User Offline
Joined: 4th May 2004
Location: Denmark
Posted: 20th Apr 2011 23:43 Edited at: 21st Apr 2011 00:09
I don't want to jump the gun and claim to have discovered a bug - however, why does this return an "unknown exception" ?
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Apr 2011 00:32
I have no idea what's gone wrong with that command - I can reproduce the problem from the last release, but with a simple recompilation with no source code changes, it's now working.

I'll update the version number, recompile, and upload a new version.

Let's see if I can squeeze a few more goodies in at the same time...

IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Apr 2011 00:53
Ok, here's the newly packaged release.

Release 20110420

Matrix1Util_04 - 1.1.0.8
- Corrected resource string for ALLOC STRING function parameters.

Matrix1Util_29 - 1.1.0.6
- Recompilation only.

Matrix1Util_32 - 1.1.0.4
- Added commands POSITION OBJECT AT VECTOR3, ROTATE OBJECT TO VECTOR3, POINT OBJECT AT VECTOR3 and ADD VECTOR3 TO OBJECT POSITION (with and without scaling).
- Added commands POSITION CAMERA AT VECTOR3, ROTATE CAMERA TO VECTOR3, POINT CAMERA AT VECTOR3 and ADD VECTOR3 TO CAMERA POSITION (with and without scaling).
- Added command SET VECTOR3 TO ANGLES BETWEEN VECTORS

Attachments

Login to view attachments
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Apr 2011 01:17
@RiiDii,
I decided to not go with your idea on stepping along the axis, as it still seems very specific to what you are doing.

What I've done instead is generalised your idea and added a few more vector commands that can be used to update object positions (and cameras) with a single command instead.



Now it's possible to use a vector representing direction and velocity to directly update an object position.
There is no SUBTRACT VECTOR3 FROM OBJECT POSITION command, as I've been rushed into this release a little - the same effect can be had by using ADD VECTOR3 TO OBJECT POSITION with a negative scaling factor (see the help for the command).

freight hopper
15
Years of Service
User Offline
Joined: 26th Dec 2003
Location: Just beyond the Dunsmuir yard limits
Posted: 21st Apr 2011 02:45
Thanks for the code. I'll do my best to understand it.

Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 21st Apr 2011 03:16 Edited at: 21st Apr 2011 03:21
Just reminding you how useful these plugins are! I've been using the complex object setup functions to make a skybox (each side is a limb with its own texture).

Here's an idea for a feature: let the user lock the vertexdata of a limb created using the "add new limb" without having to create the object.

eg.



An equivalent to "set object texture" to work on individual limbs would be nice too.

On a related note, I noticed a bug to do with vertexdata and using save object (and possible other commands). It caused me quite a bit of annoyance until I realised what the problem was and found a work-around.

[b]
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Apr 2011 10:19
Quote: "let the user lock the vertexdata of a limb created using the "add new limb" without having to create the object"

Can't do that, as NOTHING about the object exists until the finish command is executed except some behind-the-scenes data that allows the object to be created.

Quote: "I noticed a bug to do with vertexdata and using save object"

That's not a bug, that lock mode was the response to a bug in the past when people wanted to make permanent changes to object vertices.

Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 21st Apr 2011 11:40 Edited at: 21st Apr 2011 12:01
Quote: "Can't do that, as NOTHING about the object exists until the finish command is executed except some behind-the-scenes data that allows the object to be created."


Hmm... Shame

Quote: "That's not a bug, that lock mode was the response to a bug in the past when people wanted to make permanent changes to object vertices."


It's still a bug. Save object just shouldn't change the existing object. If it saved the object without the vertexdata changes but left the original intact, that would make more sense. All that's needed is to change this in ScanMesh:

to this:

And then to remove the call to ResetVertexDataInMesh from SaveDBO.

[b]
RiiDii
14
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 22nd Apr 2011 02:54
IanM: I like those new commands just fine. Thanks for the add.
thenerd
10
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 23rd Apr 2011 21:13
Would it be possible to add a command to check if a file has been modified since last loaded? So, you could do code like this:



That code would obviously not work by itself, but it would open the doors to other useful features. For example, loading configuration files on the fly so that you could edit attributes for player speed, particles, or anything else without recompiling. I am hoping to eventually have the OpenFPS engine have much of the configuration in lua files. That way, anyone working on the project can change variables in the files and watch the results instantly.

tiresius
16
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 23rd Apr 2011 23:13 Edited at: 24th Apr 2011 04:28
You can get the modified date/time of the file with the regular dbpro commands. I check to see if it <> the previously known date/time with get file date$. Seems to work well enough.


A 3D marble platformer using Newton physics.
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 23rd Apr 2011 23:21 Edited at: 23rd Apr 2011 23:22
Yes, but I think I'll try to generalise it a little - being able to get the last modification timestamp from a file seems a better idea.

[edit]
Shouldn't take a walk away from my system between reading a post and writing a post I guess

thenerd
10
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 24th Apr 2011 16:34 Edited at: 24th Apr 2011 16:36
Quote: "You can get the modified date/time of the file with the regular dbpro commands. I check to see if it <> the previously known date/time with get file date$. Seems to work well enough."
Yes, but it seems you need to have the file loaded to get that data, which makes it useless. I want to check if the file has been modified since loading, and then reload if it has been modified. I don't know exactly how it would be done, but some way of comparing the loaded file and the file on the hard drive, and then if there are differences return a 1.

Jeff Miller
14
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 25th Apr 2011 02:58
DBP RC 7.7 is throwing an error when I try to use the Make Bank From File command to make a bank from a music file that has been previously loaded with the Load Music command. (Not tested on prior DBP versions). It does not throw the error when I try to use the Make Bank From File command to make a bank from an image file previously loaded with the Load Image command.

I've been parsing midi files and when they don't behave (often) my program then tries to load them into one or your banks and pick them apart to investigate. I thought it might be a peculiarity of DBP and midi files, which do not like each other. However, I get the same error substituting an MP3 music file.

Now if I reverse the order of operations, i.e. by assuming that a music file is screwed up before bothering to load it, making it into a bank, picking it apart, finding no problem that I can detect, and then loading it with the Load Music command, I get no error.

If it helps, the error message states that the file (correct file name) cannot be loaded into Bank 0. The reported bank number 0 is incorrect error reporting, and appears even when the the bank number argument in the Make Bank From File command uses a non-zero hard-coded previously-unused positive integer well within the permissible bank number range, like 6.

I don't want to allege a DBP error as yet, although I suspect that DBP may be keeping a loaded music file locked or something like that. I know you have spent considerable time trying to improve some of the DBP music-handling modules lately, and may be able to quickly spot whether this is a DBP issue or a peculiarity of the Make File From Bank command.

Login to post a reply

Server time is: 2019-10-19 09:09:42
Your offset time is: 2019-10-19 09:09:42