What is best to create a Sandbox/Life Sim game?

DuniX

Well-Known Member
Dec 20, 2016
1,205
797
What would be the best engine for a game like Glassix where characters can navigate over the map based on the time and schedule as well as do their own actions there?
Preferably I would need a good Update() or Thread() function for the heavy AI simulation as well as possible realtime clock and running events.

I guess ren'py would be my default choice and Unity would be the more complicated option.
Is there a better engine other than that?

I am also looking for what I can do for assets for the Visual Novel Locations. Is there a Image pack somewhere that is readily available?
It doesn't need to be full 3D Scenes, just the locations represented, again something like Glassix would be ideal.
 

Saki_Sliz

Well-Known Member
May 3, 2018
1,403
1,005
Depends on how complex you want their behavior, how much you need the realtime clock to be truly real time. I can't say much for renpy, but I am pretty certain the unity engine gets direct access to the clock.

However other than the clock, no engine really will help, it is mostly up to your programming skill.
 

DuniX

Well-Known Member
Dec 20, 2016
1,205
797
I can handle the programming, just need the api to be accesible.
I am just looking for what kind of engine is the easiest to work with.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,375
15,289
Preferably I would need a good Update() or Thread() function for the heavy AI simulation as well as possible realtime clock and running events.
Last time I checked it, Glassix was far to have a heavy AI simulation. It was just things like testing each girl frozen schedule according to the current in game time, and moving them accordingly to the result. And this not in real time, but after each action of the player.
Have it changed this much ?

In Python it would looks like :
Python:
schedule = { 0: "sleeping", 700: "shower", 715: "breakfast", [...] }

# * 100 to be humanly readable/writable
currentTime = ( hours * 100 ) + minutes

for scheduledTime in schedule:
    if scheduledTime > currentTime: break
    currentAction = schedule[sheduledTime]
And that's all. You know what the girl is doing right now, and you needed at max few microseconds for this.
You'll go up to few dozen of microseconds for all the girls, which still let you a lot of place to the rest.
Even for a full real time approach (the time advance even when the player do nothing), it's fast enough to be put inside the main loop of your code.

There were also some need, eat and urinate, but like the girls weren't effectively moving, but teleporting to the right location, it don't really change the code :
Python:
schedule = { 0: "sleeping", 700: "shower", 715: "breakfast", [...] }

# * 100 to be humanly readable/writable
currentTime = ( hours * 100 ) + minutes

for scheduledTime in schedule:
    if scheduledTime > currentTime: break
    currentAction = schedule[sheduledTime]

needToUrinate += 1
needToEat += 1
If needToUrinate >= 100: currentAction = "urinate"
elif needToEat >= 100: currentAction = "eat"
Threads would be needed only if, in top of this, the girls have effective interaction with the world. Because in this case the schedule isn't frozen, but always adapt according to more complex computations. Yet, depending of the complexity of those computation, one thread can be enough for all the girls.
 
  • Like
Reactions: kaiserarm

DuniX

Well-Known Member
Dec 20, 2016
1,205
797
I mean I want to do Sophisticated simulation for my project, not specifically like Glassix.
I mentioned Glassix because the girls could travel around the map somewhat and you could command them to follow.
Not many games do that, most of them use a fixed event in a particular time frame.
 

kaiserarm

New Member
Jun 7, 2020
3
2
I can handle the programming, just need the api to be accesible.
I am just looking for what kind of engine is the easiest to work with.
This is gonna be unpopular. But if you can actually handle the programming, I would suggest scrapping both renpy and Unity.
Chances are, the frameworks are going to be more trouble to figure out and comply with than rolling your own.
Get a decent UI or 2D lib and build your own AI loop, event dispatcher, etc.
You'll learn a ton, have less dependencies, and a better fitting result.
 
  • Thinking Face
  • Like
Reactions: Cul and hiya02

DuniX

