DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

[Code] Calculate Best Possible Scores for Each Level ?
Page 1 of 1
DieHard Wolfers Forum Index -> Code Tutorials View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 16 Jul 2019

Topics: 56
Posts: 2234
Location: Canada
blank.gif

PostPosted: Fri Nov 07, 2003 3:31 am
   Subject: [Code] Calculate Best Possible Scores for Each Level ?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

If you ever wondered how many points you can get on each level in your addon (or in the original game), and didn't want to go the trouble of playing every level on every skill level to find out (haha, I'm so guilty of taking that long route for wolf3d!); than here's a quick function I threw together to tell you how many points you can get from each floor: Very Happy

::: CODE :::
void CalculateScore (void)
{
   int   tile,x;
   int   sc,kc,pc,rc,tc;
   byte    e1,e2;
   unsigned   far   *fresh;

   fresh = mapsegs[1];
   sc=kc=pc=rc=tc=e1=e2=0;
   for (x=0;x<4096;x++)
   {
      tile = *fresh++;
      if (!tile)
         continue;

      switch (tile)
      {
      case 52: tc++; break;
      case 53: tc+=5; break;
      case 54: tc+=10; break;
      case 55: tc+=50; break;

      case 98: pc++; break;

      case 108: case 109: case 110: case 111:
      case 112: case 113: case 114: case 115:
         kc++; break;

      case 144: case 145: case 146: case 147:
      case 148: case 149: case 150: case 151:
         if (gamestate.difficulty > 1)
            kc++;
         break;

      case 180: case 181: case 182: case 183:
      case 184: case 185: case 186: case 187:
         if (gamestate.difficulty > 2)
            kc++;
         break;

      case 134: case 135: case 136: case 137:
      case 138: case 139: case 140: case 141:
         kc+=2; break;

      case 170: case 171: case 172: case 173:
      case 174: case 175: case 176: case 177:
         if (gamestate.difficulty > 1)
            kc+=2;
         break;

      case 206: case 207: case 208: case 209:
      case 210: case 211: case 212: case 213:
         if (gamestate.difficulty > 2)
            kc+=2;
         break;

      case 116: case 117: case 118: case 119:
      case 120: case 121: case 122: case 123:
         kc+=4; break;

      case 152: case 153: case 154: case 155:
      case 156: case 157: case 158: case 159:
         if (gamestate.difficulty > 1)
            kc+=4;
         break;

      case 188: case 189: case 190: case 191:
      case 192: case 193: case 194: case 195:
         if (gamestate.difficulty > 2)
            kc+=4;
         break;

      case 126: case 127: case 128: case 129:
      case 130: case 131: case 132: case 133:
         kc+=5; break;

      case 162: case 163: case 164: case 165:
      case 166: case 167: case 168: case 169:
         if (gamestate.difficulty > 1)
            kc+=5;
         break;

      case 198: case 199: case 200: case 201:
      case 202: case 203: case 204: case 205:
         if (gamestate.difficulty > 2)
            kc+=5;
         break;

      case 216: case 217: case 218: case 219:
      case 220: case 221: case 222: case 223:
         kc+=7; break;

      case 234: case 235: case 236: case 237:
      case 238: case 239: case 240: case 241:
         if (gamestate.difficulty > 1)
            kc+=7;
         break;

      case 252: case 253: case 254: case 255:
      case 256: case 257: case 258: case 259:
         if (gamestate.difficulty > 2)
            kc+=7;
         break;

      case 160:
         kc+=20; break;

      case 107: case 125: case 142: case 143:
      case 161: case 178: case 179: case 196:
      case 197: case 214: case 215:
         kc+=50; break;

      case 106: e1 = 1; break;

      case 224: case 225: case 226: case 227:
         e2 = 1; break;
      }
   }
   #ifndef SPEAR
   if (gamestate.mapon < 8)
   #else
   if (gamestate.mapon != 4 && gamestate.mapon != 9
       && gamestate.mapon != 15 && gamestate.mapon < 17)
   #endif
      rc = 100*((kc!=0 && e1==0 && e2==0)+(tc!=0)+(pc!=0));
   else
   {
      #ifndef SPEAR
      if (gamestate.mapon == 8)
      #else
      if (gamestate.mapon == 20)
      #endif
         rc = 0;
      else
         rc = 150;
   }

   CenterWindow (15,15);
   US_Print ("  Maximum Points\n ----------------");
   US_Print ("\n\nAvailable:");
   if (sc < 1000)
      PrintX=168;
   else
      PrintX=166;
   if (e1 != 1)
   {
      sc=tc+kc+rc;
      if (sc < 2000)
         US_Print (" ");
      US_PrintUnsigned (sc);
   }
   else
      US_Print ("infinity");
   US_Print ("00\nTreasure:");
   PrintX=173; US_PrintUnsigned (tc);
   US_Print ("00\nBad Guys:");
   PrintX=173; US_PrintUnsigned (kc);
   US_Print ("00\nElevator:");
   PrintX=173; US_PrintUnsigned (rc);
   US_Print ("00\nOld Score:");
   if (gamestate.oldscore/100 < 1000)
      PrintX=168;
   else
      PrintX=166;
   if (gamestate.oldscore/100 < 2000)
      US_Print (" ");
   if (gamestate.oldscore == 0)
      US_Print (" n/a");
   else
      US_PrintUnsigned (gamestate.oldscore);
   US_Print ("\n\n Total:  ");
   if (e1 != 1)
   {
      sc += gamestate.oldscore/100;
      if (sc > 10000)
      {
         US_PrintUnsigned (sc/10000);
         US_Print (",");
      }
      else
         US_Print ("  ");
      if (sc > 10)
      {
         if ((sc/1000)%10 == 0 && sc > 10000)
         {
            US_Print("0");
            if ((sc/100)%10 == 0)
               US_Print("0");
         }
         US_PrintUnsigned ((sc/10)%1000);
         US_Print (",");
      }
      else
         US_Print (" ");
      US_PrintUnsigned (sc%10);
   }
   else
      US_Print ("infinity");
   US_Print ("00\n\n Have a nice day! :)");
   VW_UpdateScreen();
   IN_Ack ();
}

