Snakes In The Ball Pit > Yay, I get to talk about me!

Thread.setTitle("Programmers Anonymous");

(1/29) > >>

A lot of people here dabble in code.
Let's share our experiences and bitch about how much we hate it but can't stop doing it anyway.
I'll go first:

My name is Ambious and I've spent my entire evening programming my first Python app.


I make mods in the Skyrim engine because I like tinkering with game/level/quest design.  If you want to know why Skyrim runs poorly, here's an example of how the engine works.

Let's say I want to run a script on "NPCs in the vicinity of the player".  For instance, if I need to know whether the NPC can see the player via that NPC's OnGainLOS event.

1. Make a quest that points to the player.  This is the only way to run a script on startup: making a quest.
2. Create a cloak ability that the quest script adds to the player. 
2.a. Create a magic effect on an area around the player.  This is the easiest way to affect all NPCs within a certain area.
2.b. Right now, this magic effect is going to be applied every game tick, which is going to use up a lot of computational power.  Add a script that toggles it on for a second, then off for four seconds or so.
2.c. Skyrim has 'brawls' where you're not allowed to use magic, but because this is technically magic, it'll break those brawls.  Add conditions to the magic effect that make it stop working during brawls.
3. Create a spell.  This spell is what the cloak effect casts on any NPC that comes into contact with it. 
3.a. Create a magic effect for the spell that contains a script that runs AddSpell on the targeted NPC.
4. Create a spell of the 'Ability' type. This is what the AddSpell script adds to the NPCs. Normal spells expire, abilities do not.
4.a. Create the magic effect for that ability.
4.b. Put whatever script you want the NPC to run into that magic effect.
4.c. Make sure to include a special conditional statement for OnDying so that when the NPC dies, it doesn't keep running the script and bloat the save game.

So essentially you make a quest that adds a spell to you that casts a spell on any NPCs in the area that adds an ability that runs the script.

This is the easiest way the modding community has found to attach scripts to nearby NPCs.

I'm working on a voxel game engine in Rust because I'm a huge fucking hipster and Rust seems like a pretty good language actually. Here's the Github repo if you care:
The latest thing I've been thinking about is whether to use Lua, Python, or C# as a scripting language for this project (in Python or C# the core engine bits would be embedded in the scripting language, rather than the other way around.) I'm leaning towards Lua, because my main problem with Lua was the "end" keyword you need to put everywhere and the global-by-default behavior, and both of those can be fixed with a little project called Moonscript, which is a transpiler and is basically CoffeeScript for Lua.

I make mods in the Skyrim engine because I like tinkering with game/level/quest design.  If you want to know why Skyrim runs poorly, here's an example of how the engine works.
EYE OF ZA, July 01, 2016, 05:26:27 pm
--- End quote ---

Wow, okay, that's a mess. Is it any easier with SKSE?

I considered developing Skyrim mods - but every time I think "I want X feature," I go looking on Nexus and somebody has already implemented X feature.

Could you link us to some of your mods? I'm curious.

It's been a while, but I remember making something with SKSE that could run a script on all actors in a cell.  It has the functions GetNumRefs/GetNthRef that let you iterate over all objects of a certain type (like NPCs) in a cell, so presumably you could set up a cycle like the above where every four seconds you AddSpell to all NPCs matching whatever conditions you specify.  (You have to repeat it because given NPCs' schedules and the player's movements, the NPCs in a cell can change at any time. Four seconds is a good medium because at top sprinting speed a player will cross a cell in about eight seconds.)  In this case, all you'd need to make is a quest, a script for that quest to run GetNumRefs/GetNthRef/AddSpell, and the ability that contains the actual script you want the NPCs to run.

It's entirely possible that this would break the engine or be more computationally expensive, though.  Skyrim's engine is such a weird cobbled together wreck that the fact that it can run at all is a feat.

I haven't put my mods up anywhere because they're more personal experimentation about "what if I could do ___" than any kind of finished product.  I like the problem-solving more than the polishing.

I haven't put my mods up anywhere because
EYE OF ZA, July 02, 2016, 01:09:48 pm
--- End quote ---

Oh, so they're sex mods. Just be sure to send the links discreetly or else post pseudonymously and you probably won't get ratted out.


[0] Message Index

[#] Next page

Go to full version