Jump to content
The Dark Mod Forums

Newbie DarkRadiant Questions


Recommended Posts

You'll want to check out particle effect tdm_flies.prt .

BTW, _Atti_ placed a nighttime swarm of these outside a window, circling in the outward cast beam. (This effect is part of our WIP that will see the light of day in 2021.) You can't really tell what creatures they are... moths, bats, whatever

Link to post
Share on other sites
  • Replies 9.8k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

So I have this gigantic scorpion, it is made out of pendulums bound together. I had an idea about dragging whole thing through a piled up crates (pretending to be stone blocks in a wall), but it looks

I'm just going to make the lute player an undead immortal skeleton called Ralph who is eternally bound to play his lute in the tavern, the residents are used to him now so they just happily co-exist a

Thanks for the advice about the tent, guys. Finally got around to (mostly) fixing it; shadows were indeed the problem.    

Posted Images

@demagogue @Geep

I was looking at the flies particle effect but I'm thinking about something that could do do moths, bats, fireflies and other things. Some sort of func_mover kind of thing where you can bind a moth/bat/firefly to. Moth/bat could be a looping video on a transparent video screen ...

Link to post
Share on other sites

I also mentioned nurbs. Do a forum search for nurbs to see threads on them, but to start off you can read up on them here: https://forums.thedarkmod.com/index.php?/topic/20163-roadmap-for-tdm-in-2020/page/5/&tab=comments#comment-444657

 

Edit: Somewhere on YouTube there's a video showing a will-o'-wisp flying around using this system, so you can see the system in action and know where to find an example. I even think FenPhoenix was the one that uploaded it. I'd post it if I could, but I can't find it just now. But if you search enough on YouTube or just ask FenPhoenix maybe by PM here or on TTLG, you can find it that way.

  • Like 1

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to post
Share on other sites

Just converting over to info_location sounds, and having some problems, as indicated by dmap warnings of form:

WARNING:location entity 'Info_location_x' overlaps 'info_location_y' in area n

For context, imagine x and y are separate adjacent rooms with a single entrance each. Each entrance has a visportal with a locationseparator, and each room (and their common corridor) has its own info_location. No errors are reported concerning the visportals themselves or their locationseparator embedments.

So presumably, there's some crack between rooms x and y that's treating both room as a common portal area. The crack may be some indirect path through adjoining spaces.

What would be most helpful here is a way to generate a pointfile that would run between entities info_location_x and info_location_y. Absent that, is there some other way to discover where the leak is?

Link to post
Share on other sites
3 hours ago, Geep said:

What would be most helpful here is a way to generate a pointfile that would run between entities info_location_x and info_location_y. Absent that, is there some other way to discover where the leak is?

It's good practice to build maps leaving only the big sealing brushes as worldspawn and everything else func_static, so that you can enable the filter for "All entities" and more easily find gaps in the clean, blocky brushwork.

Apart from that, there's still the old method of intentionally creating a leak to the void -> running pointfile to see which entity is used as the starting point for the red line -> move that entity into either room & turn the rooms' visportals into i.e. wood.

Or export the 2 rooms into a separate map and see what the pointfile does.

  • Like 1
Link to post
Share on other sites

Thanks. Of the three methods, my thoughts are -

(1) seems unfortunately insufficient for a preexisting large building with 2 dozen rooms and a set of worldspawn rooflines that are complexly-angled and clipped.

(2) and (3) are equivalent in power; probably (2) is the lighter lift, so I'll start there.

But first, I'm continuing the further planned subdivision of the space into various info_locations. This may (or may not) narrow down where the problems lie.

Link to post
Share on other sites

At the workshop I was fiddling around with "stacking" sliding doors on 3 axis and a rotator at the bottom, adding some random triggers and all on different speeds, a semi random movement occurs. The nice thing about this is that you can have your object to go around an object in the middle.

https://streamable.com/v5udl9

Now I'm trying to put that into a script and I can get things moving already, but how could the movement be restricted?

I think there are ways to detect when an entity touches an other entity, and when that occurs a change of direction can follow, but isn't that processor heavy?

Other way could be to predefine the area by creating some sort of (alternative) monsterclip (to define no-go areas). But how to put that in a script?

 

Edited by STRUNK
Link to post
Share on other sites

Re: Finding an internal leak, I think the quickest failsafe way is make a copy, change all the visportal textures for the two leafs to a solid brush texture, put the starting point in one leaf, then cut a hole to the void in the 2nd leaf, then when you call the point_file, it's going to run from the start point through the internal leak out to the void.

  • Like 1

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to post
Share on other sites

