SFML community forums

General => SFML projects => Topic started by: Parsley on October 18, 2017, 02:05:32 pm

Title: This Grand Life
Post by: Parsley on October 18, 2017, 02:05:32 pm
Hey everyone,

I've been working on a project using SFML for a while now, and didn't realize this subforum for our projects existed here! It's written in C++, I use all the SFML modules except networking and also use SFGUI for the user interface.

My project is This Grand Life, a personal finance simulator where you create a character, manage their money and help them achieve their life goals.

You can download a demo from Itch.io (https://pokingwatergames.itch.io/this-grand-life) or IndieDB (http://www.indiedb.com/games/this-grand-life/downloads).

It's also going to be coming to Steam (http://store.steampowered.com/app/695600/This_Grand_Life/) on 23rd October, 2017.

This Grand Life (https://www.youtube.com/watch?v=3lfXpxK-j2s)

Here's a list of features and screenshots:

(http://pokingwatergames.com/wp-content/uploads/2017/10/20170910-PaintHome2c-1024x576.png)


(http://pokingwatergames.com/wp-content/uploads/2017/03/20170329-Home.gif)


(http://pokingwatergames.com/wp-content/uploads/2017/03/20170311-SydneyBeforeAfter.gif)


(http://pokingwatergames.com/wp-content/uploads/2017/06/20170701-UniScreen-1024x576.png)


(http://pokingwatergames.com/wp-content/uploads/2017/03/20170329-Work.gif)


(http://pokingwatergames.com/wp-content/uploads/2017/05/201705014-NapoleonCatTax.png)


(http://pokingwatergames.com/wp-content/uploads/2017/05/201705021-Possessions.png)


(http://pokingwatergames.com/wp-content/uploads/2017/05/201705026-Jewellery-Collection-1-1024x576.png)


(http://pokingwatergames.com/wp-content/uploads/2017/05/20170604-Subscriptions.png)


(http://pokingwatergames.com/wp-content/uploads/2017/05/201705021-Mortgage.png)


(http://pokingwatergames.com/wp-content/uploads/2017/05/201705021-RentOut.png)


(http://pokingwatergames.com/wp-content/uploads/2017/05/201705014-NapoleonIncStatement.png)


(http://pokingwatergames.com/wp-content/uploads/2017/03/20170320-ChooseProfile.png)


(http://pokingwatergames.com/wp-content/uploads/2017/03/20170322-TutorialSmall.png)

If any of you have played Jones In The Fast Lane, it is my inspiration for creating This Grand Life!

Steam (http://store.steampowered.com/app/695600) | Itch.io (https://pokingwatergames.itch.io/this-grand-life) | Twitter (https://twitter.com/ParsleyPWG) | Website (http://pokingwatergames.com/)
Title: Re: This Grand Life
Post by: Rosme on October 18, 2017, 02:59:30 pm
Love the artstyle and music. Looks great! Good job! You should contact SFML Projects (https://sfmlprojects.org/) to have more visibility!
Title: Re: This Grand Life
Post by: Parsley on October 18, 2017, 03:30:20 pm
Thanks, I'll get in contact with that SFML Projects as well!
Title: Re: This Grand Life
Post by: FRex on October 18, 2017, 07:28:08 pm
The skin you've written for SFGUI looks lovely and so does all the other art. By the way, SFGUI Windows have a has a close button that you can enable too.
Title: Re: This Grand Life
Post by: Mario on October 18, 2017, 07:50:26 pm
Awesome, the UI style reminds me a lot of Sim City 3000. Any chance for rounded edges? :)
Title: Re: This Grand Life
Post by: eXpl0it3r on October 18, 2017, 11:55:32 pm
Looks great! :)

And it's really awesome to see SFGUI used in such a project.

Btw. is Tribe Of Pok also built with SFML?
Title: Re: This Grand Life
Post by: Parsley on October 19, 2017, 12:02:42 am
@FRex I've actually got about 20 different skins/themes which I've defined in a .txt file, and each location has a unique skin. It takes a long time to load them all (about 75% of startup time) but is worth it in the end! I did try using the built-in close button initially but from memory I ran into trouble with it. I think it was 'sticky' or maybe didn't feel like I was clicking it when I thought I did or something? I ended up rolling my own close that I can just Pack() in anywhere.

@Mario I'm not sure there's rounded edge functionality in SFGUI, at least I haven't encountered it.

@eXpl0it3r Yes Tribe Of Pok also used SFML, I totally forgot. I didn't use SFGUI though, I rolled my own UI and it was a nightmare!
Title: Re: This Grand Life
Post by: Sub on October 20, 2017, 12:11:58 am
Don't really have much to say other than that this looks great.  It reminds me a bit of the game Drug Wars which I had a ton of fun with when I was younger.  Keep it up :)

edit:  Any chance this will also come out for Linux when it's done?
Title: Re: This Grand Life
Post by: Parsley on October 20, 2017, 01:56:13 am
Thanks for the kind words. I've never used Linux before or ported to it so have no idea how hard it would be. I know SFML is compatible so at least that angle's covered. If the game gets popular enough I might look into it, but at the moment there's no plans for anything other than Windows PC.
Title: Re: This Grand Life
Post by: Sub on October 21, 2017, 12:51:32 am
Fair enough.  Not a huge deal, I just downloaded the demo and it seems to work perfectly on wine. 

It's pretty cool.  Music actually reminds me of the sims, which seems appropriate.  Only suggestion I have is that it'd be awesome if the game were playable through a keyboard or controller.  Like when a new dialogue comes up, it'd be nice if it had focus so you could press enter to close it rather than having to move the mouse over. 
Title: Re: This Grand Life
Post by: Parsley on October 21, 2017, 09:47:39 pm
I hadn't thought about using the enter key to close the popup windows, I'll look into that  :)
Title: Re: This Grand Life
Post by: Tank on October 23, 2017, 09:48:38 am
This looks indeed like a cool classic tycoon game, congrats on the release!

And of course I'm very happy to see SFGUI being extensively used in a finished product, that's really nice.

Quote
It takes a long time to load them all (about 75% of startup time) but is worth it in the end!
Mind sharing the template files with me? I'm sure it can be optimized.
Title: Re: This Grand Life
Post by: Parsley on October 23, 2017, 10:52:26 pm
Hi Tank, thanks for making SFGUI, it's really great and made the UI aspects so much easier to handle!

I have attached the theme.txt, where each of the theme IDs are grouped together. I'm loading it using:

desktop.LoadThemeFromFile("theme.txt");

The above part takes maybe 50% of the time (very roughly). Then for each theme ID in that file I call the below SetGenericDesktopSettings for the font size, which takes maybe 25% of the time. I set the font size in the app rather than the .txt file because it can change depending on the player's settings.

SetGenericDesktopSettings(sfg::Desktop& desktop, std::string id)
{
    //Widget types
    std::vector<std::string> widgets;
    widgets.push_back("Button");
    widgets.push_back("Label");
    widgets.push_back("Frame");
    widgets.push_back("Entry");

    std::vector<std::string>::iterator itW = widgets.begin();
    while(itW != widgets.end())
    {
        //Set font sizes
        std::string fontStr = *itW + "#" + id + *itW;
        std::string largeFontStr = *itW + "#" + id + "Large" + *itW;
        desktop.SetProperty(fontStr, "FontSize", m_imageM->GetDefaultCharSize());
        desktop.SetProperty(largeFontStr, "FontSize", m_imageM->GetDefaultLargeCharSize());

        ++itW;
    }
}

Sorry I can't provide a complete example, the way I load the theme ID strings is a bit more complicated and too large to paste here.
Title: Re: This Grand Life
Post by: binary1248 on October 24, 2017, 02:37:45 am
SFGUI theme loading is a bit "suboptimal". It causes a widget hierarchy refresh for every statement read from the file, which given a big enough file and enough widgets can lead to a lot of waiting.

Either load the theme file and set the font sizes before creating all your widgets or manually take care of refreshing once you know you are done. Something like this:
#include <SFGUI/Engines/BREW.hpp>

...

class MyOptimizedBREW : public sfg::eng::BREW
{
public:
        void SetAutoRefresh( bool enable ) { sfg::eng::BREW::SetAutoRefresh( enable ); }
};

...

desktop.UseEngine<MyOptimizedBREW>();

...

MyOptimizedBREW& engine = static_cast<MyBREW&>(desktop.GetEngine());
engine.SetAutoRefresh(false);
desktop.LoadThemeFromFile("theme.txt");
SetGenericDesktopSettings(desktop, ...);
engine.SetAutoRefresh(true);
sfg::Widget::RefreshAll();
Title: Re: This Grand Life
Post by: Parsley on October 24, 2017, 04:03:04 am
Thanks binary1248, I'll have a look into disabling the refresh!