fteqcc

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Sun Aug 20, 2006 8:13 pm

  • Is there any complete documentation for fteqcc?

    Looks to me like the first thing to do with Nexuiz is to replace fteqcc .qc files with regular C/C++ code.

    Or how do I use hashes in .qc files?
    Cinquero
    Advanced member
     
    Posts: 91
    Joined: Wed Jul 19, 2006 11:13 pm

Sun Aug 20, 2006 8:43 pm

  • Cinquero wrote:Is there any complete documentation for fteqcc?

    Looks to me like the first thing to do with Nexuiz is to replace fteqcc .qc files with regular C/C++ code.


    If you volunteer to do that rewrite, why not. Preferred target engine would be something Q3A based ;)

    Seriously, it is more than just changing the compiler - QC is far too different from C for that. One COULD however make a C++ interface that imitates how QC works (note: C++ allows operator overloading so the vector type could be made work the same as in QC) - it wouldn't be object oriented, but it would be easily possible to automatically convert QC code to that.

    Or how do I use hashes in .qc files?


    You can't, but what do you want to use them for?
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Sun Aug 20, 2006 10:05 pm

  • divVerent wrote:
    Cinquero wrote:
    Or how do I use hashes in .qc files?


    You can't, but what do you want to use them for?


    Collecting player stats.
    Cinquero
    Advanced member
     
    Posts: 91
    Joined: Wed Jul 19, 2006 11:13 pm

Sun Aug 20, 2006 10:50 pm

  • Cinquero wrote:
    divVerent wrote:
    Cinquero wrote:
    Or how do I use hashes in .qc files?


    You can't, but what do you want to use them for?


    Collecting player stats.


    And why a hash for that? You can just append them to the player entity.

    If you mean loading and saving an external database with stats, forget it. QC is reinitialized every game, so variables don't persist between games. Only cvars and files do - and FRIK_FILE is only usable for flat files.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Mon Aug 21, 2006 12:00 am

  • divVerent wrote:Only cvars and files do - and FRIK_FILE is only usable for flat files.


    FRIK_FILE? What's that? Could one use that to store the results of the last N games in a specific map?
    Cinquero
    Advanced member
     
    Posts: 91
    Joined: Wed Jul 19, 2006 11:13 pm

Mon Aug 21, 2006 6:31 am

  • Cinquero wrote:
    divVerent wrote:Only cvars and files do - and FRIK_FILE is only usable for flat files.


    FRIK_FILE? What's that? Could one use that to store the results of the last N games in a specific map?


    FRIK_FILE is the extension that adds functions like fopen() to QuakeC.

    Yes, it can be used for that; no, you don't want to use it unless for small files. You don't want to store a list of all players you've ever seen with that... however, you can abuse the file system as a database. There is no "mkdir" commnand, however, when you open a file for writing, missing directory levels are automatically created.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Mon Aug 21, 2006 8:01 am

  • You both really like the "quote" button in an extreme way dont ya :D
    uncomfortable
    random
    mean
    embarrassing
    limited
    User avatar
    Urmel
    Forum addon
     
    Posts: 1744
    Joined: Fri Mar 03, 2006 10:06 am
    Location: Offline

Mon Aug 21, 2006 12:05 pm

  • Urmel... wrote:You both really like the "quote" button in an extreme way dont ya :D


    Yes.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Mon Aug 21, 2006 12:16 pm

  • divVerent wrote:
    Urmel... wrote:You both really like the "quote" button in an extreme way dont ya :D


    Yes.


    I knew :mrgreen:
    uncomfortable
    random
    mean
    embarrassing
    limited
    User avatar
    Urmel
    Forum addon
     
    Posts: 1744
    Joined: Fri Mar 03, 2006 10:06 am
    Location: Offline

Thu Aug 24, 2006 10:34 am

Thu Aug 24, 2006 10:51 am

  • esteel wrote:I guess this deserves to be posted here:
    LordHavoc on Inside3D: Reasons QuakeC is better than C++ for Quake-based games
    http://forums.inside3d.com/viewtopic.php?t=474


    Well, they forgot one thing -- the most important thing: documentation. I have not found fteqcc command/language/function references until now...

    And there are a lot of debugging utilities for standard code... we have none such thing for QuakeC. For me, it is just nonsense. Sorry.
    Cinquero
    Advanced member
     
    Posts: 91
    Joined: Wed Jul 19, 2006 11:13 pm

Thu Aug 24, 2006 1:30 pm

  • If you hate it so much, port our code to C++. And slap Spike for not writing documentation. Once from me please, too.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Thu Aug 24, 2006 6:10 pm

  • divVerent wrote:If you hate it so much, port our code to C++. And slap Spike for not writing documentation. Once from me please, too.


    When I will have the time, I'll do. But that may take until retirement :-). And still, if everyone continues to use QC... ;-)
    Cinquero
    Advanced member
     
    Posts: 91
    Joined: Wed Jul 19, 2006 11:13 pm

Thu Aug 24, 2006 7:21 pm

  • Cinquero wrote:
    divVerent wrote:If you hate it so much, port our code to C++. And slap Spike for not writing documentation. Once from me please, too.


    When I will have the time, I'll do.


    Which of the two?

    Seriously, here some hints about fteqcc features and bugs you won't find on general QC websites (there are some good QC language references on the net)...

    • Do not use the +=, -=, *=, /= operators. They are broken in many cases. Just don't use them.
    • NEVER UNDER ANY CIRCUMSTANCES call the same function twice in the same expression. fteqcc will fuck it up otherwise. Note that this is still better than ID Software's QCC, which fucked up ANY two function calls in one expression.
    • fteqcc feature: arrays. Example:
      Code: Select all
      float array_of_floats[42];
      .float array_of_float_fields[42];
        // NOTE: you can use this as an "array field of float" too, since the compiler allocates space for all 42 fields in each entity.
      // ...
      array_of_floats[23] = 17;
      self.(array_of_float_fields[23]) = 17;
    • However, since arrays are emulated using get/set functions via binary search (QC allows no arrays or pointer arithmetic - there is a VM extension for that which DarkPlaces doesn't implement yet), expect them to be slow, so don't overuse them.
    • Did I mention that they are emulated using functions? In particular this means that you can't use two elements of the same array in one expression, otherwise fteqcc fucks it up.
    • C-style macros do exist, but they have to be one-liners. \ continuation doesn't work.
    • #ifdef exists too.
    • You can declare variables anywhere, however: "float x = 3;" defines x as a CONSTANT according to ID Software's specification. You have to write "float x; x = 3;"
    • However, a fteqcc extension exists to declare preinitialized variables anyway: "var float x = 3;". However, it hasn't been used in Nexuiz yet, so it may be buggy.
    • fteqcc also adds for, continue, break, switch, a weird union/struct construct, goto (yeah), classes (experimental) to QuakeC. See http://wiki.quakesrc.org/index.php/FTEQCC%20Features for examples.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Mon Aug 28, 2006 3:34 pm



Return to Nexuiz - Development




Information
  • Who is online
  • Users browsing this forum: No registered users and 1 guest