The "How do I..." Thread

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
FireFish
Posts: 95
Joined: Fri Feb 27, 2015 1:34 pm
Location: your screen
Contact:

Re: The "How do I..." Thread

Post by FireFish »

Is it possible to use standalone Voxel models which do not replace sprites ?
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: The "How do I..." Thread

Post by Accensus »

I doubt it. The voxels are attached to the sprite frame defined in DECORATE.
D2JK
Posts: 545
Joined: Sat Aug 30, 2014 8:21 am

Re: The "How do I..." Thread

Post by D2JK »

I'm trying to figure out how to perform a jump from inside an anonymous function. For example, here's a simplified monster charging code:

Code: Select all

Charge:
 MONS ABCD 4
  {
   ...
   if (GetDistance(false) < 128)
    {
     A_Jump(256, "Melee")
    }
  }
  Loop
Obviously that doesn't work, but should illustrate what I'm basically after. Do I need to use "return state" in some way (Actor states), and if so, how do I use it exactly?
User avatar
Xeotroid
Posts: 448
Joined: Sat Jun 23, 2012 7:44 am
Graphics Processor: nVidia with Vulkan support
Location: Czech Rep.

Re: The "How do I..." Thread

Post by Xeotroid »

Try using it like this, as shown in an example here:

Code: Select all

Charge:
  MONS ABCD 4
  {
    ...
    if (GetDistance(false) < 128)
    {
      return A_Jump(256, "Melee")
    }
  }
  Loop
D2JK
Posts: 545
Joined: Sat Aug 30, 2014 8:21 am

Re: The "How do I..." Thread

Post by D2JK »

This produces an error: "All return expressions must deduce to the same type".
User avatar
Xeotroid
Posts: 448
Joined: Sat Jun 23, 2012 7:44 am
Graphics Processor: nVidia with Vulkan support
Location: Czech Rep.

Re: The "How do I..." Thread

Post by Xeotroid »

Do you have any other Return actions in the function? All return actions in a function must be of the same type - int, float, bool or state. For instance: You can have multiple "return state("Melee");" in a function, but you can't have both "return state("Melee");" (which is a state) and "return false" (which is a bool)
D2JK
Posts: 545
Joined: Sat Aug 30, 2014 8:21 am

Re: The "How do I..." Thread

Post by D2JK »

No, the "return" you suggested adding is the only one in that function.
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: The "How do I..." Thread

Post by Accensus »

Why not just use this:

Code: Select all

MONS ABCD 4
  {
    ...
    A_JumpIf(GetDistance(false) < 128, "Melee");
  }
  Loop
EDIT: Oh, you're learning. That's fine. Carry on then, you can ignore my post.
User avatar
CJacobsSA
Posts: 62
Joined: Mon May 30, 2016 10:01 pm

Re: The "How do I..." Thread

Post by CJacobsSA »

Anyone got any tips for audio optimization? I want to use custom music in my campaign that originates from high quality wav and mp3 files, and I'd rather not have them balloon the crap out of my filesize if I can avoid it. I use Audacity to edit audio but I don't know very much about quality vs filesize.
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: The "How do I..." Thread

Post by Accensus »

MP3 is compressed and generally has lower quality, though that may vary. WAV, on the other hand, is uncompressed and is sure to bloat your filesize, but the quality is top notch. Can't say what's up with OGG since I don't have enough knowledge regarding it.
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: The "How do I..." Thread

Post by Blue Shadow »

D2JK wrote:No, the "return" you suggested adding is the only one in that function.
You need one at the end of the function:

Code: Select all

return state(""); 
When it reaches that, it'll just continue the state sequence.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: The "How do I..." Thread

Post by Gez »

Xeotroid wrote:What's the use for those angle brackets around 0?
Script 0 is supposed to be engine stuff that nobody is supposed to touch. ACC will refuse to compile a script 0... unless there are the brackets.
Xeotroid wrote: Also, why are there string arrays for QuestItem and music names? There is this one switch case that uses it but... why?
Because there are line types that refer to music or quest item by their index.

