KA Vista fixes

KOMAT
Warrior Recruit
Warrior Recruit
 
Posts: 94
Joined: 14th Dec 2000
Location: Prague, Czech Republic

KA Vista fixes

Postby KOMAT » Sat Jan 15, 2011 5:09 pm

I created a KA specific DX wrapper which converts the rendering to DX9 to fix the rendering problems (white background flashes in my case). It also improves the graphic to some degree by using 24 bit color depth during 3D rendering. Textures are still 16 bit so there might be some space for additional improvement. Additionally it creates mipmaps (using the autogen functionality supported by almost all dx9+ cards) for all textures and uses trilinear filtering to reduce the visual noise.

While creating it, I found (well the Application Verifier tool did) a multithreading related problem which could corrupt memory management structures and lead to crash. While the problem was always present, the multicore CPUs increase the chance of the corruption actually happening. So I created a small fix which fixes that.

You can find both fixes at http://jiridvorak.webpark.cz/ka/. The launcher setup screen uses api interfaces which are not necessary for the game and thus not implemented by the wrapper. You have to set the resolution before using the wrapper as the launcher will otherwise complain that DX7 is not installed.

I tested the wrapper with Vista 64bit. It might also work on XP however I did not test it at that OS and Alt+Tab will be not supported in that case. I only tested it on Nvidia card (GTX 460) so there might be problem on ATI cards. In that case let me know and I will try to fix it.

The wrapper is specific to KA in both the features it really emulates and in hacks used for the 24bit rendering. It will not work with other games.

John
Chancellor
Chancellor
 
Posts: 2460
Joined: 14th Nov 2000
Location: United Kingdom

Postby John » Sat Jan 15, 2011 5:11 pm

Outstanding work! I will give this a try ASAP.
I'm telling you Teal'C if we don't find a way out of this soon I'm gonna loose it. Loose it, it means go crazy, nuts, insane, bonzo, no longer in possession of ones faculties, 3 fries short of a happy meal, WHACKO!
Image

Dater
Elite Warrior
Elite Warrior
 
Posts: 212
Joined: 23rd Jun 2003
Location: Germany

you have gotta to be kidding me!

Postby Dater » Sat Jan 15, 2011 8:44 pm

are you telling you just came up with an ingenius solution to play Klingon Academy? And that on the EXACT same day I had a weird feeling/urge to install and try out KA? That simply can't be an coincidence!

I am trying it out right now! And will report the results to you in a couple of minutes!

John
Chancellor
Chancellor
 
Posts: 2460
Joined: 14th Nov 2000
Location: United Kingdom

Postby John » Sat Jan 15, 2011 8:51 pm

Just been doing some tests, it works!

Intel Core 2 Quad Q9650 3GHz @ 4.03GHz
NVIDIA GeForce GTX 285 2GB (Game running at 1920 x 1200)
8GB G.Skill Memory
3 * G.Skill 64GB SSD's in RAID 0
Windows 7 Ultimate x64

Who would have thought I could run KA on the above with 16 ships in Quick Battle at 20-40FPS with to crashes, fire lag or white flashing :)

Nice work KOMAT!
I'm telling you Teal'C if we don't find a way out of this soon I'm gonna loose it. Loose it, it means go crazy, nuts, insane, bonzo, no longer in possession of ones faculties, 3 fries short of a happy meal, WHACKO!
Image

Dater
Elite Warrior
Elite Warrior
 
Posts: 212
Joined: 23rd Jun 2003
Location: Germany

First test results

Postby Dater » Sat Jan 15, 2011 9:13 pm

System:
MacBookPro mid 2010 2,4Ghz, 4GB RAM, Nvidia 320M with 256MB running a WinXP 32-Bit VM with 1GB RAM in Parallels Desktop 6 ("full" D3D 9 support).

After applying the hex patch for multithreading and copying the ddraw.dll into the KA dir:
Error initializing hardware D3D video mode 640x480

d3demu.log:
HW:Initializing DX9 HW 1024x768
HW:Unable to create device 8876086c
HW init failed
HW:Deinitializing DX9 emu

As I am writing this I am installing KA to my little home server. The OS is Win7 32-Bit and an on board ATI graphics card.

I will have the results in a few minutes...

KOMAT
Warrior Recruit
Warrior Recruit
 
Posts: 94
Joined: 14th Dec 2000
Location: Prague, Czech Republic

Postby KOMAT » Sat Jan 15, 2011 9:50 pm

