New Reply
Name
×
Email
Subject
Message(0/20000)
Files Max 5 files50MB total
Tegaki
Password
[New Reply]


Keep at it, Anon!


null_pointer.webm
[Hide] (729KB, 640x360, 00:09)
Got distracted by a non-gamedev project? Post about it here.
realtime_search.webm
[Hide] (3.2MB, 800x690, 00:25)
>>1316
>I'm thinking of adding a real-time search so you can type into a text box and the results update automatically
I randomly felt like adding this to my file text search tool yesterday, and coincidentally yesterday was exactly 1 year away from that post. I also added other little quality of life things. The text input boxes are still fake (only supports typing and backspace, no selections or anything).

You can save paths and search queries by pressing the square on the right, right click opens a dropdown menu. They're saved into text files so you can also edit those if you want. I want to add a way to manage blacklist/whitelist for file names or extensions, but I'm still thinking about how to do that because I can imagine it being a pain to manage them.
Replies: >>2071 >>2073
shortpath.png
[Hide] (51.7KB, 800x411)
>>2070
I JUST came up with another quality of life thing: the gray path is shortened so it starts from the first folder.
Looks like some interesting stuff, Anon. Nice work.
>>2070
Updates:
- Made the text fields work properly. No mouse interaction though.
- When you type into the path field, it now shows a list of other folders, and pressing enter will autocomplete into the closest folder.
- Added a settings file, so you can configure some things. For example when you click a text match, you can launch a custom command so you can make it open in different programs.
- Added scrollbar (visual only).
I put it up on my website: https://sundee.neocities.org/stst/index.html
Replies: >>2074
>>2073
Naicu. What language did you program your search tool in?
I hope nobody tried to download that because I fucked up the filename so the link didn't work. It's fixed now.

>2074
C. Far from perfect, but still closest to my ideal programming language.
Coincidentally, I have an entire article rambling about changes that I'd make to C: https://sundee.neocities.org/programminglanguage/index.html
Replies: >>2076 >>2077
>>2075
Thanks! I might look into it then. Cheers.
Replies: >>2078
>>2075
I noticed on your page:
https://sundee.neocities.org/c/simplegame_sdl_linux#setup

You seem to have 'images' & 'audio' terms swapped?
For images: SDL_Mixer, install with sudo apt install libsdl2-mixer-dev
For audio: SDL_Image, install with sudo apt install libsdl2-image-dev
Replies: >>2079
>>2076
Look into C? "Approach with caution" is what I would say, it's not for everyone. It's extremely difficult to recommend any language because everyone cares about different things, I used Javascript for several years at first and I doubt I would have wanted to use C back then. But even if you desire more control than Javascript on a web browser, there's several levels of depth between that and C.

>2077
Yep that's wrong, good find, thanks.
I don't know how I keep screwing up these quotes.
>>2077
I did some Stalker Anomaly modding again.

I modified starting loadouts, now you have no items by default, there's a lot more items to choose from, and you can pick as many of them as you want. Limiting the choices makes sense, but if you've played the game a lot and have self-control, then it's better to have the ability to customize freely.

I've had all my story quests break too many times due to some bug, so I decided to start playing on "azazel mode" instead (special game mode where dying causes you to switch to another NPC instead of getting a game over). I modified the script so the equipment you get are both less predictable and more fair (it used to always give you a silly starting loadout). I also changed which NPC is picked, it now prioritizes NPCs from the same faction, and NPCs that are in adjacent maps. I can't seem to be able to spawn ammo, I'm doing it exactly the same way as in other scripts but it doesn't work, so the only ammo you'll have is the ones in your guns. I'll probably check what you have on you and spawn something similar, I play with Toxic Air so it would be nice to give you a gas mask if you had one previously. If you had an artifact detector, increase the chance of giving the new character a detector too. Give a random backpack that's lower tier than your previous one. Wouldn't have to start completely from 0.

I found the script where enemy loot drops are handled, so I added a filter that downgrades their ammo. Now there's % chance to downgrade to a "weaker" variant (e.g. AP -> FMJ), and another % chance to downgrade from normal to old/broken ammo. Lower ranked NPCs have higher % chance. I'm considering completely overhauling how loot is generated, but I also need to be able to manage stash loot or else it's wasted effort.

---

Following the loot drop stuff, I explored the script where loot stashes are created, but I don't understand how it works. It seems simple at first but then just.. what? It splinters into different directions and the function names don't seem to match what they do. get_random_stash will actually create a stash, it also calls set_random_stash which spawns loot, but there's also a spawn_treasure function which spawns loot and it's called when the stash is opened, but get_random_stash which spawns loot is called when the game starts, so the loot is spawned twice?

