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
Juso
20
Years of Service
User Offline
Joined: 23rd Sep 2002
Location: Finland
Posted: 22nd Feb 2008 17:59 Edited at: 22nd Feb 2008 18:00
What to do when commands in different dlls overlap? There is "Trim" command in Matrix1Util_16 and in Styx 2.

DBPRO doesnt compile anything before one or the other dll is taken away.
Diggsey
16
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 22nd Feb 2008 18:47
You still have only one random number generator I saw this link, and thought it would be a nice thing to have in DBP (seeing as how slow everything else is!)

IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 22nd Feb 2008 20:45
I keep meaning to add new ones, but I never seem to get around to it - that plug-in is a very basic place-holder ATM that will eventually have you able to specify one of many different RNG's to use, to create as many as you wish at once (by ID, like images or objects are), and to also specify the ranges of number you wish it to issue.

When I picked one, I went mostly for speed in generating floating point values, but also considered memory requirements and cycle lengths.

@Juso,
Pick the DLL you don't want to use and move it to one side. I used to keep a 'save' folder in my own plugins-user folder for just that purpose, and set up a shortcut to allow me to get there quickly and easily.

Todd Riggins
18
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 23rd Feb 2008 14:30
Quote: "but also including a realloc function for Diggsey"


Cool! I was gonna ask about that. This is where I can resize memory and previous contents dont get changed, right??