Weird way of making the code I guess, but it was the first thing I could think of (just grabbing the original memory bank and doing a full search for everything I wanted)... lol. You can plug the function into to almost anywhere, really. I just threw it above the CountObjects() function in WL_DEBUG.C; and than changed the 'Tab-X key' statement from this:

::: CODE :::
else if (Keyboard[sc_X])         // X = item cheat
{
   CenterWindow (12,3);
   US_PrintCentered ("Extra stuff!");
   VW_UpdateScreen();
   // DEBUG: put stuff here
   IN_Ack ();
   return 1;
}

To this:

::: CODE :::
else if (Keyboard[sc_X])         // X = item cheat
{
   // DEBUG: put stuff here?! OK!!!! :)
   CalculateScore();
   return 1;
}

It should work fine in Spear of Destiny too, although I've never tried it yet. The "Bad Guys" section depends on your skill level, and the "Elevator Ratios" section depends on your floor and if there are pac-man and/or specific bonus types on the level. I didn't really consider enemies or treasure that are inside walls or unaccessible, but I'm guessing most of the floors you make won't have stuff in them that you can't actually reach (although, E2L8 does have all those secret treasure areas on the way to Mr. Aardwolf that are IMPOSSIBLE to get to - lol).

Well, now I'm going to try and look into gettin Par Time bonuses into the mix. Should be really interesting, considering all the things that you'd need to know to figure out if a par time can be beaten; and what combinations or score/par bonuses would work out best. Man, just thinking of all the variables; the players running and strafting speeds per frame, angles and when to turn while moving, best ways to skim past the walls and doors, when to shoot the enemies / how much damage they will give off and when to run for health, calculating the paths and directions to the elevator/keys that will work out best; seeing if a trip to the secret elevator or to another room to let a guard open the door for you will save time; etc.