Well-Known Member
Dec 20, 2016
1,205
797
I want to make things easier on myself, although Renpy doesn't seem as good as it's more about linear written scenes than procedural stuff.
But I at least want the usual VN stuff like UI,Character Sprites, Animations and Effects, Text Display.
What about Rakugo for Godot or Ramen for Renpy? Have people tried them?
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,583
2,222
The thing to remember about RenPy is that it is derived from Python... In theory at least, if you can do it it Python... you can do it with RenPy... and you can pretty much do anything with Python. (Not that I'm a Python programmer).

But yeah... RenPy is really all about mostly a framework for story telling. It is about ease of access and a common "feel" to the games.

If by "realtime", you mean characters wandering in and out of a scene while a player does nothing... then even I would say to give RenPy a pass.

However, my gut feel is more towards Unity. The programming complexity you seem to be discussing would be better suited by it... since it is practically all API.

Personally, I would do it in RenPy and lose the realtime simulation in favor of event driven state machines. Where each time a player moves between rooms/areas (or other actions maybe) - the underlying state machines are updated according whatever rules would guide your simulation... my sense is in-game time of day and a list of potential actions and their dependencies. The weakness in such a system is that each other game entity would likely only take one action per player action... so Sally might move between the bedroom and the kitchen, even if the player's action might have taken literally hours to complete. Again, anything is possible... but the more complex you get, the less you are using RenPy and the more you are using Python... at which point, you may well have been better starting with Unity instead.

But then I prefer RenPy over Unity... so I am somewhat biased.

Edit: As far as assets: There nothing to stop you using Unity as a presentation space for pre-rendered scenes/zones in the same way that RenPy does. It is as much a 2D engine as it is a 3D engine. If you were already considering RenPy, then rendering in something like Daz3D must have already been part of your planned workflow - so keep things simple, and stick with that plan regardless of which engine you end up with. Again... gut feel... but it sounds like you'd be better served by using much higher quality pre-rendered assets, rather than using realtime ones. Unity (and Unreal3D) are great at environmental textures and such - but their character models and textures are usually hideous.
 
Last edited:

kaiserarm

New Member
Jun 7, 2020
3
2
I want to make things easier on myself, although Renpy doesn't seem as good as it's more about linear written scenes than procedural stuff.
But I at least want the usual VN stuff like UI,Character Sprites, Animations and Effects, Text Display.
Of course the goals is making it easier on yourself. What that entails depends a lot on your design goal and experience level though. If you have little experience and want to make something common, a framework is the way to go. If you have your own ideas, frameworks may make it more difficult for you.

If you want it to be mostly VN like, Renpy is probably your best bet. The more you deviate from VN, the harder it's going to be though. Personally I didn't find customizing Renpy a very satisfying experience.

Sprites, Animations and Effects are for the most part trivial to do yourself, with tons of tutorials out there. Most game libs have them built-in anyway. UI is more involved, but there are lots of premade toolkits. Your graphics lib typically comes with a couple built-in or third party options.

What about Rakugo for Godot or Ramen for Renpy? Have people tried them?
No. I'd take a good look at them and decide if you need the extra features on top of Godot or Renpy. Keep in mind you'll depend on both, which means you'll ultimately end up having to understand both, maintain both, and be restricted by both.
 

DuniX

Well-Known Member
Dec 20, 2016
1,205
797
The thing to remember about RenPy is that it is derived from Python... In theory at least, if you can do it it Python... you can do it with RenPy... and you can pretty much do anything with Python. (Not that I'm a Python programmer).
The problem I see with Renpy is the data structure, rather then the functions and logic.
From what I see with the jumps and labels and stuff the dialog is written pretty linear rather than more dynamic responses that depend on complex game state and dynamic actions.
It might have some checks and flags but that's about it.
There might be some ways to format things differently in Renpy but I am not that experienced in it to know.
Ramen framework seems to be like this? I am not sure.
 

BeardWonerArt

New Member
May 24, 2020
12
14
Have some experience in OOP and trying to get a grip on renpy myself atm.
As far as I understand it, the only way to "structure" it, is to create labels and access these via call or jump.
So I think you could create a label which keeps the game running (map screen e.g.) and jump back to this label
after every event.
But again, just trying to understand renpy myself, maybe I'm wrong :)
 

DuniX

Well-Known Member
Dec 20, 2016
1,205
797
Yes but the events themselves would be pretty linear and not all that dynamic with interactions and stuff, you only have dialog boxes in terms of agency I believe?
 

BeardWonerArt

New Member
May 24, 2020
12
14
Have thought about how I would realize a sandbox myself.

I'm not sure if there's a framework for stuff like

"if character stats == ? and daytime == ? and place == ? -> play event x",

think rpgmaker goes roughly that direction.

If I would do it in renpy I would extend/ have a character data class which would have functions to get the stats and a logic for events for this character plus a global daytime/ day of the week. Also classes for places and maybe events.

So when I visit places I would be able "ask" these if there's an event for an character at this daytime/ day o.t. week.

All the rest would be in the matrix ;)

And again just my thoughts and I'm no pro :)
 
  • Like
Reactions: eM-Ka and DuniX

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,583
2,222
I'm not sure if there's a framework for stuff like

"if character stats == ? and daytime == ? and place == ? -> play event x",
Maybe not a "framework" (not that my can put a firm definition of that word into my head), but RenPy is more than capable of such checks.

I can think of two ways...

Python:
    if lucy_pain >= 6 and time_of_day == 3 and current_loc == "livingroom":
        jump livingroom_lucy_event4

Though it's much more likely, I'd code something like...

Python:
    # this presumes we're in section of code dealing with only Lucy.
    # It's much more likely we've be in a section of code dealing with "living room" - but that wasn't the example.

    if current_loc == "livingroom":
        if time_of_day == 0:  #morning
            jump livingroom_lucy_event1

        if time_of_day == 1:   #afternoon
            pass  #do nothing

        if time_of_day == 3:   #late evening
            if lucy_pain >= 6:
                jump livingroom_lucy_event4a
            else:
                jump livingroom_lucy_event4b
This is generic code intended to promote a generic approach. It is not optimized and it certainly not a good example for all situations.

Sandbox games tend to revolve around some sort of hub within the code. That could be a single hub that copes with all eventualities or it could be a hub around each individual room. Or any other variation you can think of. In my limited experience, hubs tend to be pictures of rooms where the player can pick other rooms or choose another action, or they can pictures that form some sort of local/world map.

After a section of code (event) is completed, control is passed back to a common point that makes sense for that game (what I'm calling a hub). Within a RenPy game, that point would usually then just call a screen that would sit there waiting for the user to press one of the virtual buttons. The user picks an action and the game continues by acting upon that action.

But there is nothing stopping a suitably complex programmer building all sort of other function into the hub coding. Preparing actions, setting variables, filtering lists, randomizing things a bit, enabling or disabling certain action buttons... or more relevant to the OPs point, letting the game move characters around and make actions semi-independently of the players actions. It really is only limited by your imagination and coding skills.
 

hiya02

Member
Oct 14, 2019
169
95
Have thought about how I would realize a sandbox myself.

I'm not sure if there's a framework for stuff like

"if character stats == ? and daytime == ? and place == ? -> play event x",

think rpgmaker goes roughly that direction.

If I would do it in renpy I would extend/ have a character data class which would have functions to get the stats and a logic for events for this character plus a global daytime/ day of the week. Also classes for places and maybe events.

So when I visit places I would be able "ask" these if there's an event for an character at this daytime/ day o.t. week.

All the rest would be in the matrix ;)

And again just my thoughts and I'm no pro :)
We use a somewhat similar approach, where the event objects contain a set of preconditions for N(PC) stats & attributes, time of day, day of week, location, story arc phase etc.
 
  • Like
Reactions: BeardWonerArt

BeardWonerArt

New Member
May 24, 2020
12
14
hiya02

Yes, thought also about let the events check their conditions (and for a game that is released by/ in updates you could nicely structure your code like a separate file for the events of each version).
Just thought for me it would be easier to structure it character-wise and let the characters check the condtions for their events, though you need additional character objects named "threesome", "foursome" or "n-some" or it'll get messy ;)
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,375
15,289
From what I see with the jumps and labels and stuff the dialog is written pretty linear rather than more dynamic responses that depend on complex game state and dynamic actions.
I fail to see the practical difference between a label and a function.
Code:
label bedroom:
    call girlCheck
    if _return is False:
        jump hallway
    "blablabla"

label girlCheck:
    if quest1.started is True:
         call quest1Check
         return _return
    elif girlMood == "mad":
        girl "Go out ! I don't want to see you"
        return False
    elif girlMood == "sad":
        girl "What do you want ? It's really not the good day !"
    elif girlMood == "happy":
        girl "Oh, it's you, what do you want ?"
    else:
        return girlIsPresent
    return True
You've less conditional structures availables, yet it's not really something that can't be worked around :
Code:
define girlMoodTree = {
     "bedroom" : 
         { "mad": ( "Go out ! I don't want to see you", False ),
            "sad": ( "What do you want ? It's really not the good day !", True ),
            "happy": ( "Oh, it's you, what do you want ?", True ) },
      }

label bedroom:
    call girlCheck( bedroom )
    $ (  greetings , stay ) = _return
    if  greetings:
        girl "[greetings]"
    if stay is False:
        jump hallway

    "blablabla"

label girlCheck( room ):
    if quest1.started is True:
         call quest1Check
         return _return
    elif room in girlMoodTree and girlMood in girlMoodTree[room]:
         return girlMoodTree[room][girlMood]
    else:
        return ( "", girlIsPresent )
And if you want even more dynamism:
Code:
define girlMoodTree = {
     "bedroom" : 
         { "mad": ( 
                ( "Go out ! I don't want to see you", False ), 
                ( "What the hell ? Out !",  False ) ),
            "sad": (
                ( "What do you want ? It's really not the good day !", True ), 
                ( "I'm not in the mood right now, leave me alone" ), False ) ),
            "happy": ( 
                ( ( "Oh, it's you, what do you want ?", True ), ) },
      }
[...]
label girlCheck( room ):
    if quest1.started is True:
         call quest1Check
         return _return
    elif room in girlMoodTree and girlMood in girlMoodTree[room]:
         return renpy.random.choice( girlMoodTree[room][girlMood] )
    else:
        return ( "", girlIsPresent )
It's not because too few games do it, that it can't be done.



There might be some ways to format things differently in Renpy but I am not that experienced in it to know.
It's not a Ren'py thing, it's a codding one.
Of course there's the intrinsic limitations of the language, but it doesn't mean that none can be bypassed. Just looks at what is available and use it to recreate the behavior of the missing instruction/function.