It doesn't help that there's a callback "on_game_load", but nowhere is it explained when it gets called. When you start the game? When you start a new run? Every time you load a save? This script creates the stashes from it which implies that it's only called when a new playthrough is started, but based on context in other scripts, it seems to be when you start playing a save but there's a "load_state" callback for that, and in others it seems like when the game is booted but there's a "on_game_start" function which does that.

I tried to look into how quests are generated because I'm tired of there being so many "bring me 8 of this highly specific item that you've never had any of and if you did then you'd want to use it yourself" quests, but jesus christ it's a convoluted mess too.
Replies: >>2168 >>2171 >>2177
>>2167
I was just tweaking the azazel NPC selection priority, and came up with an interesting trick:
[code]
int priority = 0;
if (npc_faction != player_faction) priority += 160000;
if (npc_rank    >  player_rank)    priority += 80000;
if (npc_pos.z   >  player_pos.z)   priority += 40000; // Prioritize npcs who are more in the south than you.
if (npc_map     == player_map)     priority += 20000;
priority += distance(npc_pos, player_pos); // Distance is at most about 10000.
[/code]
The above is similar to sorting objects into a 5D array, except you only need single integer. Multiplying the value on each condition by 2 causes each condition to always have higher priority than the less important conditions, for example 8+4+2+1 = 15, still lower than 16.
I hate these motherfucking tags.
int priority = 0;
if (npc_faction != player_faction) priority += 160000;
if (npc_rank    >  player_rank)    priority += 80000;
if (npc_pos.z   >  player_pos.z)   priority += 40000; // Prioritize npcs who are more in the south than you.
if (npc_map     == player_map)     priority += 20000;
priority += distance(npc_pos, player_pos); // Distance is at most about 10000.
Replies: >>2170
>>2169
Actually, IMHO they are
a)  much-more in line with markdown
b)  the syntax highlighting here is invaluable.

---

Anyway, interesting work with NPC 'weightings'. Mind explaining where/how you'll use this in your code?
Replies: >>2171
priority.png
[Hide] (19KB, 1984x468)
>>2167
I just spent like 2 hours trying to spawn ammo in azazel mode. I think the problem is that since the NPC you're possessing is in another map, they're in an "offline simulation" so the "iterate through inventory items" method doesn't exist on them. There's another part of the script I didn't notice which loops through all items in the game, checks if they're owned by the NPC, and transfers them to the player, I put the ammo spawning in there and now it works.

>>2170
Most imageboards use [code] tags and some imageboards have switched back and forth between backticks and [code] tags, so it's impossible to remember which ones to use.

>where/how you'll use this
I just loop through all NPCs in the game, select the NPC with lowest priority value, and possess that character. Or more specifically, I pick a random NPC from the first "category".

Pic related is a visualization of how the priority values end up. The red numbers on the bottom are the "categories", if there's no perfect match then it'll pick the next best category, and so on. To get the category, sort the list by priority, remove everything after the first NPC that has a 10k+ priority difference compared to the next one, you'll get a list of all NPCs in the same category regardless of what the min/max priority values were.
ray.webm
[Hide] (10.3MB, 1280x720, 00:54)
>>2167
I was trying to make sense of the loot spawning script again. I still don't really get it, so I gave up and started writing a new loot spawning script from scratch just to get a sense of how I ideally would want to do it. I quickly realized that rather than picking random pre-existing stashes to put loot into, there should be areas where loot boxes may spawn dynamically. The world would be infinitely more fun to explore if every corner and crevice and rock and box and car had the potential to have a stash in it, and you couldn't just run from one pre-existing stash to another. After exploring other mods, I now know how to spawn inventory boxes and how to do ray casts to find surfaces.

Things I still need to figure out:
- How to rotate the object to match the surface. I know how to get the surface normal, but I'm not familiar with the math for rotating the object to match it, especially because I want to also give the object a random rotation in the vertical axis.
- How to draw better visualizations than these white dots, they "sink" and disappear into any nearby surfaces so I have to lift them up arbitrarily in order to see them. I saw another mod use some kind of debug drawing system, but it requires newer version of "modded exes", I don't want to use it since it doesn't work properly on Windows 7. For now if I want to visualize a line I'll have to draw a row of these dots.
- Why spawning an object requires a "game vertex ID" and a "level vertex ID". I have no idea what they are or where you're supposed to get them, currently I'm just copying them from the player and it seems to work... maybe that parents them to the player and they'll disappear when you leave the map or something.