There's so many depths that lie in each of those strategies and other things to consider that it would be an incredibly challenging task to impliment perfectly. Would be funny though, KNOWING that the best possible time to beating E1L1 on "Bring Em On" based on all possible choices of movement and shots to the enemies was 1451 tics (20.73 seconds); and trying to combine that knowledge with the locations of all the treasure/guards to try and figure out the best possible score. Mr Green
Arielus
Moderator
<B>Moderator</B>


Joined: 13 Mar 2003
Last Visit: 4:19 ago.

Topics: 25
Posts: 841
Location: Buenos Aires, Argentina
argentina.gif

PostPosted: Fri Nov 07, 2003 5:07 am
   Subject: Re: Best Possible Scores for Each Level ?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Chris! You should've come up with this function when I was making The Golden Episodes, man! D'you know how many times I had to play, replay and replay over and over again my levels in that set to really make sure that the final scores were the ones I wanted? I must've played the whole mod at least five times in every single skill level before convincing myself that the maximun possible scores were those listed in the game's Secret Scroll!

Next time you develop such a great procedure like this one, do hurry up and let me know before I finish! Mr Green


Ariel.

_________________
Hot to Rock - Long Live Metal!
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 16 Jul 2019

Topics: 56
Posts: 2234
Location: Canada
blank.gif

PostPosted: Fri Nov 07, 2003 5:08 pm
   Subject: Re: Best Possible Scores for Each Level ?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Ariel, dude, that section B of the "Secret Scroll" for The Golden Episodes was one of the coolest surprises ever! Man, I was seriously SO BLOWN AWAY when I read about that in the Secret Scroll when it first came out on Mr. Lowe's Page! Makes you really wonder, god, about all the things you had to change in regards to treasure and enemy strategies to make it work out perfectly like that on every skill level of every episode. That was truly an incredible secret, even cooler than those mega everything-taken-care-of Blake Stone savedgames you sent me during the springtime... Mr Green

Well, I was playing around with the 100% score idea some more; and here's a much simpler way to make it figure out the best scores on each level. All it does it kill everyone on the level (haha), gives you ALL the static objects, and knocks your secret ratio up to 100%; than send you off to the next level. To use it, just replace this statement in WL_DEBUG.C:

::: CODE :::
if (Keyboard[sc_E])      // E = quit level
{
   if (tedlevel)
      Quit (NULL);
   playstate = ex_completed;
//   gamestate.mapon++;
}

With this one:

::: CODE :::
if (Keyboard[sc_E] && gamestate.score == gamestate.oldscore)   // E = pass with 100% score
{
   gamestate.secretcount = gamestate.secrettotal;
   for (obj=player->next;obj;obj=obj->next)
      KillActor(obj);
   for (level=0;gamestate.treasurecount < gamestate.treasuretotal; level++)
      GetBonus(&statobjlist[level]);
   if (gamestate.killcount > gamestate.killtotal)
      gamestate.killcount = gamestate.killtotal;
   gamestate.TimeCount = 420000;
   playstate = ex_completed;
}

One thing to note, though, is that after you beat a level - the new objects that are assigned the "walkthrough" state will retain the characteristics of the object that was in memory from the last level; thus giving you an incorrect treasure score. To avoid this, just add this line (or something similar) to the very top of the SpawnStatic() function of WL_ACT1.C:

::: CODE :::
laststatobj->itemnumber = dressing;

Now all you have to do is press Tab-E when the debugging codes are activated to pass each level with 100% score. The only restriction is that you can't grab any points from the level before you press the Magic Keys (to avoid getting a score above possible! lol). You can use this new code, or the first one, or both if you really want; haha! Have fun. Smile
Majik Monkee
Pixel Master
Pixel Master


Joined: 23 Jun 2003
Last Visit: 05 Dec 2018

Topics: 81
Posts: 1641
Location: Missouri
usa.gif