Dater wrote:HW:Unable to create device 8876086c


I was incorrectly using a creation flag which is Vista+, try the new version (1.01).

Dater
Elite Warrior
Elite Warrior
 
Posts: 212
Joined: 23rd Jun 2003
Location: Germany

a few minutes later...

Postby Dater » Sat Jan 15, 2011 10:24 pm

oops... that were more than a few minutes :P

I just had a lot of fun destroying a K'Tinka piece by piece haha :)

I played it for about 20 Minutes without problems in 640x480. But if I try to play it in a higher resolution it's getting too slow to be playable...
If I rename the ddraw.dll then it runs smooth in the highest resolution but the flashing star field is just killing me ;)

d3demu.log:
HW:Initializing DX9 HW 640x480
HW:Created extended D3D interface. Alt+Tab is supported.
HW:Using D16
HW:Deinitializing DX9 emu

Dater
Elite Warrior
Elite Warrior
 
Posts: 212
Joined: 23rd Jun 2003
Location: Germany

Hooroaayyyy!

Postby Dater » Sat Jan 15, 2011 10:40 pm

KOMAT wrote:I was incorrectly using a creation flag which is Vista+, try the new version (1.01).


Your new 1.01 did the trick! Klingon Academy is now running smoothly in highest resolution on on a Virtual Machine on my Macbook Pro with Nvidia 3D card!

WOW!!!

THANK YOU SOO MUCH!!

You are obviously a very skilled game developer!

Please send me a PM with your Paypal email, I would like to express my gratitude ;)

Dater
Elite Warrior
Elite Warrior
 
Posts: 212
Joined: 23rd Jun 2003
Location: Germany

Postby Dater » Sat Jan 15, 2011 10:52 pm

[quote="Dater"]I played it for about 20 Minutes without problems in 640x480. But if I try to play it in a higher resolution it's getting too slow to be playable...
If I rename the ddraw.dll then it runs smooth in the highest resolution but the flashing star field is just killing me ]

That related to my home server running a ATI X1200 on board graphics chip.

But at this point I simply don't care! I am just so glad it runs on my Macbook Pro! :D

Can KA still be played online over gamespy? I installed a Camrade thingy...

John
Chancellor
Chancellor
 
Posts: 2460
Joined: 14th Nov 2000
Location: United Kingdom

Postby John » Sat Jan 15, 2011 11:19 pm

I feel a multiplayer tournament coming on :)
I'm telling you Teal'C if we don't find a way out of this soon I'm gonna loose it. Loose it, it means go crazy, nuts, insane, bonzo, no longer in possession of ones faculties, 3 fries short of a happy meal, WHACKO!
Image

KOMAT
Warrior Recruit
Warrior Recruit
 
Posts: 94
Joined: 14th Dec 2000
Location: Prague, Czech Republic

Postby KOMAT » Sat Jan 15, 2011 11:38 pm

Dater wrote:Your new 1.01 did the trick!

I am glad that I was able to help.

As for the lowend ATI card, I might be memory bandwidth related as the wrapper does additional fullscreen operations to emulate some features and allow the 24 bit mode. Or there might be some problem in interaction with the ATI drivers. I do not have any ATI card at home to test this.

You are obviously a very skilled game developer!

I worked on few games however this was more about finding documentation for very old versions of the DX API which is somewhat opposite to what game developers usually do :D

formerkauser
Elite Warrior
Elite Warrior
 
Posts: 227
Joined: 13th Jun 2008

Postby formerkauser » Sun Jan 16, 2011 8:02 am

I don't know what to say. I've had the idea for quite awhile that some kind of wrapper needs to be written for KA, but I don't have near the skills to accomplish what KOMAT did. I'm really glad someone finally stepped up and made one. All I can say is, great work KOMAT. There are developers, and there are gifted, skilled developers. I would say you are the latter. :) Hell I'd promote you, but I don't have that power. :D
And to think I almost gave away my KA set recently. I can't thank you enough for this KOMAT, really great work! It's a pity you are so far away or I'd ship you a case of romulan ale!
Formerly known as Koloth. :)

I am the Star Trek purist. :D

KA.com night janitor.

Dater
Elite Warrior
Elite Warrior
 
Posts: 212
Joined: 23rd Jun 2003
Location: Germany

Postby Dater » Sun Jan 16, 2011 9:15 am

formerkauser wrote:I can't thank you enough for this KOMAT, really great work! It's a pity you are so far away or I'd ship you a case of romulan ale!