Inspirational Music: Descent ][ Redbook Audio CD Soundtrack
IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Feb 2008 00:41
Yes, available in two flavours - one where the newly allocated area beyond the existing data is cleared automatically, and one where it isn't. Also as a bonus, there's a new function that allows you to get the current size of an allocated memory area too.

Oh, and the array plug-in *will* be included in the next release now that I've finally completed the help files for it

Omen
16
Years of Service
User Offline
Joined: 7th Nov 2006
Location: Maple Grove, MN US
Posted: 27th Feb 2008 01:11 Edited at: 27th Feb 2008 01:17
IanM:

I found something interesting with Util 28 that slipped me up a couple times, so I just wanted to post it here in the hopes that other people don't trip over this:

When using the various SOCKET INFO commands (SOCKET REMOTE IP, SOCKET REMOTE PORT, etc) on a UDP socket, you _must_ always receive the data first as the SOCKET INFO commands return info on the last socket READ, not the last socket polled.

So, for example this works as expected:



...and this does not:



Edit: Just wanted to note too that the Util 28 commands are so far working exactly as-advertised and as-documented. The UDP is very fast too! Great Job !!!!

KISTech
14
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 27th Feb 2008 04:22
So about plug-in 28..

How would you compare it's performance to Multisync?

I know the plug-in can do bitstream. Is that considerably faster than what Multisync does?


Don't think, just code.
IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 27th Feb 2008 14:29
Quote: "How would you compare it's performance to Multisync?"

I wouldn't.
I have never used multisync, but I'm not sure that they are directly comparable anyway. Hopefully someone who has used both will come along and try and answer your question.

Quote: "I know the plug-in can do bitstream"

Actually, everything is at byte level.

@Omen,
The help for SOCKET REMOTE IP and SOCKET REMOTE PORT says the following:
Quote: "For a UDP socket, the value returned is the IP Address of the source of the last read"


I'll reword it to make it clearer.

KISTech
14
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 27th Feb 2008 17:37
Quote: "Actually, everything is at byte level."


DOH!!

That's what I get for reading 2 documents at the same time...


Don't think, just code.
Olby
19
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 27th Feb 2008 19:29
When are you planning to release the latest version with limb blending. Do you actually got it working right? Thanks.


ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, DirectX10, DBPro 6.6b
IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 27th Feb 2008 20:48
Either tomorrow night or the night after, and yes, I believe I have limb texture blending in place - you do have to know what you are doing to get the effects that you want though, so it's probably not for the beginner.

Olby
19
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 28th Feb 2008 17:10
Yeah thats cool. I am very good with effects. Will be waiting then. Thanks.


ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, DirectX10, DBPro 6.6b
IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Feb 2008 19:42
Ok, here's the newest release:

Release 20080228
Matrix1Util_04 1.1.0.1
- Added functions to resize a memory allocation and to get the current size of a memory allocation.
- Removed compatibility with the DBPro MAKE MEMORY & DELETE MEMORY.

Matrix1Util_05 1.1.0.4
- Corrected resource string for FIND FREE EFFECT range function
- Corrected resource string for FIND FREE PIXEL SHADER range function
- Corrected resource string for FIND FREE VERTEX SHADER range function

Matrix1Util_12 1.1.0.2
- Added functions to get per-limb texture counts and texture blend modes
- Added commands to set texture blend modes
- Fixed resource string for GET LIMB TRANSPARENCY (not set to return value)

Matrix1Util_21 1.1.0.1
- Fixed resource strings for the ZONE functions (not set to return value)

Matrix1Util_22 1.1.0.2
- Ensure that reading a byte returns an unsigned value.

Matrix1Util_26 1.0.0.3
- Set current camera to 0 if deleting current camera.

Matrix1Util_29 1.0.0.1
- New plug-in for arrays

As you can see, it's mostly small fixes. The biggest things are the inclusion of my array plug-in (cleaned up and a lot smaller), and the multi-texturing commands & functions.

Attachments

Login to view attachments
IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Feb 2008 19:53
Here's a simple example piece of code that shows the way to get multi-texturing working for limbs.

This code simply duplicates DBPro's lightmapping. The first 2 sets of constants are directly equivalent to the constants of the same names in the DX documentation.

Play around and see what you can do



The whole thing (source + textures) is in the attached zip.

Attachments

Login to view attachments
CuCuMBeR
20
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 29th Feb 2008 20:42
I think limb blend mapping is the best thing ive ever seen about DBPro yet. I thank you very much for this addition IanM.

There is always one more imbecile than you counted on.
Scraggle
Moderator
19
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 29th Feb 2008 21:57
Very nice Ian.

Haven't had a play with the new array plugin yet but I have read the help files and it seems like a fabulous addition.

Thank you




IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 1st Mar 2008 00:28 Edited at: 1st Mar 2008 00:31
I should have known that not everyone knows about the old array plug-in - I just assumed that it was reasonably well known.

Here's some of my test code to show some of the commands.

First, the stuff from the original plug-in - basic sorting, clearing, with and without ranges, plus the pointer stuff that I've used to write a generic array-display function:


Then an example of passing array pointers and linking & unlinking:


One limitation of linking that I forgot to mention in the help is that resizing a linked array to a larger size is a no-no. When resizing upwards, the old array is destroyed and a new one created - if you leave another array pointing to the old storage then you can guarantee a crash at some point unless you take care:


Note the unlinking of the original data and the later relink - this is simply to cope with the potential movement of the array in memory.

I may include a new function in the next release that unlinks the array and passes back the pointer at the same time as a short-cut.

[EDIT]
Forgot about the new array dimension commands:


Olby
19
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 1st Mar 2008 13:11
Wow Ian! Those limb blending commands are perfect. In a few minutes a was able to code a 3DWS level loader that looks exactly the same what you see in 3DWS without any nasty shaders required. Very good low level ability to change everything. Thanks.


ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, DirectX10, DBPro 6.6b
Olby
19
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 2nd Mar 2008 18:35
Sorry for double posting but could you add something like:

#constant DBPTM_UVSTAGE1 = 3
#constant DBPTM_UVSTAGE2 = 4
#constant DBPTM_UVSTAGE3 = 5
#constant DBPTM_UVSTAGE4 = 6
#constant DBPTM_UVSTAGE5 = 7
#constant DBPTM_UVSTAGE6 = 8
#constant DBPTM_UVSTAGE7 = 9

to the set limb texture coord mode command. I found it difficult to blend map using UV coordinates from different stages than 0.


ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, DirectX10, DBPro 6.6b
IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 2nd Mar 2008 20:14
No, because the DBPro engine doesn't support them - remember that in this case, I'm only exposing existing functionality.

So for right now, you can either use the UV coordinates from texture stage 0, or the UV coordinates from the current texture stage (ie, texture 7 will use the 7th set of texture coordinates).

Olby
19
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 2nd Mar 2008 21:48 Edited at: 2nd Mar 2008 21:49
Ok, but what about set limb transparency can you add support for other transparency modes. I tried setting 4th mode but it still used 1th. Is only mode 1 supported?

Sorry - it may look that I am pushing you but I am very very deep into my game and I rely heavily on your extension plugins - they are just marvelous! I am person that if I got stuck in game development it is very hard for me to continue later on working on it again, thats why I am working almost 24h to finalize the general functionality of the engine.

[Edit]

Btw, as far as I remember set blend mapping on allowed to use any coord stage. Then I guess if you say it is not possible for limbs they use different functionality?


ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, DirectX10, DBPro 6.7
IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 3rd Mar 2008 00:15
Transparency at the limb level uses a boolean value - it's either on or off. Nothing I can do about that

I'll check out the UV coord stages further. At first glance, the commands I've included allow the same functionality on limbs as the SET BLEND MAPPING ON command does, so it may work the same way.

Omen
16
Years of Service
User Offline
Joined: 7th Nov 2006
Location: Maple Grove, MN US
Posted: 5th Mar 2008 20:38
@Ian,

I've switched over to using matrixUtil28 for my networking, and everything is working perfectly - really amazing work!

Quick question, tho... how hard would it be to enable the various SEND SOCKET WORD, RECV SOCKET WORD/DWORD/BYTE commands for UDP?

Thanks!

IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Mar 2008 22:03
Easy. But it'd also be very pointless.

UDP has no guarantees for delivery (packets may never appear, or may appear several times) or order of delivery (packets may appear in a random jumbled order) - sending a stream of 1-byte, 2-byte or 4-byte packets under those circumstances would quickly make the data transmitted meaningless.

Strings, memblocks and banks however can include type and sequence information so that you know whether the packet is duplicate, out of sequence, or have missed one somewhere.

Omen
16
Years of Service
User Offline
Joined: 7th Nov 2006
Location: Maple Grove, MN US
Posted: 8th Mar 2008 21:35
@Ian,

OK, good point - I'll stick to memblocks for UDP. I've been reading a lot on UDP programming, but everything is C/C++ oriented (of course), so I'm having a hard time translating standard solutions to DBPro.... and was wondering if you've run into the issue below or if you might have some feedback on directions I could go in.

Here's the point I'm getting stuck at:
An unconnected UDP port (of course) doesn't have a REMOTE IP/PORT from the connection itself, and you have to read these from the datagrams as they come in. If you want to reply to ALL senders, the "traditional" technique is to use a broadcast address on the socket, but SEND SOCKET MEMBLOCK TO requires both address and port - so, I'm kind of stuck there.

The solution I'm currently testing out is to use a UDT and new clients do a "hi/hello" exchange to get registered into the array. Then when I want to send something to all clients, I iterate through the array.

However, this seems to be a problem too because you have no way of knowing when a client disconnects and (and this might be just a bug on my end, not sure yet) sending to a address/port combination that is not valid seems to get interpreted as an incoming packet from address 0.0.0.0:0 -- which gets you into a feedback loop :/

IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Mar 2008 23:32
Take a look at the tutorial document - tutorial 4 (UDP Client), lines 42 to 50 deals with how to handle UDP bounces.

Basically, after receiving the UDP packet, use the SOCKET ERROR() function to determine whether an error number 10054 occurred. If so, then nothing was listening on the remote socket.

Also, remember that if you send to an IP address that does not exist on the net (for example, the machine goes offline due to power cut, OS crash or modem disconnect) then you won't get a bounced packet, so you need to work out a 'I'm still alive' mechanism for all remote hosts.

Mule
14
Years of Service
User Offline
Joined: 8th Feb 2008
Location:
Posted: 11th Mar 2008 05:06
Hey all,

Can the Trim$ command in command set 16 please be renamed as it conflicts with the same command in the styx plugin.

MoomanFL
17
Years of Service
User Offline
Joined: 12th Nov 2005
Location:
Posted: 11th Mar 2008 15:04
Mule,

It would be nice if people actually used the Search feature before they post on a forum.

If you had, you would find your answer already on this forum and even in this thread.... many times over.

Design documents?!? What design documents??? I thought we were just going to wing it!!!
Omen
16
Years of Service
User Offline
Joined: 7th Nov 2006
Location: Maple Grove, MN US
Posted: 11th Mar 2008 18:19 Edited at: 13th Mar 2008 07:51
@IanM,

OK, now I really feel like I'm being a pest, so I apologize. You were saying...

Quote: "Also, remember that if you send to an IP address that does not exist on the net (for example, the machine goes offline due to power cut, OS crash or modem disconnect) then you won't get a bounced packet..."


However, if I send out a packet on an unconnected UDP socket to an invalid host, it generates a 1-Bytes message on the receive channel from host "0.0.0.0:0"

I can demonstrate it easy enough, just add 1 line to your EchoServer3 in the tutorial like this:



...and then run the EchoClient03 (or EchoClient04) normally and you can see that an extra packet is getting bounced back on the receive for every attempt to send to an invalid host.

The log looks like this:


Couple things odd about this:

1) No error is detected on the SEND SOCKET MEMBLOCK TO. I should get a CONN RESET error on the send, shouldn't I? If that were the case, I could invalidate sessions right then and there and be done with it.

