The Simple Questions Thread

If it's not ZDoom, it goes here.
Post Reply
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: The Simple Questions Thread

Post by Accensus »

Okay, I need some programmer advice here. Graf, I need your help, mate.

When using arrays, is starting from non-zero index (say, 1) considered a heavy offence? Does it even matter if you'll start from 0 or 1, considering you've written your code to work with whatever you've picked?

Talking about C++ here, btw, just in case it matters.

EDIT: Alright, in the mean time I searched around for some read on the topic and found this article.

I asked the question because I was arguing with a colleague and his programmer friend about what the "correct" method is, but neither of them managed to put some proper arguments on the table. Well, apparently, starting from the zeroth element in a zero-based array is the right thing to do. Now I at least know WHY it's like that, which was the whole point of the argument. Remember, folks. If you can't explain why, then you probably shouldn't be talking in the first place.

And by correct method I meant for(int i=1; i<=10; i++) vs. for(int i=0; i<10; i++).
User avatar
darkhaven3
Posts: 502
Joined: Mon Jan 05, 2004 5:33 am
Location: East Germany, 2023
Contact:

Re: The Simple Questions Thread

Post by darkhaven3 »

Lud wrote:When using arrays, is starting from non-zero index (say, 1) considered a heavy offence? Does it even matter if you'll start from 0 or 1, considering you've written your code to work with whatever you've picked?
Your colleagues have not been able to put forward any good arguments one way or another because there is no correct method. You are free to begin from whatever element number in the array you please, as long as you account for that correctly in areas of code where that's important.

Starting from the "zeroth" element is no more "correct" than starting from the first or the tenth or the nineteenth.
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: The Simple Questions Thread

Post by Accensus »

Simple question. With CountInv now a DECORATE expression, is there any difference between A_JumpIfNoAmmo and A_JumpIf with CountInv? Which one is easier on the engine and is less likely to be looked down upon by Graf? (And Graf looking down upon something means it's not the right way, which is what I'm asking here.)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: The Simple Questions Thread

Post by Graf Zahl »

A_JumpIfNoAmmo is not synonymous with A_JumpIf(CountInv(blah)), because it calls the weapon's CheckAmmo function which does a few more checks (like infinite ammo DMFlag and a few other things that are necessary to handle a weapon. )
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: The Simple Questions Thread

Post by Accensus »

Makes sense. WIll remember. Thanks, Graf!
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: The Simple Questions Thread

Post by Nevander »

I've been wondering why older shooters like Doom originally didn't have jumping or crouching. Just watching Romero's play-through of his E1M8b it came to mind how easy it would be in reality to simply climb up short ledges and just reach the switch you would normally have to go around the entire map to reach, so why didn't id Software originally code the ability to jump and crouch? Did they not think of that or was it too complicated on the original engine to allow such a mechanism? It didn't take long to add it though since RoTT was able to make the player gain vertical height with jump pads, then Duke 3D of course actually adds jump for real. Would the original Doom engine have been capable of doing jump actions?
User avatar
Rachael
Posts: 13965
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: The Simple Questions Thread

Post by Rachael »

Nevander wrote:so why didn't id Software originally code the ability to jump and crouch? Did they not think of that or was it too complicated on the original engine to allow such a mechanism? It didn't take long to add it though since RoTT was able to make the player gain vertical height with jump pads, then Duke 3D of course actually adds jump for real. Would the original Doom engine have been capable of doing jump actions?
It's not because it was too complicated. It's because it had never been done before. It simply hadn't been thought of. Doom came from a time when rogue-likes were common, and games like Dungeons and Dragons took the spotlight. There had never been jumping or crouching in such games.

In a lot of ways, Doom is more like a role playing game than it is like a first-person shooter, the very genre that it helped define. The idea just had not sparked yet.

Another example of what came from those times is the keyboard turn - something that ZDoom still does by default. Most shooters nowadays have that completely removed - but that is how you controlled your marine - or in the case of Wolf3D, BJ. In 3D adventure RPG games, keyboard turning was a way to move around in the environment. Granted Doom's was a lot smoother, whereas the other games tended to be more crude and clunky - but the concept remained exactly the same.
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: The Simple Questions Thread

Post by Nevander »

Eruanna wrote:Another example of what came from those times is the keyboard turn
Oh how I hate the keyboard turn. I could understand back in the days of keyboard only controls, but now it's like :blergh:. Thank goodness that "moving" left and right became a thing, probably when mouses became more common for controls.
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: The Simple Questions Thread

Post by Accensus »

Is it possible to have more arguments for actors?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: The Simple Questions Thread

Post by Graf Zahl »

Be more specific. What do you want to do?
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: The Simple Questions Thread

Post by Accensus »

I don't have any ideas in particular. I meant if it's possible to add more than 0-4 args for the Args[] actor property (engine-side), which can then be applied in GZDB. In case I want to make a customizable actor with lots of arguments that could be changed to affect said actor in different ways.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: The Simple Questions Thread

Post by Graf Zahl »

No. If you want more values you have to add new variables to your subclasses.
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: The Simple Questions Thread

Post by Accensus »

I see. Can I control them through GZDB, though? UDMF custom properties, perhaps? Never got what that was for... the documentation isn't too helpful, either.
User avatar
Reactor
Posts: 2091
Joined: Thu Feb 03, 2011 6:39 pm
Location: Island's Beauty, Hungary

Re: The Simple Questions Thread

Post by Reactor »

This is yet another funny question, but since this is Off-Topic, I guess it's good to go :)

I've read about this new fashion-fad, the "murse" (man purse). Many girls/women said it is uncool and laughable if a man carries a murse around, and that "a true MANLY man never buys a murse, let alone get out in public with one". Is it true? What are your experiences with murses?
Oh, and I don't have one either, I have a perfectly good army bag.
User avatar
Caligari87
Admin
Posts: 6241
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Re: The Simple Questions Thread

Post by Caligari87 »

I used to carry a "murse" and don't think there's anything wrong/weird/uncool with it (I simply have no need to do so anymore aside from occasionally taking my laptop bag somewhere). I also have no compunctions carrying my wife's purse, which people seem to think is even weirder for some reason. :?

My reason was generally the same as a purse: MP3 player, headphones, a knife, sketchbook/notebook, pens/pencils, first-aid kit, reading material, random cables/chargers, lunch/snack, etc. Sort of a "surban survival kit" if you will. Eventually I simplified and mentally phased out my "need" for those things, so now it's just what can fit in my pockets + a small lunchbox on workdays.

I loved my murse though. Maybe someday I'll start carrying it again.

8-)
Post Reply

Return to “Off-Topic”