The big switch case is actually there to switch on line types that are not handled natively by ZDoom. Instead they're translated to a call to script 0 with the line's original type number as a parameter, which is used by the switch case. So for example line types 203 and 204 change the music.
User avatar
arookas
Posts: 265
Joined: Mon Jan 24, 2011 6:04 pm
Contact:

Re: The "How do I..." Thread

Post by arookas »

CJacobsSA wrote:Anyone got any tips for audio optimization? I want to use custom music in my campaign that originates from high quality wav and mp3 files, and I'd rather not have them balloon the crap out of my filesize if I can avoid it. I use Audacity to edit audio but I don't know very much about quality vs filesize.
Various things that factor in:
  • Bit-depth is how many bits are used to represent each PCM sample. The most common now are 16-bit, 24-bit, 32-bit floating-point, etc. 16-bit can help trim the filesize, but if there is too much noise in the original audio (e.g. crash cymbals, white noise, raw synths), you may start hearing the quantization at lower settings.
  • Sample-rate is how many samples are played per second. The range you want to be working with is 22.05kHz to 44.1kHz (CD quality). Using lower sample rates will reduce the filesize by lowering the total sample count. However, like bit-depth, the greater the delta between samples, the more audible the quality-loss will be.
  • Compression can also help reduce file size. You have lossy formats, such as MP3 and OGG vorbis, and lossless formats, like FLAC. For streaming background music, you always want lossy-compressed audio to save bandwidth. For sound effects, lossless compressed audio should be just fine.
From my experience, the compression and sample-rate are the two biggest factors. The sample-rate, bit-depth, and compression format you need depends all on how much is "good enough" in terms of quality for you. Every song is different, so work with the lowest acceptable quality format and gradually increment the quality until the filesize is no longer acceptable.

In general, OGG vorbis offers either on-par or superior compression for the same quality settings to MP3. In Audacity, you can set the quality on export; I would suggest sticking with no less than five. It also is very easy to get OGG vorbis to seamlessly loop and supports loop-points in zdoom (unlike MP3).
User avatar
CJacobsSA
Posts: 62
Joined: Mon May 30, 2016 10:01 pm

Re: The "How do I..." Thread

Post by CJacobsSA »

Lud wrote:MP3 is compressed and generally has lower quality, though that may vary. WAV, on the other hand, is uncompressed and is sure to bloat your filesize, but the quality is top notch. Can't say what's up with OGG since I don't have enough knowledge regarding it.
Arookas wrote: Various things that factor in:
  • Bit-depth is how many bits are used to represent each PCM sample. The most common now are 16-bit, 24-bit, 32-bit floating-point, etc. 16-bit can help trim the filesize, but if there is too much noise in the original audio (e.g. crash cymbals, white noise, raw synths), you may start hearing the quantization at lower settings.
  • Sample-rate is how many samples are played per second. The range you want to be working with is 22.05kHz to 44.1kHz (CD quality). Using lower sample rates will reduce the filesize by lowering the total sample count. However, like bit-depth, the greater the delta between samples, the more audible the quality-loss will be.
  • Compression can also help reduce file size. You have lossy formats, such as MP3 and OGG vorbis, and lossless formats, like FLAC. For streaming background music, you always want lossy-compressed audio to save bandwidth. For sound effects, lossless compressed audio should be just fine.
From my experience, the compression and sample-rate are the two biggest factors. The sample-rate, bit-depth, and compression format you need depends all on how much is "good enough" in terms of quality for you. Every song is different, so work with the lowest acceptable quality format and gradually increment the quality until the filesize is no longer acceptable.

In general, OGG vorbis offers either on-par or superior compression for the same quality settings to MP3. In Audacity, you can set the quality on export; I would suggest sticking with no less than five. It also is very easy to get OGG vorbis to seamlessly loop and supports loop-points in zdoom (unlike MP3).
Sweet, thanks. I appreciate the help.
User avatar
jazzmaster9
Posts: 875
Joined: Wed Apr 18, 2012 11:37 pm
Contact:

Re: The "How do I..." Thread

Post by jazzmaster9 »

How do i add custom BIGFONTs to my mod?
Locked

Return to “Editing (Archive)”