2) The 1-Byte packet that comes back has a "0.0.0.0:0" sender address. If these 1-btye packets is "how things are supposed to be", then it would be nice if this packet instead held the address of the attempted (and failed) recipient. If this isn't the standard way of doing things, it would be nice to have this as an option - maybe something like a "SET SOCKET BOUNCE INFORMATIVE ON" or something like that, with the default of it being off.

Thanks for listening, and I apologize again if I'm being a pest

Mule
14
Years of Service
User Offline
Joined: 8th Feb 2008
Location:
Posted: 13th Mar 2008 15:48
to: MoomanFL,

I HAVE searched the forum and NOT found my answer. How about you stop wasting space with sanctimonious responses and answer the question.

to: Everyone else,

I can see why people get frustrated with TGC forums at times. No two people think alike, so it follows that I can search all day for some information and never use the same terminology that someone else has used in a relevant post. With over a million to search for, sometimes you'll find a post. Sometimes you won't.

I have limited time in a day, and I'll search as much as I can, but in the end we're not always going to find what we're searching.

Clearly there are a few individuals who would rather hinder good relations and communication, spending their energy on pointing out what they perceive as faults in others, rather that contributing positively.

So can someone who is in the know (the author of the Trim$ command would be especially nice) please answer my question.
BatVink
Moderator
19
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 13th Mar 2008 17:52
Mule, although the answer may not have been overly useful, he is right. My first search for Trim Styx returned 3 results, 2 of which pointed back to this thread and the solution.

