Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
rd.

*** The "ask a miscellaneous editing question" thread ***

Recommended Posts

Linguica said:

You don't want to just pick random numbers. What you want to do is define an array with all the possible numbers, and then shuffle that array so you can iterate over it in order. Implementation of this is left as an exercise for the reader.

Damn, I really wanted to avoid doing that. Oh well...

Out of curiosity, why doesn't the current code work?

Share this post


Link to post
Buu342 said:

Out of curiosity, why doesn't the current code work?

You're asking ZDoom to pull a PRNG 32bit integer and modify it to a value between 0 and 26. Not only can the initial PRNG itself produce duplicates over time, you are more than likely to see them when they are wrapped to such small values.

Share this post


Link to post
Edward850 said:

You're asking ZDoom to pull a PRNG 32bit integer and modify it to a value between 0 and 26. Not only can the initial PRNG itself produce duplicates over time, you are more than likely to see them when they are wrapped to such small values.

Well yeah, that's the idea behind the code. Due to the loop, it was supposed to loop through the code indefinitly UNTIL it found a number which wasn't reproduced. Or am I missing something essential here?

Share this post


Link to post
Buu342 said:

I have a script which is made to run a maximum of 25 times, and it's supposed to pick a number from 0 to 26 (27 different numbers to choose from) without repeating any of them. It works in the beginning, but by its 20+ run, it starts repeating again. Any ideas?

int PastRound[342];
global int 4: RoundNum;

Script 2 (void)
{
   int round;
   RoundNum = RoundNum+1
   int it = 0;
   for ( it = 0; it < RoundNum; it++ ) 
   {
      until (round != PastRound[it])
      {
         round = random(0,26)+100;
      }
   }	
   PastRound[RoundNum] = round;
   return round;
}


There are several logical errors here.

Most importantly, you compare the value with stored results, but you can only compare with one of them at a time. Suppose you've rolled a 3 on the first roll. Now for the second roll you can compare to 103 and make sure you don't roll it again. Let's say you get 105. Now for the third roll you run a 103 again. Here's how it could work:

   //let's unroll this loop: for ( i = 0; i < RoundNum; i++ ) 
   {
      // first loop: it = 0; PastRound[0] = 103
      until (round != PastRound[0])
      {
         round = random(0,26)+100;
      }
      // second loop: it = 1; PastRound[1] = 105
      until (round != PastRound[1])
      {
         round = random(0,26)+100;
      }
      // third loop: it = 2; PastRound[2] = 0
      until (round != PastRound[2])
      {
         round = random(0,26)+100; // here we roll 103
      }
      // 103 is different from 0, so condition is fulfilled
   }	
In essence, only the "until" check done in the very last iteration of the loop is relevant.

So how can this be made to work? Simple. Something like this should be approximately somewhere near the right ballpark.
int AlreadyRolled[27];
int index = 0;

Script 2 (void)
{
   int roll = random(0,26);
   int steps = index + roll;
   while (steps > 0)
   {
      steps--;
      while (AlreadyRolled[index] == 1)
      {
         index++;
         if (index > 26) index = 0;
      }
   }
   AlreadyRolled[index] = 1;
   return index;
}
The idea is that you have a small array of values that have been already rolled (certainly smaller than your PastRound[342]) and basically when you need a number, you iterate through this table by a number of steps equal to the number you rolled, but skipping any value that has already been rolled. That skip is important. Then you look at which index you ended up at, mark it as rolled (since that's what you've effectively rolled) and return it.

Share this post


Link to post
Gez said:

-Very Insightful essay-

I got it! Makes a lot of sense now! Thank you for your insightful post. Linguica's array shuffling idea worked and that's the one I implemented already (I was still asking about my code so I could understand where I went wrong), but yours seems to work too, though sorry for making you write all of that.

Another question if you guys can.

I want a player's translation (the color they chose for their character in the options) to be kept after they are morphed (For some reason, morphing the player does not keep their translation, even with the Player.ColorRange set in the Morph class. The way I was going around it was creating an object and giving the players' translation to it, and then having the object execute acs code to give the player that translation after being morphed. This works, for the first and second player but fails for all the others. Any ideas?

Code

Spoiler

Morph code:

SpawnSpotForced("KartTranslator",1337+PlayerNumber(),3337+PlayerNumber(),0);
Thing_SetTranslation(3337+PlayerNumber(),-1);
delay(1);
MorphActor(0,"KartPlayer",1,698-(35*SpeedupNum),MRF_NEWTIDBEHAVIOUR,"","");