PostPosted: Tue Nov 25, 2003 11:00 am
   Subject: Re: Best Possible Scores for Each Level ?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

What is the "secret scroll" all about? Or is it too much of a secret? *lol* You got my curiosity piqued...I haven't had a chance to play the project yet myself.

Chris, that sounds like a super cool bit of calculation...does it factor in the possibility that someone might get a speed bonus AND get every treasure and enemy? If there is such a person, I would like to bow to them and pay them homage and give half my Star Wars collection to the poor...that would truly be an accomplishment...Laughing

I'm with Ariel...if you're going to invent something this great, do it before our projects come out! *lol* I'm probably the person who needs something like this the most...I'm good, but not THAT good...can't even remember where half my own secrets are...Laughing

_________________
"Do or do not. There is no try." ~Yoda~
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 16 Jul 2019

Topics: 56
Posts: 2234
Location: Canada
blank.gif

PostPosted: Tue Nov 25, 2003 3:35 pm
   Subject: Oh boy, oh boy... let's flip a coin
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Bleh, my PM account seems to be giving me "Page Not Found" errors all the time when I try to send messages; so I'll post you my reply here Adam. In the future, it might be easier if we emailed through choksta@hotmail.com - as my DHW account is always getting full because I forget to keep organizing it (on the inbox AND sentbox - lol). I've just replaced some of things you might not want people to know with the word *secret*. Laughing

Adam Biser wrote:
I noticed your CalculateScore function today...
That's actually something on my list of things to do for WDC.... I was going to include that in the Map Difficulty screen, but it'll be awhile before I get to it.
This would mean I'd have to do some restructuring of the WDCMapData files (so that the points awarded for each object could be stored for each difficulty level).

Very cool function for the actual source though.
Same with your TAB-E change.

That's cool that you found a purpose for the CaluclateScore thing. I just did it for fun; and I thought I'd share it with the club. Yeah, I see why you liked the first example - as it would be pretty cool to know that information for some kind of external score calculation (a program that just reads the gamemaps file; like a mapeditor - for instance). Wink