Maybe you haven't tried the Google search? It's very useful, as it searches within the threads too, not just the subjects. Google also seems to be able to identify posts withing forums, as it usually returns decent results, not ones where the words are totally out of context with one another.
empty
20
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 13th Mar 2008 20:13
Mule,
the next release of Styx (due mid/end of April) will have a solution for this problem.

Mule
14
Years of Service
User Offline
Joined: 8th Feb 2008
Location:
Posted: 14th Mar 2008 06:12
Thanks empty
IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 14th Mar 2008 17:37 Edited at: 14th Mar 2008 17:39
@Omen,
Quote: "`<--- Add this line - a send to an invalid host"

That's not what that line is doing. It's sending a UDP packet to a VALID host, but on an INVALID PORT - ie, there's a running machine, but it's not listening on that port.

The tutorial says:
Quote: "There is also another thing that needs to be taken into account - when sending a UDP packet to a machine that is running but does not have a listening socket open on the port you are transmitting to, a message is sent back to notify you of this fact. This is reported back to your code as data being received, but when you attempt to read this data, an error is reported instead. The code following needs to detect and deal with this in some way rather than just reporting the error and aborting the program as we have been doing so far."


The code in the tutorial does the above like this:


You asked:
1) No error is detected on the SEND SOCKET MEMBLOCK TO. I should get a CONN RESET error on the send, shouldn't I?

A) No. The packet takes a large amount of time to be transmitted to the remote and for the returned packet to come back - the bounce time may be several seconds in some cases. While you are waiting for it, you could be dealing with many other connections that are valid. You also wouldn't want that kind of pause in a multiplayer game as new people connect mid-game either.

2) The 1-Byte packet that comes back has a "0.0.0.0:0" sender address ... then it would be nice if this packet instead held the address of the attempted (and failed) recipient.

A) Yes it would. I'll see if it's possible to get that information from winsock and pass it on - it may not be possible, and you may need to work out an alternate method of doing this.

Omen
16
Years of Service
User Offline
Joined: 7th Nov 2006
Location: Maple Grove, MN US
Posted: 14th Mar 2008 23:54
@Ian,

On detecting the invalid recipient on UDP packet send, I wasn't thinking that you'd have to wait for the round trip to discover that it's invalid -- but, now I think about it a little more, it makes complete sense and the only way it would be possible - so, I see your point there

About getting the invalid recipient ip/port into the UDP message for the connection reset....

I was thinking about this a little more, and doing this would make it extremely simple for someone to manufacture packets to (essentially) invalidate and disconnect all your server sessions.

That would be bad.

