Bobs scripting woes

Post Reply
TheBob
Posts: 76
Joined: Sat Jul 06, 2013 6:04 pm

Re: Bobs scripting woes

Post by TheBob »

A short question on how the saving works:

Do the values of global local variables (global local? sounds terribly stupid, but I currently can't find another way to describe it, I think you'll get what I mean) of a LUA module get saved automatically? I would guess not, and that I'll have to fill them again after loading a game. Just want to make sure I'm not letting the CPU pull double shifts.
TheBob
Posts: 76
Joined: Sat Jul 06, 2013 6:04 pm

Re: Bobs scripting woes

Post by TheBob »

Also, can anyone explain me what Carbon Ore is supposed to be? it's on the trade list, and it kinda sounds like a mineable resource, but I never heard of any such thing, nor can I find any information about it. Is it just various carbides? where would exactly be the special value in that?
robn
Posts: 302
Joined: Mon Jul 01, 2013 1:11 am
Location: Melbourne, Australia

Re: Bobs scripting woes

Post by robn »

TheBob wrote:Do the values of global local variables (global local? sounds terribly stupid, but I currently can't find another way to describe it, I think you'll get what I mean) of a LUA module get saved automatically? I would guess not, and that I'll have to fill them again after loading a game. Just want to make sure I'm not letting the CPU pull double shifts.
No values are saved automatically. You have to do it yourself via Serializer and Deserializer functions. Have a look at some of the other modules for examples, and holler if you need an explanation (don't have time right at this second to write one).

And yes, its a crap way to do it, it was just the easiest way available at the time. It can change!
robn
Posts: 302
Joined: Mon Jul 01, 2013 1:11 am
Location: Melbourne, Australia

Re: Bobs scripting woes

Post by robn »

TheBob wrote:Also, can anyone explain me what Carbon Ore is supposed to be?
Its just a random name. The cargo list was copied outright from Frontier but mostly they're just name - very few of them have actual game mechanics attached.

Once the Lua-based equipment/cargo stuff is completed these will be very easy to change, add to and remove.
TheBob
Posts: 76
Joined: Sat Jul 06, 2013 6:04 pm

Re: Bobs scripting woes

Post by TheBob »

And yes, its a crap way to do it, it was just the easiest way available at the time. It can change!
Oh well, as long as it works, no problem :)
Its just a random name. The cargo list was copied outright from Frontier but mostly they're just name - very few of them have actual game mechanics attached.
Yes, but the other names at least make sense. I know what precious metals are, for example. I can work out some (admittedly rather arbitrary) probabilities of whether they exist in a system or not. Anyways, since the whole system is apparently due for an overhaul, I currently just won't bother about Carbon Ores. I'll just do a working prototype of the basics and then refine the whole thing once it's possible.
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Bobs scripting woes

Post by FluffyFreak »

TheBob wrote: So, to summarize the wishlist in a format that's easier to look up and reference:
1. Make Factions saveable entities
2. Provide access to complete faction list
3. Provide calls to deny starport functions to player (landing and trading most notably, could also include denying billboard access)
4. enable possibility to manually set faction of individual systems
So, I've started hacking around with this as I work back upto doing some Pioneer stuff - I've had a bit of downtime.

Defining what a faction-relation-matrix is has me a little stumped.
I mean it's easy to just create an NxN array and then assign random values between, for example; -128 and 127 to give a range of 256 states where -128 is "utter implacable hatred", 0 is neutral and 127 is "bestest-ever-buddies-look-I-got-you-another-bunny-cos-I-love-you-OMG!".
This gets you a lot of randomness of feelings, some total war, some hippy loving but nothing really coherent - so next I plan on filtering and smoothing it based on the distance to each faction with the further away you are the more it scales downwards to ambivalence (Neutral). Afterall, no-one cares if you're a hegemonising swarm so long as you're a hegemonising swarm far away and therefore someone else's problem. Perhaps with a brief band of "happy zone" distances whereby you actually like a star system simply because it's on the "other side" and thus probably a trading partner with some inconvenient other faction between you charging a lot of tax etc. None of which will be modelled, these are just the assumptions I'll build the "model" atop.

Also it's very very crude just having a single value to cover the gamut of feelings between entire factions - so suggestions on postcards please :)
robn
Posts: 302
Joined: Mon Jul 01, 2013 1:11 am
Location: Melbourne, Australia

Re: Bobs scripting woes

Post by robn »

FluffyFreak wrote:Also it's very very crude just having a single value to cover the gamut of feelings between entire factions - so suggestions on postcards please :)
It occurs to me that something like a character sheet would be useful that describes various traits of a faction. And we have a Character class...
TheBob
Posts: 76
Joined: Sat Jul 06, 2013 6:04 pm

Re: Bobs scripting woes

Post by TheBob »

Defining what a faction-relation-matrix is has me a little stumped.
Ah well, I didn't actually expect you to implement it. It could be created and managed by a LUA script, one just needs access to the faction list.

Also, I wasn't thinking about random values... well, I guess you have to initialise it somehow, true enough. Anyways, I was thinking of keeping the whole relational stuff on the LUA side (so people can mod it to their hearts content). Also, the matrix doesn't necessarily have to be restricted to 2 dimensions, but I didn't really plan the thing through in detail yet. It looks like I'll be getting some time some of these days to finish my prospecting script, I won't get around to the faction stuff until after that (most of my time goes to Orbiter, really).
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Bobs scripting woes

Post by FluffyFreak »

Ah I see, I just found it easy to hack on it in C++. Interfacing with Lua is the things I usually find the most awkward because I have to write a bunch of code without knowing what it's needed for. Ho hum.

One point though; the faction relation matrix is simply a 2D array because that's the quickest way of finding any relation between any to factions:

Code: Select all

  ABCDE
A xoooo
B oxooo
C ooxoo
D oooxo
E oooox
So if you wanted to know how "D" feel about "E" you just look it up, or vice versa with independent values so that each faction can have different feelings toward one another - and of course on the diagonal you get how D feels about D, which could represent internal harmony and peace or a faction engaged in a full throated civil war.

The question is, what should be in there? At the moment as I say I'm just using a simple signed byte to give 256 possible values, it could be as simple as a bool or as complex as a complete class that does some fancy "stuff".

@robn, yes I think that the factions could probably do with being more "character" like. I might have a look.
TheBob
Posts: 76
Joined: Sat Jul 06, 2013 6:04 pm

Re: Bobs scripting woes

Post by TheBob »

The question is, what should be in there? At the moment as I say I'm just using a simple signed byte to give 256 possible values
Now there's the tough questions I'm not really prepared for at the moment, because I can't tell what would work out good and what not... But I think you should be ok by making it something that could at least decently store combined values, so at least a WORD. That way several properties could be stored in the same value (like political relations, public oppinion, treaties, stuff...).
Post Reply