I assume a small paypal donation would do, as I did yesterday ;)

formerkauser
Elite Warrior
Elite Warrior
 
Posts: 227
Joined: 13th Jun 2008

Postby formerkauser » Sun Jan 16, 2011 10:03 am

Well I did a bunch of testing. It's really very interesting. I have a Lenovo T410, with a core i5, 4GB RAM, windows 7 and intel integrated graphics. KA played wonderfully. At 800x600 it performed very well, but that was with just a couple of ships.
I did notice an oddity, but torpedo accuracy is way off, even when sensors are boosted. Not that I'm complaining because all of the rendering issues have been fixed. It's been quite a while since I really sat down and played KA, I remember the torpedoes always shooting cock-eyed, so maybe that's no different. ;)
All in all it was a joy to play again. I really hope the old timers come back and discover this thread. :)
Formerly known as Koloth. :)

I am the Star Trek purist. :D

KA.com night janitor.

formerkauser
Elite Warrior
Elite Warrior
 
Posts: 227
Joined: 13th Jun 2008

Postby formerkauser » Sun Jan 16, 2011 2:24 pm

Hey, here's the code to compile a patcher for the KA exe. Just need a C compiler.

Code: Select all
#include < stdlib.h >
#include < stdio.h >

int main()
{
   FILE* file = fopen("ka.exe", "rb+");

   fseek(file, 0x0030F1AB, SEEK_SET);
   fputc(char(0x90), file);

   fseek(file, 0x0030F1AC, SEEK_SET);
   fputc(char(0x90), file);

   fseek(file, 0x0030F1AD, SEEK_SET);
   fputc(char(0x90), file);

   fclose(file);

   printf("Patching complete!\n");
   printf("Press enter to continue...");
   getchar();
   return 0;
}


If someone wants to compile this and put it up, so it would be easier for inexperienced people than using a hex editor. :)
Formerly known as Koloth. :)

I am the Star Trek purist. :D

KA.com night janitor.

KOMAT
Warrior Recruit
Warrior Recruit
 
Posts: 94
Joined: 14th Dec 2000
Location: Prague, Czech Republic

Postby KOMAT » Sun Jan 16, 2011 5:34 pm

formerkauser wrote:If someone wants to compile this and put it up, so it would be easier for inexperienced people than using a hex editor. :)


You are right. While the manual version has some advantages, it might be too complex for many people. I created a patcher variant with additional error and file version checks. It is now available on the page.

formerkauser
Elite Warrior
Elite Warrior
 
Posts: 227
Joined: 13th Jun 2008

Postby formerkauser » Sun Jan 16, 2011 8:45 pm

This should be front page news John. :cool: It's worthy of it. :D
Formerly known as Koloth. :)

I am the Star Trek purist. :D

KA.com night janitor.

John
Chancellor
Chancellor
 
Posts: 2460
Joined: 14th Nov 2000
Location: United Kingdom

Postby John » Sun Jan 16, 2011 9:07 pm

Indeed, now KA is playable again I had better fix the site lol.

I did find a load of disks filled with mods about a month ago, will need to set aside some time to get this sorted.
I'm telling you Teal'C if we don't find a way out of this soon I'm gonna loose it. Loose it, it means go crazy, nuts, insane, bonzo, no longer in possession of ones faculties, 3 fries short of a happy meal, WHACKO!
Image

formerkauser
Elite Warrior
Elite Warrior
 
Posts: 227
Joined: 13th Jun 2008

Postby formerkauser » Sun Jan 16, 2011 9:18 pm

I hope you don't mind I stickied this thread. ;) I gotta go play some KA, I'm having withdrawals. See you all later! :)

Edit: Is anyone having any weapons accuracy issues, or is it just me? It seems very prominent.
Formerly known as Koloth. :)

I am the Star Trek purist. :D

KA.com night janitor.

Dater
Elite Warrior
Elite Warrior
 
Posts: 212
Joined: 23rd Jun 2003
Location: Germany

Postby Dater » Mon Jan 17, 2011 9:17 am

formerkauser wrote:Edit: Is anyone having any weapons accuracy issues, or is it just me? It seems very prominent.


I cannot confirm this yet. It was too late the other night and I had something to drink ;) will pay attention to it when I got home from work.

But as I recall KA always was more of a simulation. So it wouldn't hurt if evasive manouvrrs would really do somethinh ;)

Sorry for my occasionally bad spelling. I am on an iPhone AND in a train ;)

Next

Return to Technical Support