KartTranslator Decorate
ACTOR KartTranslator
{
	States
	{
		Spawn:
			PLAY N 10 ACS_Execute(251,0)
			Stop
	}
}

Script 251
Script 251 (void) // Server - Kart Translation
{
	delay(1);
	Thing_SetTranslation(ActivatorTID()-2000,-1);
}

Zandronum uses old Zdoom code, so I can't use MRF_TRANSFERTRANSLATION

Edit: Got it working. I just looped the Decorate code and it works now. Seems it takes a few ticks for it to translate everyone's color. I then put in my ACS Script a delay to remove the translation objects so that we don't get a buildup in the game.

Share this post


Link to post

i'm having a problem with GZ Doom Builder, i think i disabled 3D Slopes, or at least i disabled seeing them.

Share this post


Link to post

Look into "Keyboard Shortcuts Reference" for "Toggle Enhanced Rendering Effects". Default value should be Tab.

Share this post


Link to post

1. Is there a way to increase the 32 level limit for a wad? If so how does it work?

2. Can I break a wad into 10 episodes with 10 levels each? Is that a better solution?

3. Lets say I have 40 levels that are stand alone using MAP01. How can I put them into 1 wad? Right now I just cut and past them into a new map (but my textures get misaligned and shit goes south. Is there a utility or easy way to arrange these?

Thanks.

Share this post


Link to post

1 and 2 of the above are possible with ZDoom's MAPINFO if you're mapping specifically for ZDoom. As for 3, I'm not aware of any utility that could batch-add-and-rename all 40 maps at once, but if you're willing to add the maps one by one, it can be done in both (GZ)DB and SLADE3.

Share this post


Link to post
scifista42 said:

1 and 2 of the above are possible with ZDoom's MAPINFO if you're mapping specifically for ZDoom. As for 3, I'm not aware of any utility that could batch-add-and-rename all 40 maps at once, but if you're willing to add the maps one by one, it can be done in both (GZ)DB and SLADE3.



Yes I map for GZDoom. SO I can change ALL of this just under MAPINFO? Changing the level number to 33 will work? At work atm so I can't test it.

MAP MAP33 "test"
{
levelnum = "33"
next = "34"
}

Then I must warp to map 33 in Doom 2 to play it? Do I simply change the name of the map entry to 33 (the Map Marker in Slade)

Share this post


Link to post

Yes, if you write a MAPINFO entry for an arbitrary map name AND rename your map's marker lump to that name, it will work.

Share this post


Link to post

Could anyone please help me to answer how hard this would be to do:

-A visible timer in the HUD on the original Doom II maps.

-Time gets added to the timer for each enemy killed or secret found up to a max amount.

-When the timer reaches zero, the player will start losing armor and then health until the player is dead or more time is added to the timer.

I am playing around with an idea of a Doom II Arcade Machine and I am probably not the first one to attempt this but I haven't been able to find anyone who has succeeded and I would therefore like to know if there's even a chance for me to succeed or if I am only wasting my time.

Thanks!

Share this post


Link to post

That depends on what port you want to use. It's definitely possible (and not too hard) with ACS in ZDoom.

Share this post


Link to post
Kappes Buur said:

You could try Mtrop's DoomMerge.
https://www.doomworld.com/vb/post/1149456


I just decided to do it manuelly. There isn't a whole lot of work if I can do it all in Slade 3. But... I am at a crossroads on how I want to set up my maps.

Do I want episodes or a hub like system? Does anyone have a preference?

How about how Quake 1 is set up? I am pretty sure you can do some of it through ACS. Is it possible to do a map system much like that? It is important for the player to keep their inventory between episodes...in this case, permanent health boost and perhaps a "Quake Like" artifact to open a final level?

Example Wads would be great.

Share this post


Link to post
Zemini said:

Do I want episodes or a hub like system? Does anyone have a preference?

I've seen people on this forum claiming various preferences that aren't compatible with each other, so just do whatever you want. Episodes are generally a safer choice, hubs often have problems like navigation being confusing or backtracking being boring, but that's not to say a hub couldn't be implemented well if it avoided those pitfalls, IMO (then again, everybody may have a different idea of what "implemented well" means, for example being lost in a map can be enjoyable for some players / to some degree).

Zemini said:

It is important for the player to keep their inventory between episodes...

Then just don't define an endgame sequence after an episode's last map, but make it go to the next episode's first map instead.

Zemini said:

permanent health boost

http://zdoom.org/wiki/Creating_health_items_that_increase_the_player's_maximum_health

Zemini said:

and perhaps a "Quake Like" artifact to open a final level?

With some ACS-based logic, no problem.

Share this post


Link to post
scifista42 said:

With some ACS-based logic, no problem.


To elaborate on this, you could use a global variable (that is, a variable that keeps it's value even when the player moves from one map to another) to store the 'artifact collected' state. You could also do it as an inventory item. The script would first check if they have the item, then remove it from the player before continuing.

Share this post


Link to post

I think I have decided to just break down my wad into episodes. Just makes more sense and gives players a nice breaking point between them.

Now I need to reevaluate my weapons. I have one that needs a new bulletpuff - and bigger Blood splat. Is that something that can easily be done through inheriting it and just making it larger for my heavy machine gun? Bigger bullets = bigger puffs right?

Share this post


Link to post

Anyone know that the absolutely maximum image size GZDoom can support for a texture?

I popped in a 4K (3840 × 2160) image and it errored out, but I'm not sure if that was down to the size of the image or a problem with the file itself.

Share this post


Link to post
rehelekretep said:

has anyone or is anyone willing to remove the custom enemies from Hell To Pay (and replace them with the original doom2 enemies)?

If they are just custom monster sprites (and not, like, monsters that have been edited with Dehacked or whatever), then it should be pretty straightforward to open the WAD in SLADE and delete the custom monster sprites.

Share this post


Link to post
Bauul said:

Anyone know that the absolutely maximum image size GZDoom can support for a texture?

In OpenGL, it depends on your hardware. There's a GL_MAX_TEXTURE_SIZE value that's the largest dimension for a texture. For example if you get 2048 for GL_MAX_TEXTURE_SIZE, then the largest textures your hardware supports are 2048x2048.

However, it shouldn't cause errors when you exceed that. Instead, the texture should simply be resized automatically -- which can make it very blurry but yeah. That's a problem I saw with the news tickers on SpaceDM9, they're very long (but not very tall) textures and on the OpenGL hardware I had back then, they were squeezed horizontally to fit, and this made them completely illegible. (My beefier though already aging hardware of now doesn't have this problem, though.)

How can you tell what's your max texture size? Well a possibility is simply to run SLADE 3 and look at something that makes it use OpenGL (like for rendering any image, or a map view, whatever) and then look at the stuff displayed in the console. You should get something like this:

Initialising OpenGL...
OpenGL Version: 3.1
Max Texture Size: 8192x8192
Checking extensions...
Vertex Buffer Objects supported
Point Sprites supported
Framebuffer Objects supported
Except with perhaps a different version, different texture size, and the extensions perhaps not supported.

Linguica said:

If they are just custom monster sprites (and not, like, monsters that have been edited with Dehacked or whatever), then it should be pretty straightforward to open the WAD in SLADE and delete the custom monster sprites.

Nothing dehackedy in Perdition's Gate and Hell To Pay. To get vanilla monsters you just need to delete the sprites and sounds (or make a pwad with vanilla sprites and sounds and load it after HTP).

Share this post


Link to post

Thank you Gez! I've found what you mean: I get "Max Texture Size: 8192x8192" so I can only presume that exact texture I tried was in a dodgy format.

I've been playing around with ultra-HD textures (both for high-fidelity and in a kind of megatexture approach) and was just wondering just how high I could push it.

Good info on the memory requirements too, thank you. I'll be sure not to fill my map full of 8K textures, as pretty as that would be!

Share this post


Link to post

I have so many questions,but I`m afraid to ask. Anyway if I write here,I must ask them. What camera should I use if I want make player in walk in 3 person mode? I tried to figure out,but due some issues with english I can`t understand what camera does that .

Share this post


Link to post

Has anyone tried to implement dialogue here, or know of a WAD using the Universal Strife Dialog Format? Or are there reasons why I shouldn't use that format (my wad already requires ZDoom 2.8.1)?

I'm going to add a little intermezzo to my WAD where the story... Let's say "develops." Wanted to let the player pick through some meaningless choices to give some illusion of freedom.

Share this post


Link to post
scifista42 said:

Make a new actor inheriting from the bullet puff actor, set its XScale/YScale properties to values greater than 1, and make the weapon use them via a parameter in A_FireBullets.


Well I got the puff bigger but the Blood splotch doesn't seem to change. Thanks for your help.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×