This opens up more potential developments.
1. I should be able to use the same system to place loose items too, like bottles on tables. Ideally I'd want to find how/where those are defined so I can absorb all the existing loot spots into a new loot spawning script that handles all the stashes and loose items together.
2. Placing objects in the world is one of the most important mechanics for creating quests. I might already be able to do something like placing a note/PDA into a stash that points you to another more hidden stash with loot on it. I wouldn't even have to interact with the clusterfuck of a quest system to do that.

My current goal is to create some kind of controls that allow me to just run around placing a million points/lines/rectangles in the world, and save those as spawn regions where loot boxes may spawn. They should also light up when I walk next to them so I can easily analyze the spawn regions in the world.
Replies: >>2178
surface_editor.webm
[Hide] (7.2MB, 1280x720, 00:39)
>>2177
Surface editing UI works pretty good so far. Unexpectedly, the biggest problem is that this gets super laggy when there's a lot of these white points being drawn. I'm hiding shapes that aren't close to the target cursor, but still I can barely fill all the surfaces in 1 room before the framerate tanks. The position of the points are also imprecise since I have to move them towards the camera to make them visible.

This isn't ideal yet because I can't edit any extra information about the surface. I want to be able to add flags that describe the surface, which could then be used to control what kinds of stashes/items can spawn on it. For example surfaces on a window sill shouldn't be able to have big boxes or backpacks on it. I also want to make lines along a wall that could have a box or weapon leaning against it, and tight spaces behind a couch would need the container to be rotated 90 degrees.
Replies: >>2179
lines.webm
[Hide] (627.3KB, 1280x720, 00:03)
>>2178
Okay this is way more labor intensive than I expected. Maybe my sense of time is distorted because I keep fixing bugs and making little improvements and fighting with Lua and I need to restart the game every time, but I've already marked 254 surfaces and I haven't even left the starting town yet.

Also these dots are probably laggy because they linger around for a few frames, so each dot I'm drawing is actually 3-5 dots. It became very obvious when I animated the outlines.
new_editor.webm
[Hide] (19.5MB, 1280x720, 01:28)
I was supposed to work on another project, but I accidentally managed to untangle the web of pOOP and XML file parsers that this game's UI system uses. I always thought that the UI system in this game was a horrible abomination, but it actually seems very well made if you peel off enough shit layers and use the base level UI classes directly. There's literally 0 examples of the text node being used anywhere in the game's scripts. Now I can properly display debug information in the corner.

This also fires up my thinking hat because the ability to modify the HUD opens up a lot of modding possibilities. For example I kind of want to buff the geiger counter, I could add a symbol to the UI if there's a radiation field nearby and you have a geiger equipped. I've also considered replacing the game's buff/debuff system with a new much more versatile one, the main reason I didn't do it so far is because I didn't know how to modify the UI. The stat bars on bottom left are also pretty lousy and what you see in the video is the best I've been able to do just by replacing textures, but now I could just replace the whole widget with my own solution.

Anyway, the interface for editing these shapes is near it's final form, it's now very fast and easy to add new shapes and tweak existing ones, it's actually kind of satisfying to walk around filling in all the surfaces and corners and hidden spots. I can't rotate circles or use a third vertex to create an ellipse though, I don't want to learn 3D math with a game where I have to spend 30 seconds on loading screens every time I want to restart the game and try some new code.

I also don't have visualization for spawn methods, each shape may spawn items in one of 4 possible ways: directly on top of the line, in front of the line, behind the line, or inside the shape it creates. Don't want items to spawn inside walls.