So, if you do decide to go ahead with this functionality, it might be a good idea to include some "authentication" DWORDS in the message that can be set on the server and then verified on incoming packets.

Maybe something like this:

SOCKET SET CONNRESET AUTH authentication1, authentication2

where authentication1/2 are DWORDs. These two DWORDS would be added to the "message sent back" packet so you could verify that there were sent by the system itself and not a remote host.

However... this is getting a bit "snake chasing its tail," so if you can't implement it, or don't think it's a good idea, I completely understand.

Currently, I'm just trapping and ignoring the "0.0.0.0:0 sender" packets and using a keep-alive scheme for the clients, so I'm already working around this. It would be a "nice to have," at this point but in no way a show stopper.

Again, thanks for your feedback

IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Mar 2008 01:17
Quote: "and doing this would make it extremely simple for someone to manufacture packets to (essentially) invalidate and disconnect all your server sessions"

It's possible I guess, but they'd have to know the IP addresses and ports you were transmitting to to do it.
They'd also need to know how to generate an ICMP packet (that's the protocol used to send network information, including these resets).

Anyway, all that's not important any more - I seem to have managed to get the ip & port numbers from the bounced message - just testing right now.

Regarding your suggestions, they just don't fit with the philosophy of this plug-in. Apart from a very few 'must have's, such as bank/memblock/string sizes preceding the actual data in TCP sockets, the plug-in adds nothing to the datastream, so apart from those 3 types, the stream contains nothing that you didn't transmit yourself. If anything else was added to the stream, then you wouldn't be able to fit in with other protocols available out there (no writing your own FTP client for example).

With the changes I've made here, the changes I've also made to the FIND FREE XXX stuff, and the new help files I'm generating (was on a course this week and had to do something to fill the evenings in the hotel room), I may be able to get a quick release out this weekend. There are a few other bits I want to try and get in first though.

Omen
16
Years of Service
User Offline
Joined: 7th Nov 2006
Location: Maple Grove, MN US
Posted: 15th Mar 2008 03:13
@Ian,

Sounds great, thanks for looking into it - and the FIND FREE fixes will be really great too. Many thanks !!!

IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Mar 2008 17:18 Edited at: 16th Mar 2008 17:25
Here's the new plug-in set.

Matrix1Util_01
- Added FIND FREE BANK FUNCTIONS, in new & faster form.
Matrix1Util_02
- Added FIND FREE TICKER FUNCTIONS, in new & faster form.
Matrix1Util_03
- Added FIND FREE SYSOBJ FUNCTIONS, in new & faster form.
Matrix1Util_05
- Removed FIND FREE BANK functions
- Removed FIND FREE TICKER functions
- Removed FIND FREE SYSOBJ functions
Matrix1Util_13
- Fixed bug that causes crash when the window/class string is zero sized in WINDOW TITLE & WINDOW CLASS functions.
Matrix1Util_21
- New attempt to fix resource strings for the ZONE functions (too many args)
Matrix1Util_22
- Added function versions of all OPEN DATAFILE commands.
- Temporary removal of the DATAFILE OPEN function.
Matrix1Util_28
- Amended UDP to get ip & port from bounced packets.

[EDIT]Oh, and the help files have been reorganised again and now has a separate list of the commands in alphabetical order.

Attachments

Login to view attachments
Omen
16
Years of Service
User Offline
Joined: 7th Nov 2006
Location: Maple Grove, MN US
Posted: 17th Mar 2008 01:45


Awesome! I like the new help file layout too, that's really handy.

IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 18th Mar 2008 21:59
So you like then? Great.

It's based on the layout that Scraggle put together for me, but it's now generated directly rather than being post-processed as the previous release was.

Grandma
17
Years of Service
User Offline
Joined: 26th Dec 2005
Location: Norway, Guiding the New World Order
Posted: 19th Mar 2008 22:49
Yes, really nice.

There's one little thing that bothers me. I'm reading from a file, and the end condition i use is naturally "datafile end(1)". But DBP always tries to read trough an extra iteration altough there's nothing more to read.

There has to be another byte or so in the file though since he insists on reading more, but that doesn't add up (literally) since the loops he goes trough when writing the file is always one less than the loops he goes trough when reading.

It's not the first time i've encountered something like this. The first time was with DBP's original file commands, so i don't think it's your plugin. I must be doing something wrong apparently, but i posted it here anyway. Hopefully noone got hurt.

Also, keep up the great work. I've become addicted to these plugins now.

