## WWHC-Diaz + (NEW!) The VR Missions (help wanted!)

Projects that alter game functions but do not include new maps belong here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Okay, finally got it fixed. Thanks!
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey
DoomRater wrote:Making it an int and multiplying it by 65536 so that it is correctly offsetted like the fixed point is.

'fixed point' is not really fixed point per se, it is actually an int that is divided by 65536 and then displayed with a decimal point. The script entry I posted above I tested this time so it should work- input 100 for normal speed and 35 for the shouldered speed.
Almost. ACS only supports integers. "Fixed point" is thus represented by using the high 16 bits of the integer as the integer part of the number and the low 16 bits as the decimal part of the number. Hence, 1.0 is 65536. That's why multiplying by 65536 works. It would be the same thing to multiply by 1.0. It would also be the same thing to bit shift it left by 16. In this sense, because you are limiting the digits on each side of the radix point, fixed point really is fixed point.

Code: Select all

``1.0 == 65536 == 1 << 16``
EDIT: minor typo.
DoomRater
Posts: 8265
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
...isn't that what I just said? The only difference is when they're displayed- fixed point would display the result as 1.0 whereas int will display as 65536.

Unless you are saying how fixed point is being handled here really IS how fixed point is handled correctly, in which I can't contest that.
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey
It is basically fixed point. There is no real focus on specific number of digits on either side of the radix point like there might be in other languages, but I've never used a language that has fixed point as a primitive type so I don't actually know how common that is/was. Anyway, the fact still remains that you are just representing a decimal number as int16.int16 and so you have no floating point.

I apologize for any confusion. The way your last post read (or more specifically, Gez's post) made it sound like there was some kind of significant difference with integer and fixed point in ACS. Of course, there isn't any difference to ACS, and I believe when working with fixed point in ACS it is actually very important to understand that fact.
DoomRater
Posts: 8265
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
Anyway, I looked around for some way to accomplish the same thing without ACS, but there is no such animal. Not until SetActorProperty becomes available to DECORATE anyway, which a ways off.
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
@WW: One thing you can do is, instead of sending the information directly, create an array or (if the array doesn't work either) a set of if/else statements, that check the value of a variable and set the correct number accordingly, e.g., if 0 then SetActorProperty(...1.0...), if 1 then SAP (...0.35...), if 2 then SAP (...0.62...), etc.
DoomRater
Posts: 8265
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
Actually, that wouldn't be a bad solution. I just happen to like being able to plug in the value faster as it means I wouldn't have to recompile should I want to change a number.
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Frankly, I suggested that method because all this "fixed point" crap confuses and scares the shit out of me. I've been staring at the wiki entry for about five minutes now and I still can't wrap my head around just why anything would be done like this except some extremely vague, assumed notion of "computer go faster with fix point lol"...
DoomRater
Posts: 8265
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
It was done that way because there was no other way to add fractional numbers to ACS otherwise. ACS only understands the int type.
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
...would 65536 happen to be represented in base-16 as 1000? Because if it does, I think I get it now.

EDITsage because I don't want to spam this thread with my own ignorance: Right, 10000 with four zeroes, thanks.
Last edited by Matt on Fri Sep 28, 2007 10:28 pm, edited 3 times in total.
DoomRater
Posts: 8265
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
10000, but yeah.
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey
Another way to think of it is on the binary level. 65536 is 2^16, so as a 32 bit binary number:

Code: Select all

``65536 = 00000000000000010000000000000000``
Now, let's keep the data exactly the same, but change the way we look at it. Let's consider the high 16 bits separately from the low 16 bits.

Code: Select all

``````   high bits           low bits
0000000000000001   0000000000000000``````
Now in one sense what we have a two 16 bit integers. The first one has the value 1, and the second one has the value 0. So, if we stick a decimal inbetween them when we display the value... it would be 1.0. The binary representation hasn't changed at all. It is still 65536, if you look at it in that way. With the fixed point number representation, we're just looking at the 16 high bits as the integer part of the number (to the left of the decimal) and the 16 low bits as the fractional part of the number (to the right of the decimal.)

The reason one may choose to use fixed point is because it is MUCH faster than floating point, at the cost of precision. Fixed point works with regular integer math, which is quite fast. Also, because it works with regular integer math, you don't need to have a floating point unit on your CPU to use it. If you recall, Doom was coded in 1993. Getting as much out of the computers of the day as possible was paramount, and so fixed point was probably one of the choices they made to help retain engine speed and possibility compatibility, but I'm not one to be aware of exactly how frequent floating point units were at the time so that particular point may be moot.
Gez

Posts: 17849
Joined: Fri Jul 06, 2007 3:22 pm
1993 was the time of "mathematic coprocessors" which allowed to perform floating point fast.
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Yeah, this is all really scary...

But enough of fixed/floating point stuff because the problem's been fixed. I'm going to make my next task importing the recoil system from Hideous Destructor.
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Know what might be a neat addition? An altfire that shoots a gun gangsta-style so the recoil pushes you sideways...

Also, I should note that the highest pitch (lowest number) that works properly for ZDoom is -5825, not whatever the number is on the version of HD I currently have uploaded.