where to store global objects

52 views
Skip to first unread message

Littlefield, Tyler

unread,
Jan 22, 2018, 5:47:18 PM1/22/18
to eve...@googlegroups.com
All:
I have some global objects that I'd like to store. For example I'm
working on a city system as well as various other systems that need to
store instances of classes that can be serialized and/or just loaded.
What would the best way to do this be?

I'm also dealing with zone resets where each zone has its own tag, but
I'll need to store reset data somewhere. I was thinking about having a
class called Zone that holds this data as well as any other required
data and attach that somehow, but I'm not sure of the best way to store
this information.
Thanks,

Nicholas Matlaga

unread,
Jan 22, 2018, 6:12:31 PM1/22/18
to Evennia
When you say instances of classes, you mean typeclassed objects? I suppose a global script might be the solution for you, but can you describe a little further your intentions/goals with this?

Littlefield, Tyler

unread,
Jan 22, 2018, 7:11:46 PM1/22/18
to eve...@googlegroups.com, Nicholas Matlaga
On 1/22/2018 6:12 PM, Nicholas Matlaga wrote:
When you say instances of classes, you mean typeclassed objects? I suppose a global script might be the solution for you, but can you describe a little further your intentions/goals with this?

First I have  a city object (doesn't have to be a typeclass--I'd honestly prefer that it wasn't since it's not an actual object that you need to have all that logic on). It holds things like economy information, etc. Same thing for zones: you have x amount of zones and each one needs information that dictates what gets to reset on them. So like:
{"city_guard", 10}
sets up 10 city guards.
On Monday, January 22, 2018 at 5:47:18 PM UTC-5, Tyler Littlefield wrote:
All:
I have some global objects that I'd like to store. For example I'm
working on a city system as well as various other systems that need to
store instances of classes that can be serialized and/or just loaded.
What would the best way to do this be?

I'm also dealing with zone resets where each zone has its own tag, but
I'll need to store reset data somewhere. I was thinking about having a
class called Zone that holds this data as well as any other required
data and attach that somehow, but I'm not sure of the best way to store
this information.
Thanks,

--
You received this message because you are subscribed to the Google Groups "Evennia" group.
To unsubscribe from this group and stop receiving emails from it, send an email to evennia+u...@googlegroups.com.
To post to this group, send email to eve...@googlegroups.com.
Visit this group at https://groups.google.com/group/evennia.
To view this discussion on the web visit https://groups.google.com/d/msgid/evennia/cf784376-d344-4c10-85da-fa768de8094b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Griatch Art

unread,
Jan 23, 2018, 4:10:57 AM1/23/18
to eve...@googlegroups.com
@Tyler

What you want for this sounds like a combination of things. For a 'zone' I would normally recommend you use Tags (as you are); but those carry no information of their own, they are just labels you attach to arbitrary objects so you can quickly query for them later. For those not familiar with tags reading this, you could tag all "city-rooms" in your city so you can find and operate on all of them. You could then add additional tags "downtown", "shantytown", "plaza" or what have you to quickly find sub-locations of the city. You can attach as many tags as you want on objects.

What you are looking for with {"city_guard":10} is probably best achieved using a global Script. A Script is a typeclassed entity but it has no in-game existence and they don't have to have a 'timer'. Sometimes Scripts can be attached to objects, when they are not we refer to them as 'global'. Like all typeclassed entities, Scripts can have Attributes on them. So to describe your city you could create a single, unique Script. On that then you could have attributes that you could store however you want. So you could set it up as cityscript.db.city_guards = 10  or cityscript.db.npcs = {"city_guards": 10, ...}. You can of course make similar global scripts for each zone or you could group zone info in one place within the 'city script'.

The last option is to create a custom database model for your city. I don't think that's necessary for this though, a global Scripts sounds a lot more convenient for this.

Relevant links:
https://github.com/evennia/evennia/wiki/Tags
https://github.com/evennia/evennia/wiki/Scripts
https://github.com/evennia/evennia/wiki/New-Models
.
Griatch



On Tuesday, January 23, 2018 at 1:11:46 AM UTC+1, Tyler Littlefield wrote:
On 1/22/2018 6:12 PM, Nicholas Matlaga wrote:
When you say instances of classes, you mean typeclassed objects? I suppose a global script might be the solution for you, but can you describe a little further your intentions/goals with this?

First I have  a city object (doesn't have to be a typeclass--I'd honestly prefer that it wasn't since it's not an actual object that you need to have all that logic on). It holds things like economy information, etc. Same thing for zones: you have x amount of zones and each one needs information that dictates what gets to reset on them. So like:
{"city_guard", 10}
sets up 10 city guards.
On Monday, January 22, 2018 at 5:47:18 PM UTC-5, Tyler Littlefield wrote:
All:
I have some global objects that I'd like to store. For example I'm
working on a city system as well as various other systems that need to
store instances of classes that can be serialized and/or just loaded.
What would the best way to do this be?

I'm also dealing with zone resets where each zone has its own tag, but
I'll need to store reset data somewhere. I was thinking about having a
class called Zone that holds this data as well as any other required
data and attach that somehow, but I'm not sure of the best way to store
this information.
Thanks,

--
--
Reply all
Reply to author
Forward
0 new messages