I like the Tab-E one alot better (because it's shorter), but I didn't bother making a "sheet" that shows everything for that one; because you can pretty much combine some of example 1 with example 2 for that purpose if you really wanted (just adding a few ints that minus the gamestate.oldscore from the previous calculation to figure out treasure/enemies stuff itself). Glad you liked it though!

Adam Biser wrote:
Chris wrote:
Hey, did you manage to get TED5 working at all? It's very interesting, as all it does is load the ega/vgagraph textures and loads the map - so I'm sure it wouldn't be that hard to get it to work for Wolf3d. I might look into that pretty soon, just for fun.... Smile

No, I haven't got it working.
I've kind of given up on it, the picture you posted showed my what I was interested in. Very nice. Sad

I've been working on getting *secret* series data viewable in WDC, but I'm stuck on the EGAGRAPH, I just can't get the images to look right. Evil or Very Mad

Sounds awesome man (with *secret* *secret*). Your editor has alot of unique things to it already - but this would make it even cooler! Funny that you mention *secret*, I was just thinking how cool it would be to have an editor for something like Ken's Labyrinth today - that's another game that would be funny to edit (even though it's structure has nothing to do with Wolf3d). I'm gonna download the latest copy of WDC right now and test everything out.... just for fun.

Glad the picture was what you wanted. TED5 is pretty buggy (the way it handles the mouse on both modes; for instance), but it has some pretty cool features built in (like CarmackCompress). Do you think it really was because you didn't have enough memory? Not sure why, but mine always has a default of 8 meg... so I guess that's why I didn't have a problem loading it - but I'm not positive; as I don't have other people's computers to test the program out on. Oh well.

Good luck with all that *secret* stuff man; it sounds very interesting. Mr Green
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 11 Jul 2019

Topics: 46
Posts: 2331
Location: USA
usa.gif

PostPosted: Tue Nov 25, 2003 4:07 pm
   Subject: Re: Oh boy, oh boy... let's flip a coin
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Chris wrote:
I've just replaced some of things you might not want people to know with the word *secret*.

It's ok. Laughing
To let everyone in on this 'secret', I'm working on getting WDC able to view the Catacomb 3D series.

Chris wrote:
I'm stuck on the EGAGRAPH, I just can't get the images to look right. Evil or Very Mad

If anyone knows anything about this (say from Commander Keen or where ever) please let me know!

Chris wrote:
but it has some pretty cool features built in (like CarmackCompress).

That's another thing I'd like to implement into WDC.

EDIT: for a look at what I'm getting from EGAGRAPH, check this out:
http://winwolf3d.tripod.com/cat3d/

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
Arielus
Moderator
<B>Moderator</B>


Joined: 13 Mar 2003
Last Visit: 4:19 ago.

Topics: 25
Posts: 841
Location: Buenos Aires, Argentina
argentina.gif

PostPosted: Wed Nov 26, 2003 10:12 pm
   Subject: Re: Best Possible Scores for Each Level ?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Majik,

The Golden Episodes' Secret Scroll is a document I wrote before the game was released in February '03. Inside this document, I included information which the mod's package did not -and does not at the moment I'm writing this- feature at all; therefore, you won't get the Secret Scroll only by downloading the game itself now. At least, I think so... Not that I know is the game being distributed with this document within.

Anyway, I had the idea to keep this document in secrecy, and send it only to the people who wrote to me to request some help, or to make a comment on the game. After some days of the set's release, several wolfers did write and I sent them the Secret Scroll in order to help them out of their problems with the game's difficulty, or simply to thank them for having taken the time to drop me a letter on the add-on.

Some months went by and I decided to make the file public, for I believed it no longer made sense to keep it the way I'd been keeping it. I hoped, after the months that had gone by, that doing so would bring back some interest in the game among the community members. And so, I did it. Exactly six months after The Golden Episodes was released, the Secret Scroll was made public, and everybody was able to see what up to that moment had been reserved only to a few people.

It ain't no big deal, but it's nice enough, and I like it. If you like The Golden Episodes, then the Secret Scroll contains information that you may be interested in. I honestly don't know where you could get it now, but I'm sure that doing a quick search will be enough, and you'll eventually find it. If you can't, yet still wanna grab it, send me an e-mail and I'll deliver the file to you.

Ariel.

_________________
Hot to Rock - Long Live Metal!
Majik Monkee
Pixel Master
Pixel Master


Joined: 23 Jun 2003
Last Visit: 05 Dec 2018

Topics: 81
Posts: 1641
Location: Missouri
usa.gif

PostPosted: Mon Dec 01, 2003 5:58 am
   Subject: Re: Best Possible Scores for Each Level ?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Ahhh...the light bulb is going on in my head...i think I remember seeing something about that on the Dome news...but I wasn't familiar with the set at the time, so it didn't make sense to me then...of course now it does (and I still intend fully to give your levels a whirl!) Thanks for the info! Very Happy

_________________
"Do or do not. There is no try." ~Yoda~
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Tutorials View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 1
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts [Code] Display Different Ammo Types on Statusbar-BrotherTank
Author: BrotherTank
1 3291 Fri Feb 11, 2005 9:18 pm
Zombie_Plan View latest post
No new posts [Code] Adding a Frames per Second Counter - Darkone
Author: BrotherTank
0 2422 Sat Mar 13, 2004 2:07 pm
BrotherTank View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 2720 Tue Jan 27, 2004 10:29 am
BrotherTank View latest post
No new posts [Info] Giving a Guard a Rocket Launcher
Author: Guest
4 197 Fri Jan 23, 2004 1:58 pm
Guest View latest post
No new posts [Code] Changing Weapons -CheckWeaponChange- BrotherTank
Author: BrotherTank
2 3635 Sun Oct 26, 2003 1:21 am
Guest View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group