Thanks for that refinement of Dragofer's suggestion.

Probably the tea leaves I'm basing my analysis on are too muddled so far... Further visportaling and location_separating may clarify the situation. And cutting back on speaker-based sound sources, at least some of those previously used for ambience.

Link to post
Share on other sites

Scripting the whole bat/moth seemed to be very difficult, so I made a simple script where a bat hunts after an object that moves by binding rotators and doors together:

Although it takes some effort to implement in a map, the result is rather nice I think. It could, with some tweaking, also be used for other flying stuff ^^

Edited by STRUNK
Link to post
Share on other sites

My large-building-interior info_location overlap problems have been solved. Here's what I learned -

  • The majority of my problems were due to missing locationseparators. In a large, complex spaces (say, the inside of a duct network), it is easy to overlook an opening or two.
  • One fail was caused by a worldspawn wall which I had stupidly made way too thin (0.125 thick!), which the engine decided was non-sealing.
  • There was only 1 traditional seam leak.

Given that most causes were not leaks, the recommended leak-finding techniques were not fruitful. Instead, what worked was "divide and conquer". More specifically, for each reported overlap:

  1. Subdivide one or both existing info_locations by temporarily installing more locationseparators (usually in new visportals) and named info_locations.
  2. Dmap to check any new visportals, and correct them. (Did a visportal fail because it crossed a seam leak? If not obvious by inspection, try a pointfile).
  3. Map (but don't actually press "attack") the game, in order to get updated overlap information in the console. Which subspace is now reported?
  4. Repeat until you've gotten the culprit area down to manageable size. If there's no obvious missing locationseparator, eyeball the walls closely for seam fails. (Helpful: filter entities; select walls of interest and hide deselected)

When done, any new visportals can be left as non-harmful/maybe-helpful; remove the diagnostic-only info_locations and locationseparators.

  • Like 1
Link to post
Share on other sites

I'm working on a script for a random mover that will stay in an area that is set by boundries. Random-Mover.jpg

 

Ok,  I erased the question for I have answers t most of it already. New script down here:

Spoiler

void Warning()
{
    $Warning.rotate( '0 0 720' );
}

void WarningStop()
{
while (1)
    {
    $Warning.stopRotating();
    sys.waitFrame();
    }
}


void Collision()
{
    while(1)
    {
        if ($Warning.isRotating())
        {
        $light_4.On();
        
        $Target1.rotateOnce('0 0 179');// 0 0 180
        sys.wait(0.1);//0.1
        $light_4.Off();
        }
    sys.waitFrame();
    }
}


void RotateRandom()
{
    while(1)
    {

    float minY = 0;
    float maxY = 0;
    float Y = minY + sys.random(maxY - minY);
    
    float minZ = -60;//-60
    float maxZ = 60;//60
    float Z = minZ + sys.random(maxZ - minZ);
    
    vector R = ('0 0 0');
    R_y = R_y + Y;
    R_z = R_z + Z;
    
    $Target1.time (0.1);//0.1
    
    $Target1.rotateOnce (R);
    sys.wait(0.5);//0.5
    }
}

void Move()
{
while(1)
    {
    $Target1.speed (250); //250 max speed?
    $Target1.move(REL_LEFT , 1);
    sys.wait(0.005);//0.005
    }
}

void main()
{
    thread Collision();
    thread RotateRandom();
    thread Move();
    thread WarningStop();
}

 

 

 

 

 

Edited by STRUNK
  • Like 1
Link to post
Share on other sites

There are different ways to let a script wait, like waitFrame() and wait()

Does waitFrame() wait 1/60th of a second when the game runs at 60fps and 1/20th of a second at 20fps?

If I use wait(0.01) or wait(0.001), it's a shorter wait period then waitFrame. What is the shortest "safe" wait period, and can a fast computer handle a shorter wait time then a slow computer?

Link to post
Share on other sites
1 hour ago, STRUNK said:

Does waitFrame() wait 1/60th of a second when the game runs at 60fps and 1/20th of a second at 20fps?

I think the game clock runs independently of how fast your PC is producing frames. If you run the game at 20fps, the game clock advances by 3 frames even though you've only seen one frame in that time.

1 hour ago, STRUNK said:

If I use wait(0.01) or wait(0.001), it's a shorter wait period then waitFrame. What is the shortest "safe" wait period, and can a fast computer handle a shorter wait time then a slow computer?

The shortest possible waiting duration is 1/60 of a frame, so 0.0167s. As Obsttorte pointed out once, if you use wait commands the engine checks every frame whether a greater or equal amount of time has passed. So if you specify 0.0200s, the engine will wait 2 frames, 0.0333s.

 

  • Thanks 1
Link to post
Share on other sites

@Dragofer

If I getFrameTime() it returns 0.0160 so I guess that is the minimum time the engine can repeat/check things. But if I have a wait of 0.001 in a while() loop, it calculates every frame what would have happened in 16 times this while() loop .. right?

 

I have a working script now and am determaning the right settings for maximum speed. Only problem is I can't get higher then a movement of 12 units in one loop, for it results in the enty escaping through the boundries: 

Spoiler

void Warning()
{
    $Warning.rotate( '0 0 720' );
}

void WarningStop()
{
while (1)
    {
    $Warning.stopRotating();
    sys.wait(0.002);
    }
}


void Collision()
{
$light_4.On();

        $Target1.rotateOnce('0 0 15');
        sys.wait(0.001);
$light_4.Off();
}

void Coll()
{
if ($Warning.isRotating())
Collision();
}

void RotateRandom()
{
    float minY = 0;
    float maxY = 0;
    float Y = minY + sys.random(maxY - minY);
    
    float minZ = -30;//-60
    float maxZ = 30;//60
    float Z = minZ + sys.random(maxZ - minZ);
    
    vector R = ('0 0 0');
    R_y = R_y + Y;
    R_z = R_z + Z;
    
    $Target1.time (0.1);
    
    $Target1.rotateOnce (R);
    sys.wait(0.2);
    float frmTime = sys.getFrameTime();
    sys.println (frmTime);
}

void Move()
{

    $Target1.speed (1);
    $Target1.move(REL_LEFT , 12);
    sys.wait(0.001);

}

void Rest()
{

    $Target1.move(REL_LEFT , 0);
    sys.waitFrame();

}

void MoveRest()
{
    float minA = 0;
    float maxA = 1000;
    float A = minA + sys.random(maxA - minA);
        
        if (A>=0&&A<1)
        {
        Rest();
        sys.wait(1);
        }

        if (A>=1&&A<2)
        {
        Rest();
        sys.wait(5);
        }

        else
        {
        Move();
        }
        
    sys.wait(0.001);
}

void MoveRestCol()
{
while(1)
    {
        if ($Warning.isRotating())
        {
        Coll();
        }
        else
        {
        MoveRest();
        }
        
    sys.wait(0.001);
    }
}

void RotCol()
{
while(1)
    {
        if ($Warning.isRotating())
        {
        Coll();
        }
        else
        {
        RotateRandom();
        }
    sys.waitFrame();
    }
}

void main()
{
    thread WarningStop();
    thread MoveRestCol();
    thread RotCol();
}

So I guess getting a higher speed means I have to find out how to get a greater distance in one loop (that always takes 0.0160 sec), without the escape ...

 

 

Edited by STRUNK
Link to post
Share on other sites
3 hours ago, STRUNK said:

@Dragofer

If I getFrameTime() it returns 0.0160 so I guess that is the minimum time the engine can repeat/check things. But if I have a wait of 0.001 in a while() loop, it calculates every frame what would have happened in 16 times this while() loop .. right?

It's very probable the 0.0160 is just a rounding down of 0.01666666. The most precise expression of a frame is 1/60 of a second.

sys.wait is less precise than sys.waitFrame because the engine checks every frame how much time has passed. So it checks after 0.0167s, 0.0333s, 0.0500s etc. If you tell it to wait 0.02s it actually waits 0.0333s because that's the first frame where time elapsed is greater than 0.02.

I really don't think there can be less than 1/60 of a second between scripted events, so you'd have to adjust the distance moved.

  • Thanks 1
Link to post
Share on other sites
15 hours ago, STRUNK said:

Is there something simple I can put in my script, or in my map that is realy eats resourses, so I can test what happens?

Use a gpu overclocking tool to decrease your GPU core clocks to something low like 200mhz.

Do the same thing with your CPU.

This will simulate a garbage potato.

  • Thanks 1

I always assumed I'd taste like boot leather.

 

Link to post
Share on other sites
42 minutes ago, STRUNK said:

I want to spawn a func_static and a func_mover from script ... is that possible?

You can spawn entities, and you'd probably need to set a model too, like this:

entity spawned_entity = sys.spawn("func_static");
spawned_entity.setModel("models/darkmod/...");
spawned_entity.setOrigin('0 0 0');

 

  • Thanks 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...