And, I seem to have most of the major errors out of my code. I can now read
a .nif file to an internal J representation and write it back out. The
result written from the internal data structure is identical to the
original, which is a good test of the fidelity of the read/write code.

And this reflects one of my frustrations with the existing .nif support -
it generates an approximate copy in most cases, rather than an exact copy.

There are some issues to be dealt with, still. Some of them should be
addressed in my code, and I (or someone) should file some bug reports
against the other code bases. (I especially should file bug reports against
nif.xml where format irregularities drive me to hand-generate workarounds.)

Anyways, here's the code in its current state:

https://github.com/rdm/nifty

If you are not familiar with github, you can browse any of the files.
Currently that means:

nif.xml     -- imported from upstream*
nifxml.ijs  -- parses nif.xml
nifexpr.ijs -- parses expressions used in nif.xml
readnif.ijs -- reads a *.nif file based on above rules
wrtenif.ijs -- writes a *.nif file based on readnif.ijs data structures
furniture/unpack/Furn_OrcLC_Table01.nif - imported from upstream

You can browse into the file and there's also a raw version of each. Or, if
you want to see how things looked while I was debugging the code, there's a
history of changes I made to each. Of particular note: I *like* being able
to switch between different stylistic conventions, depending on my current
needs. Debugging requires a certain amount of inefficiency, rapid
development requires I relieve critical bottlenecks.

Also, not necessarily doing a lot of coding here - and that's probably a
good thing. Simplicity is a virtue.

That said, is nowhere near ready to polish for "release", it's just
infrastructure at the moment, but I am getting closer to something that
might interest other people. And I would want feedback from users well
before I spend much effort on "polish".

Current music: https://www.youtube.com/watch?v=WCwfUX58IZw

Thanks,

-- 
Raul

P.S. upstream means :
https://raw.github.com/amorilia/nifxml/master/nif.xml
http://www.nexusmods.com/morrowind/mods/42513/





On Tue, Feb 18, 2014 at 1:29 AM, Raul Miller <[email protected]> wrote:

> I've cleaned up the code a bit, and created a github repository for it:
>
> https://github.com/rdm/nifty
>
> Let's say that the "ty" in that name stands for "thank you" (actually,
> "nifty" was the first thing that came to mind when I needed to name the
> repository).
>
> This version is considerably faster than the version I posted on the 16th,
> mostly because I am only parsing the xml file once (instead of once per
> definition). Parsing xml to extract a single value is a great strategy for
> small xml files but for something as big and complex as nif.xml it makes
> more sense to parse the whole thing and stash the result.
>
> This version also has has some structural changes aimed at making my
> coding time more efficient. When dealing with a large sprawling code base,
> errors are a great way of focusing your attention on something that needs
> attention, so I've broken things out into more files to force me to pay
> attention to the couplings between the various conceptual modules.
>
> Music I am listening to at the moment is
> http://www.youtube.com/watch?v=c6Rvde1YeLE
>
> Thanks,
>
> --
> Raul
>
>
>
> On Sun, Feb 16, 2014 at 4:59 PM, Raul Miller <[email protected]>wrote:
>
>> Here's an update of my little venture into nif parsing. Earlier parts
>> were:
>>
>> 3.  http://jsoftware.com/pipermail/programming/2014-February/035047.html
>> 2.  http://jsoftware.com/pipermail/programming/2014-February/035007.html
>> 1.  http://jsoftware.com/pipermail/programming/2014-February/034926.html
>>
>> Also, just for fun, here's my current music:
>> http://www.youtube.com/watch?v=iWjRsd4kk9w
>>
>> Also, since the code is starting to get big, I've stashed it off in a
>> gist:
>>
>> https://gist.github.com/rdm/9041044
>>
>> When run, nif.ijs currently generates a variable named DATANIF which
>> represents a game object (in this case it's the 3d geometry of a table).
>> It's not particularly efficient yet, or anything, but it's good enough for
>> me to move on (and I can make it radically more efficient by pasting more
>> of the generated code back into the script).
>>
>> At this point, it illustrates several concepts:
>>
>> XML Parsing
>> Binary file parsing
>> Code generation
>>
>> I've a bit more ground work, to ensure basic data integrity (I want to be
>> able to generate an exact copy of the file I read from the parsed data).
>> Then I can move on to rendering (which represents the start of a user
>> interface, gives me another view on the underlying data model and gives me
>> another way of verifying the integrity of the system). Then I can get going
>> on the really interesting stuff.
>>
>> And, yes, in a sense all I am doing so far is treading over ground that
>> other people have already walked on. But that has important educational
>> value, and I need a little infrastructure before I can move on to the next
>> stages.
>>
>> Thanks,
>>
>> --
>> Raul
>>
>>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to