This message was brought to you by Grandma industries.

Making yesterdays games, today!
IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Mar 2008 23:45
It's standard I'm afraid - All of the libraries that I'm aware of (Win API, C buffered and unbuffered I/O, C++ I/O) don't actually set the end-of-file condition until you attempt to read past the last byte of the file. Changing the way the plug-in works so that it signals EOF before you read past the last byte is possible, but would slow the speed of reading from the file quite a bit, especially where you have the file in append mode.

If you are reading in a detailed set of information, read the first item, check for EOF, and if not detected, read the next.

Here's the standard loop I use when I don't know how many times I need to loop:


An alternative is to write the record count to the file followed by the data, and when reading back, you have the record count to use to determine how far to read.


The choice that Lee/Mike made for the DBO file format for example is the second one - all the sizes are in the file immediately prior to the data they represent.

Grandma
17
Years of Service
User Offline
Joined: 26th Dec 2005
Location: Norway, Guiding the New World Order
Posted: 20th Mar 2008 00:28
Oh great, so i'm not delusional after all.

Quote: "Changing the way the plug-in works so that it signals EOF before you read past the last byte is possible, but would slow the speed of reading from the file quite a bit, especially where you have the file in append mode."


It was only a minor annoyance, I did have a crappy work-around in place but will improve on that now seeing as it's standard. Adding that possibility with a flag or something would be low priority as it's rather easy to create a workaround to the issue. I don't think you need to bother with it. Thanks for removing that element from my ThingsThatConfuseMe(999) array.

This message was brought to you by Grandma industries.

Making yesterdays games, today!
Olby
19
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 23rd Mar 2008 21:48 Edited at: 23rd Mar 2008 21:56
[Edit]

Sorry it looks like the problem is in my code as the snippet out of the program works.

I will investigate more and see if this is still a problem.


ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, DirectX10, DBPro 6.7
IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Mar 2008 13:26 Edited at: 24th Mar 2008 14:57
I've not hit any problems myself so far with Dark Physics - I'll wait to hear from you.

[EDIT]now to not[/EDIT]


In the meantime, here's some example code for building an object from scratch WITHOUT memblocks:


Olby
19
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 24th Mar 2008 14:51
Now this is a real bugger. When I create a blank snippet everything works fine but in my engine it appears to be problem. Need more time to investigate.


ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, DirectX10, DBPro 6.7
Olby
19
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 24th Mar 2008 21:27
Sorry for double post but I thought I should share this. The problem was that there was a mistake in my code that actually created a particle emitter with 0 particles in it. Thus of course it was empty object and somehow find free object() thought it should not count it as an object. What I did was to simply put not a variable but a static value in the amount parameter and everything worked fine. Ahh those nice features of DBPro coding...


ACER Aspire 5920G: Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, DirectX10, DBPro 6.7
IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Mar 2008 21:36
You could have used the MAX function, or wrapped it in an IF



If you are depending on the emitter to be there, then use the first method. Otherwise, you can simply not create the emitter.

IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Mar 2008 22:14
Here's another quick release. Although there are a few new commands added, most of the changes are to do with the help files - I spent a little time clarifying some of the text (I hope).

Release 20080324
Matrix1Util_12 1.1.0.3
- Added 2 argument form of APPEND LIMB command.

Matrix1Util_13 1.1.0.3
- Added HIDE/SHOW WINDOW ICON commands based on window handle.
- Added GET WINDOW WIDTH/HEIGHT & GET WINDOW CLIENT WIDTH/HEIGHT functions based on window handle.
- Added SET WINDOW CLIENT SIZE based on window handle.
- Added SET WINDOW SIZE based on window handle.

Matrix1Util_16 1.1.0.1
- Removed 1024 extra character limit from the INSERT$ function.

Matrix1Util_18 1.1.0.1
- Added two versions of MAKE OBJECT PLAIN to create a multi-row/column grid of polys.

Attachments

Login to view attachments
IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Mar 2008 22:27
The MAKE OBJECT PLAIN was a conversion from a DBPro function I had that used the MAKE OBJECT NEW commands and the vertex commands to build a grid - I have so many different versions of the code floating around that it seemed like a good idea to convert it into a single plug-in command and make it more flexible in the FVF area too.

Make Object Plain example.dba:


heightcolor.fx:


The project, dba and fx file are also in the attached zip file.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2023-02-05 20:20:11
Your offset time is: 2023-02-05 20:20:11