Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 26

Thread: KeeperFX work

  
  1. #1
    Ghost
    Join Date
    Dec 2010
    Location
    Madrid, Spain
    Posts
    368

    Default KeeperFX work

    This thread is only informative, only to have an approach of how much KeeperFX work need to be done.

    I have downloaded KeeperFX 0.40 source code, and tried to count how many functions need to be rewritten. So doing a recursive search on the "src" (source code) folder, on all *.c files, searching for "return _DK_" not including C comments (//return _DK_...), the result is 301!

    So, I think that's it:

    - 301 functions needed to be rewritten
    - Test they, to assure there is no bugs
    - Add enhancements (like infinite savegame slots, having all possible values in files instead of having it hardcoded in the code, read music from WAV/MP3 files instead of Audio CD tracks, language files easy to change and understand to add new languages, etc)
    - Replace DirectX code by some cross-platform library (like the current SDL that is being used)
    - Fix and finish multiplayer code
    - Change all weird variable names with descriptive ones, there is a lot on the source code. Example:
    if ((cctrl->spell_flags & 0x04) == 0)
    by:
    if ((cctrl->spell_flags & CSF_Armour) == 0)
    - Add possible new script commands
    - Write entire documentation

    Some years will be required I think
    Last edited by jomalin; July 13th, 2012 at 10:27.

  2. #2
    Your Majesty Hapuga's Avatar
    Join Date
    Aug 2009
    Location
    Austin, USA
    Posts
    1,444

    Default Re: KeeperFX work

    Using Doxygen may really save some time on documentation.
    http://img192.imageshack.us/img192/6659/c2warlocki.gif

  3. #3
    Ghost
    Join Date
    Dec 2010
    Location
    Madrid, Spain
    Posts
    368

    Default Re: KeeperFX work

    Quote Originally Posted by Hapuga View Post
    Using Doxygen may really save some time on documentation.
    Doxygen is good, but it only works for source code documentation, not for writing how to make levels for KeeperFX for example

  4. #4
    KeeperFX Author mefistotelis's Avatar
    Join Date
    Sep 2009
    Location
    Poland
    Posts
    1,242

    Default Re: KeeperFX work

    If anyone would like to contribute some documentation, either for the source code or for mapmakers/players, just let me know. You can either send me what you have, or ask me for access to the repository.

    About counting non-rewritten functions in the whole code - try running this in keeperfx/src:
    Code:
    grep -Rxe "^[[:space:]]*\(return[[:space:]]*\|\)\_DK\_[[:alnum:]\_]*[(].*[)].*;.*$" *.c | wc -l > _not_rewritten_count.txt
    Note that you need coreutils to for this to work. The number is written to "_not_rewritten_count.txt".

  5. #5
    Ghost
    Join Date
    Dec 2010
    Location
    Madrid, Spain
    Posts
    368

    Default Re: KeeperFX work

    Sorry mefistotelis, i don't have an Unix/Linux OS here to run a grep. Can you tell me the result of executing that regex expression? What is the resulting count?

  6. #6
    KeeperFX Author mefistotelis's Avatar
    Join Date
    Sep 2009
    Location
    Poland
    Posts
    1,242

    Default Re: KeeperFX work

    You can install MSYS, it includes windows ports of coreutils:
    http://sourceforge.net/projects/mingw/files/
    (download the installer of MinGW; it includes MSYS).

    There is also more direct approach (a bit outdated, but still working):
    http://gnuwin32.sourceforge.net/packages/coreutils.htm

    The most recent result is: 574

  7. #7
    Ghost
    Join Date
    Dec 2010
    Location
    Madrid, Spain
    Posts
    368

    Default Re: KeeperFX work

    Quote Originally Posted by mefistotelis View Post
    The most recent result is: 574
    Are you sure your regexp is correct? Doing an exactly search of "return _DK_" gives 536 (this is counting the comments also --> //return _DK_...), and 301 without counting the comments. Can be your regexp counting also the comments??? Note that I did that search on the KeeperFX 0.40 that was uploaded to the website months ago, not the last source code on the repository.
    Last edited by jomalin; July 13th, 2012 at 00:36.

  8. #8
    KeeperFX Author mefistotelis's Avatar
    Join Date
    Sep 2009
    Location
    Poland
    Posts
    1,242

    Default Re: KeeperFX work

    Well, I could make a mistake - hard to tell.

    Counting functions which are rewritten, but still remain in form of comments:
    Code:
    grep -Rxe "^[[:space:]]*\(//return[[:space:]]*\|//\)\_DK\_[[:alnum:]\_]*[(].*[)].*;.*$" *.c | wc -l > _rewritten_count.txt
    gives me 384.

    I'm using the latest version from SVN repo - you can easily get it with:
    Code:
    svn checkout http://keeperfx.googlecode.com/svn/trunk/ keeperfx-read-only
    (to have command line SVN tools, you have to select them while installing TortoiseSVN)

    EDIT:
    Remember that not all functions are returning a value .
    This is why my regular expression has "\(return[[:space:]]*\|\)" - which means: match the word "return" and any amount of spaces after it, or completely skip that part (match 0 characters).
    Last edited by mefistotelis; July 13th, 2012 at 15:49.

  9. #9
    Ghost
    Join Date
    Dec 2010
    Location
    Madrid, Spain
    Posts
    368

    Default Re: KeeperFX work

    Yes, I was trying to write a regexp in the "Search in Files" option in Notepad++ with the regular expression search mode, to count also more than 1 space after "return", but it didn't get it, so I did a normal search :-(, so yours is the perfect one.

    As you can see, I edited my first post and add a new point relative to weird variable names...

    A question: and how many functions have you already rewritten? Or what is the percentage? Simple curiosity

  10. #10
    KeeperFX Author mefistotelis's Avatar
    Join Date
    Sep 2009
    Location
    Poland
    Posts
    1,242

    Default Re: KeeperFX work

    It's hard to tell.

    Dungeon Keeper was compiled with compiler optimizations enabled, so the machine code does not completely match original source code. For example, original code could have more functions, and some of them probably were inlined (their body inserted in place where they were called) by the compiler.

    Also, KeeperFX does not completely match the original implementation - I probably made a few more functions than DK had.

    There are tools which can count total amount of functions in KeeperFX code - that's the best estimate we can get.

Similar Threads

  1. How to get the official editor to work with KeeperFX
    By DragonsLover in forum KeeperFX
    Replies: 82
    Last Post: December 17th, 2023, 23:40
  2. Replies: 1
    Last Post: September 13th, 2011, 05:44
  3. How to get the official editor to work with KeeperFX
    By DragonsLover in forum DK1 Mapmaking
    Replies: 0
    Last Post: February 15th, 2011, 01:15
  4. Replies: 2
    Last Post: January 8th, 2011, 20:34

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •