Duke4.net Forums: Is there a way to use CONs to fix minor issues? - Duke4.net Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Is there a way to use CONs to fix minor issues?

User is online   Ninety-Six 

#1

So this is sort of a difficult question to ask, though more out of a lack of any sort of baseline to go off of.

After seeing some similar fixes arise within both Nuclear Showdown and the upcoming Alien Armageddon, I'm sort of wondering how some of them were applied. Things like bumping up the Night Vision goggles visibility, making the holoduke actually work, putting a stop to the annoying trooper fakeout behavior, etc...

I know CONs were made external to allow users to sort of personalize the game. And I've been wanting to apply some of these fixes to the vanilla game for some time (for my own personal use, not for release). Unfortunately, as much as I love this game, I know less about it on the technical side versus Doom. When I want to figure out how something was done in Doom, I crack open SLADE and take a look. I can't make heads or tails of the more advanced stuff, but I've gotten a feel for both the map editor and some basic scripting through this method.


Meanwhile I open up a CON file that isn't USER and I instantly go cross-eyed.

Maybe I'm wrong and these things require something more than CONs to fix. If so, I'm still interested to know how to accomplish this.

This post has been edited by Ninety-Six: 19 April 2018 - 09:34 PM

0

User is online   Danukem 

  • Duke Plus Developer

#2

CON is the scripting language used by Duke 3D. While a lot of what goes on in the game is hardcoded, a fair amount is controlled by scripting. The 1996 game shipped with three scripting files: GAME.CON, USER.CON, and DEFS.CON. In the base game, the CON files include sound definitions, various user defined settings, and the code for various "actors", including a majority of the enemies.

Since the advent of EDuke, CON has undergone many enhancements. It is now possible to script almost every aspect of the game, including using scripts to override what is hardcoded.

Most of the documentation for CON can be found here: http://wiki.eduke32.com/wiki/Scripting

EDIT: This document still serves as a good starting point: http://wiki.eduke32.com/wiki/Confaq42
I recommend reading through most of that page, and paying particular attention to the examples.

This post has been edited by Trooper Dan: 19 April 2018 - 10:01 PM

0

User is online   Ninety-Six 

#3

View PostTrooper Dan, on 19 April 2018 - 09:55 PM, said:

Most of the documentation for CON can be found here: http://wiki.eduke32.com/wiki/Scripting


That's a bit rough... Right out of the gate it hits me with terms I don't fully grasp since I'm not really a programmer. It doesn't help that I tend to learn best by example, but I can't even make sense of the tutorials...

Oh boy, I'm in for a fun night...

EDIT:

View PostTrooper Dan, on 19 April 2018 - 09:55 PM, said:

EDIT: This document still serves as a good starting point: http://wiki.eduke32.com/wiki/Confaq42
I recommend reading through most of that page, and paying particular attention to the examples.


I looked at this too, and it's sort of a similar result. I hit the CON Building Blocks section and I instantly get walled with terms I don't understand, and an example I have so many questions about

This post has been edited by Ninety-Six: 19 April 2018 - 10:10 PM

0

User is online   Danukem 

  • Duke Plus Developer

#4

Try this: http://cd.textfiles....TDOX/CONFAQ.TXT

It's from like 1997 1996 and doesn't cover very much, but it breaks things down in a very simple way without overwhelming the reader or assuming you know anything.
1

User is online   Ninety-Six 

#5

View PostTrooper Dan, on 19 April 2018 - 10:15 PM, said:

Try this: http://cd.textfiles....TDOX/CONFAQ.TXT

It's from like 1997 and doesn't cover very much, but it breaks things down in a very simple way without overwhelming the reader or assuming you know anything.

I guess that's a better starting point... Thanks.

Though I do still wish there was some sort of way to break down and reverse-engineer some of the custom code out there since I just learn better that way, in general. But I guess that's not really an option, here...


EDIT: Yep, I'm lost again. "STATENAME is a unique number that is usually DEFINEd to be the name of the state."

This post has been edited by Ninety-Six: 19 April 2018 - 10:34 PM

0

User is online   Danukem 

  • Duke Plus Developer

#6

Well I thought that document might be useful but keep in mind it was written based on the Duke 3D beta before the game even came out :P

http://wiki.eduke32.com/wiki/State

Anyway, if you have a specific question, it's pretty easy to get help around here. If you are realizing that this is too technical and you want to forget about it, then that's fine too.

Incidentally, here is the thread where I started modding 12 years ago:

https://forums.3drea...ead.php?t=16801

I posted about every little thing I did and every single problem I had. I posted constantly in many different threads (some of them concurrent with that one) asking about how to do everything. I'm not recommending that anyone do that. But one thing that you could say for sure about me is that I was trying very, very hard to learn and I didn't give up. In general, I will help people who are trying to help themselves. If someone seems like they are trying to learn and fighting the good fight, I will take some time to give them advice and information.
1

User is online   Ninety-Six 

#7

In my case, it's currently more of a means to an end. I plan to delve further into modding at a later time; for right now I just want to learn how to fix the above problems. I'm one of those people that will move mountains if I think something is worth doing. That's generally why I've learned what I have from the Doom end of things. Things I wanted really badly (such as re-ordering Thy Flesh Consumed to something a bit less insane to back-porting the Doom 2-style PSX Levels into Doom 1 by hand) but couldn't find elsewhere, so I broke down other WADs to find the information I needed to complete my work. There is probably always room for more grace, but since typically the mods are for my benefit and no one else's (sans the TFC reordering), I don't mind as much, and it's a good learning experience. It establishes a baseline I can work from later on when I encounter either a new problem I want dealt with, or I feel I'm ready to move past mapmaking and dive into more intense modding.

Learning by seeing and learning by doing when I port something over incorrectly.


It's similar here. These problems (especially the lizard troops which have ended so many runs before they began when literally every other liztroop in hollywood holocaust does the choke and I don't have nearly enough explosives) I feel are worth moving mountains for. That being said, it seems to be far more difficult to achieve what seem to be fairly simple fixes (and probably are if I get past this insanely high wall that is "basically actually programming" and the majority of my experience is a high school coding class on BASIC), especially since I really can't learn through example in this case. Even the tutorials on the wiki that actually do contain solutions to some of these issues like the night vision goggles, I'm not even entirely sure where they're supposed to be inserted into.

That's kind of the level I'm approaching this from.


Even if one of you guys gave up and just kicked the answers over to me, I'd still probably ask for the lines to be broken down so I can make sense of it. Because I would still honestly want to understand it, and in some ways that's even preferable since looking at all these individual pieces don't mean a whole lot to me. Seeing how they all interconnect with each other and how they're used in relation to each other; getting a picture of how the system as a whole works first and how it depends on the individual factors, before going into the details of each individual part... Unfortunately I'm more of a top-down sort of learner. The kind of person that takes apart toasters and controllers and other little devices and seeing how all the guts overlap first, inferencing the cycle of electricity and where it comes from and where it goes, and then pulling up the internet to identify the mystery doohickeys and add more to the "map."

It sounds counter-intuitive I'm sure, if anyone can even make sense of this rambling to begin with. I've always struggled with trying to explain things; there's probably a far simpler way to put this that I'm just not seeing.

This post has been edited by Ninety-Six: 19 April 2018 - 11:39 PM

0

User is online   Danukem 

  • Duke Plus Developer

#8

So you want to the trooper stay dead if shot during its begging animation. The easiest way to do this is to change one line of code. First, find "state checktroophit". The first instance of that string in GAME.CON will be the code which defines that state. The first part of that code will look like this:

state checktroophit
  ifaction ATROOPSUFFERING
  {
    stopsound LIZARD_BEG
    sound PRED_DYING
    cstat 0
    strength 0
    action ATROOPSUFFERDEAD
    break
  }


All you have to do is change "ATROOPSUFFERDEAD" to "ATROOPDEAD".
0

User is online   Ninety-Six 

#9

View PostTrooper Dan, on 20 April 2018 - 02:24 AM, said:

So you want to the trooper stay dead if shot during its begging animation. The easiest way to do this is to change one line of code. First, find "state checktroophit". The first instance of that string in GAME.CON will be the code which defines that state. The first part of that code will look like this:

state checktroophit
  ifaction ATROOPSUFFERING
  {
    stopsound LIZARD_BEG
    sound PRED_DYING
    cstat 0
    strength 0
    action ATROOPSUFFERDEAD
    break
  }


All you have to do is change "ATROOPSUFFERDEAD" to "ATROOPDEAD".



I actually remember finding this during my previous attempt. Funnily enough I almost tried exactly what you suggested. Almost. But I wasn't sure what "ATROOPSUFFERDEAD" truly was, and I was afraid I was going to nix the entire suffering state entirely (since I do like the idea of them potentially coming back if you fail to kill them in time, such as if you pipebomb them from beneath a window or get caught up fighting something much more urgent.)

As forewarned, I'm going to ask what this means. But I'm going to try and break this down myself first. Correct me where I screw up:

"state checktroophit" Seems simple enough. It's a check run when it's...wait. If it's checking if it's hit, but this triggers on a potential death, then how...? (At least I think that's how that's always worked?)

stopsound LIZARD_BEG
sound PRED_DYING

Stop the choking sound, play the death sound. Though I noticed this doesn't trigger sometimes. I've always wondered if that was perhaps a clue if they were going to get up, but looking at this code I suppose not?

I don't know what cstat is, so this I will cross-check... And I return with a question. What if it's a number not listed, and why are the numbers in exponents?

Strength...I would assume that would be health, and I would assume 0 means invincible, but then how can they be gibbed?

action ATROOPSUFFERDEAD. I actually tried to find the code in the GAME.CON for this one on the last go, but the sheer length of it combined with the 40 million if statements kinda made my brain melt. I was trying to figure out at what point the decision to resurrect or not was made, but I had such a difficult time deciphering the statements I couldn't be sure if it actually was, or if it called on a later function. Even now I can't seem to locate the point at which it's determined, because I was led to believe it was determined by RNG, and I don't see where the random function is... (It's probably there and I just didn't/don't know what it's called. Even if the function isn't in the con itself surely it must be called somewhere, right?).

So does this mean ATROOPSUFFERDEAD is a completely different state from ATROOPDEAD? Does that mean the RNG is called on twice somewhere that I can't find? Also is this for the green or red trooper? Or are they the same? Why does the code change allow it to be shot and dead for real, but to run its course if left alone? Or is that not what this does?

Does this code imply the irrelevant killshot was an oversight or an intentional design decision?

Spoiler



EDIT: I just found something.
state troopsufferingstate
  ifactioncount 2
  {
    ifrnd 16
      spawn WATERDRIP
    ifactioncount 14
    {
      stopsound LIZARD_BEG
      cstat 0
      strength 0
      action ATROOPSUFFERDEAD
      break
    }
  }
ends


What is this and why is it both similar and different?

This post has been edited by Ninety-Six: 20 April 2018 - 03:01 AM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#10

View PostNinety-Six, on 20 April 2018 - 02:52 AM, said:

Though I noticed this doesn't trigger sometimes. I've always wondered if that was perhaps a clue if they were going to get up, but looking at this code I suppose not?

It does.
0

User is online   Ninety-Six 

#11

View PostFox, on 20 April 2018 - 03:21 AM, said:

It does.

So that was a clue? Where is that in the code? I don't see it, unless it's somewhere else...

This post has been edited by Ninety-Six: 20 April 2018 - 03:29 AM

0

User is online   Danukem 

  • Duke Plus Developer

#12

Commands such as cstat, strength, action, etc. you can just look up in the wiki and it will tell you what they do:

http://wiki.eduke32....ll_command_list

No guesswork needed!

If you understand what the commands do, the main additional thing you need to understand in this case is that "state checktroophit" is a subroutine that only executes when the liztroop has been hit by a weapon. Search the code and you will find that after the state is defined, "ifhitweapon" is always the trigger for "state checktroophit".
0

User is online   Ninety-Six 

#13

View PostTrooper Dan, on 20 April 2018 - 03:43 AM, said:

Commands such as cstat, strength, action, etc. you can just look up in the wiki and it will tell you what they do:

http://wiki.eduke32....ll_command_list

No guesswork needed!



Well I mean I did do that for a few of them, but they don't exactly answer my questions. Like strength doesn't explain what zero is or why they're gibbable.

View PostTrooper Dan, on 20 April 2018 - 03:43 AM, said:

If you understand what the commands do, the main additional thing you need to understand in this case is that "state checktroophit" is a subroutine that only executes when the liztroop has been hit by a weapon. Search the code and you will find that after the state is defined, "ifhitweapon" is always the trigger for "state checktroophit".


I don't follow.
0

User is online   Danukem 

  • Duke Plus Developer

#14

View PostNinety-Six, on 20 April 2018 - 03:47 AM, said:

I don't follow.


Realistically, you have to be familiar with basic programming concepts like what a subroutine is, or else you aren't going to be able to make much progress on Duke 3D scripting. I don't know how I could make my post easier to read.
0

User is offline   Perro Seco 

#15

View PostTrooper Dan, on 19 April 2018 - 09:55 PM, said:

This document still serves as a good starting point: http://wiki.eduke32.com/wiki/Confaq42
I learnt some basic things with a translated version of that document back in 2008/2009. Good memories. :P

I also learnt a lot by changing hard to understand values here and there to see what happens, but I don't know if it's the best way to learn...

By the way:

View PostNinety-Six, on 19 April 2018 - 11:35 PM, said:

Even the tutorials on the wiki that actually do contain solutions to some of these issues like the night vision goggles, I'm not even entirely sure where they're supposed to be inserted into.
I used that code in my still in progress TC. Find the line "actor APLAYER MAXPLAYERHEALTH PSTAND 0 0" in the file game.con, add "gamevar TEMP 0 1" above it, and the other lines (except the "actor APLAYER..." one) under it.

This post has been edited by Perro Seco: 20 April 2018 - 03:19 PM

0

User is online   Ninety-Six 

#16

View PostTrooper Dan, on 20 April 2018 - 02:04 PM, said:

Realistically, you have to be familiar with basic programming concepts like what a subroutine is, or else you aren't going to be able to make much progress on Duke 3D scripting. I don't know how I could make my post easier to read.


What I don't understand is how it's triggered on hit instead of kill.
0

User is online   Danukem 

  • Duke Plus Developer

#17

I think you mean why, not how. It's the state that handles what happens when the liztroop is hit. What happens when the liztroop is hit while begging is one of those things it handles.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#18

View PostNinety-Six, on 20 April 2018 - 03:28 AM, said:

So that was a clue? Where is that in the code? I don't see it, unless it's somewhere else...

Here:
    ifaction ATROOPSUFFERDEAD
  {
    ifactioncount 2
    {
      ifrnd 64
      {
        resetcount
        action ATROOPPLAYDEAD
      }
      else
      {
        soundonce PRED_DYING
        action ATROOPDEAD
      }
    }
  }

0

User is online   Ninety-Six 

#19

View PostTrooper Dan, on 20 April 2018 - 09:31 PM, said:

I think you mean why, not how. It's the state that handles what happens when the liztroop is hit. What happens when the liztroop is hit while begging is one of those things it handles.


So it calls on this both for normal hits and begging hits?


@Fox: Huh. So if they make the sound, they aren't faking it. I never knew that...

How is the outcome determined? I don't see where it calls on RNG here, unless that's done elsewhere.
0

User is offline   Kyanos 

#20

View PostTrooper Dan, on 19 April 2018 - 11:02 PM, said:

Incidentally, here is the thread where I started modding 12 years ago:
https://forums.3drea...ead.php?t=16801


Good read, I can't get over the fact that you showed up on the Duke modding scene and made Weapons of mass destruction in your first 3 months, awesome. Did you have much coding experience beforehand?

This post has been edited by Drek: 01 June 2018 - 03:13 PM

0

User is online   Danukem 

  • Duke Plus Developer

#21

View PostDrek, on 01 June 2018 - 03:12 PM, said:

Good read, I can't get over the fact that you showed up on the Duke modding scene and made Weapons of mass destruction in your first 3 months, awesome. Did you have much coding experience beforehand?


I took a few programming classes as an undergraduate in the early 90's, but I never did anything useful with that knowledge. By 2006 I was at the tail-end of my grad school/teaching career and also had training in formal logic as part of the philosophy department that I was in. I still cling stubbornly to Duke modding as a hobby and have not attempted to expand my coding knowledge much beyond CON scripting.
1

User is offline   Jimmy 

  • Let's go Brandon!

#22

Reaper_Man's Center of CON Code is an excellent primer to learn by example.
1

User is online   Danukem 

  • Duke Plus Developer

#23

View PostJimmy, on 07 June 2018 - 10:36 PM, said:

Reaper_Man's Center of CON Code is an excellent primer to learn by example.


Holy shit, I remember reading through those examples in 2006 and finding them to be very useful (and of course they were already quite old at that time). In fact, they are the best of the old guides imo. Pity we have to use the wayback machine to read them now.
1

User is offline   Jimmy 

  • Let's go Brandon!

#24

Reaper was the best at explaining why it works, rather than just telling you what works.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options