Also in video are 2 separate tools: a visualizer for the vanilla item spawn points, and a tool that highlights nearby game objects. I wanted to use the latter to find all the stashes in the world and delete them, but turns out they're part of the level geometry so I can't remove them without editing the level files. I can still use it to analyze how the game works though (I already learned a few interesting things), and compare my own spawn spawn points with existing stashes.
Replies: >>2188
>>2187
Sounds like you're making good progress now, Anon. GG.
I came up with a trick to check if any word of 8 bytes or below is a keyword, using just an integer comparison.
u64 value = 0;
memcpy(&value, word.data, word.length);
switch (value) {
	case *(u64*)"if\0\0\0\0\0\0": return KEY_IF;
	case *(u64*)"for\0\0\0\0\0": return KEY_FOR;
	case *(u64*)"else\0\0\0\0": return KEY_ELSE;
	case *(u64*)"break\0\0\0": return KEY_BREAK;
	case *(u64*)"while\0\0\0": return KEY_WHILE;
	case *(u64*)"return\0\0": return KEY_RETURN;
	case *(u64*)"struct\0\0": return KEY_STRUCT;
	case *(u64*)"continue": return KEY_CONTINUE;
	case *(u64*)"function": return KEY_FUNCTION;
}
It may not work depending on compiler: it may not accept the fact that the string is a constant. I suppose you could replace it with an equivalent hexadecimal value.
Replies: >>2190
>>2189
Neat! That should be fast, Anon.
3c9e36927c316c98e22a559b635e578bbe95113d1f5f299731ea71c03ce5058e.jpg
[Hide] (44.9KB, 592x790)
>try to learn 3D math
>hmm it would be nice to have a constant variable that is PI*2
>try to use windows calculator
>it truncates several digits from the result
>had other problems in the past where divisions return some stupid scientific notation which I can't put into config files or anywhere and it's a pain in the ass to convert it
>time to look for a new calculator
>find exactly one that isn't some gay web app
>same problem
>I wonder if there's math libraries for doing calculations with infinite precision
>find several, all of them suck
>one of them is at least somewhat usable but it's way too clumsy to actually use, also fucking annoying to read because every single line of code has a comment on separate line saying what it does, usually just repeating what's on the line except in slightly more english words
>another one has an expression parser that lets you just input a string, but the library is an absolutely fucking nightmarish labyrinth of OOP spaghetti and C++ libraries glued to one another, literally 4 functions/methods/overloads and 2+ classes just to do 1 operation, and that's not counting all the other classes and methods that those use
>try to adapt the parser to the better library
>fail and end up making my own
1 day later I have no idea what I was trying to do originally, but at least I can now type infinitely precise equations and get infinitely precise results. Here's some PI values with 80 decimal digits, cut them to your preferred size:
#define MATH_PI_MUL_PI    9.86960440108935861883449099987615113531369940724079062641334937622004482241920524 // PI * PI
#define MATH_PI_MUL_4    12.56637061435917295385057353311801153678867759750042328389977836923126562514483599 // PI * 4
#define MATH_PI_MUL_2     6.283185307179586476925286766559005768394338798750211641949889184615632812572418 // PI * 2
#define MATH_PI           3.141592653589793238462643383279502884197169399375105820974944592307816406286209 // PI
#define MATH_PI_DIV_2     1.5707963267948966192313216916397514420985846996875529104874722961539082031431045 // PI / 2
#define MATH_PI_DIV_4     0.78539816339744830961566084581987572104929234984377645524373614807695410157155225 // PI / 4
#define MATH_PI_DIV_180   0.01745329251994329576923690768488612713442871888541725456097191440171009114603449 // PI / 180
#define MATH_PI_DIV_360   0.00872664625997164788461845384244306356721435944270862728048595720085504557301725 // PI / 360
#define MATH_180_DIV_PI  57.29577951308232087679815481410517033240547246656432154916024386120284714832155263 // 180 / PI
#define MATH_360_DIV_PI 114.59155902616464175359630962821034066481094493312864309832048772240569429664310526 // 360 / PI
#define math_deg_to_rad(deg) ((deg) * MATH_PI_DIV_180)
#define math_rad_to_deg(rad) ((rad) * MATH_180_DIV_PI)
>inb4 muh compiler will do it
I don't care.
Replies: >>2193 >>2194
>>2192
Cool story, bro.  :D

>...but at least I can now type infinitely precise equations and get infinitely precise results
Pretty neat. GG, Anon.
I fell back into the rabbit hole of Stalker modding again, this time trying to change how loot is generated when an enemy dies. I kind of get it, but also don't, frankly I think it's completely fucked and even the developers don't really understand how it works. There's a couple functions that are called multiple times for the same NPC, they generate and delete items in very conflicting ways and some parts of the code are duplicated in different functions. If you imagine trying to design and balance loot drops, I just can't see how anyone could understand what's happening in this system.

My conclusion is that the best way to rebalance loot would be to disable everything that's happening in that script, and start over by detecting enemy deaths from another script and manage loot from there. The only reason I didn't start doing that is the fact that the loot script simulates a fake inventory for NPCs, which is also used when you trade with the NPC.

It's just kind of depressing how entangled everything is. In a better engine the items would actually be in NPC inventory, not in some kind of fake list stored in a script. I think part of the reason they aren't real items is probably because the engine's game object ID is a 16-bit integer. Every single item (spawned in world, in a stash, in NPC/trader inventories) and NPC and monster and anomaly and item stash and interactable object (doors, ladders, campfires) and breakable object and AI logic node that exists in the game world is a game object, they all exist in all maps simultaneously because of how the world sim system in Stalker (A-Life) works, and because of the 16-bit ID there can only be 65536 game objects at once.

>>2192
I decided to make a program out of it:
https://sundee.neocities.org/simpleexpressioncalculator/index.html
[New Reply]
25 replies | 9 files
Connecting...
Show Post Actions

Actions:

Captcha:

- news - rules - faq -
jschan 1.7.0