playMaker

Author Topic: help for save settings in builded game  (Read 1919 times)

markettounity

  • Playmaker Newbie
  • *
  • Posts: 30
help for save settings in builded game
« on: February 02, 2022, 07:59:24 AM »
Hello guys !!!

First of all sorry for my english , i'm italian :D

I've made a frontend for mame emulator, and i have a script that launch the emulator from a directory on my pc .
On this script i have created 2 float variables with 1- Path of mame emulator and 2- path for roms.

the compiled game works well, but if i use the emulator on another PC the emulation doesn't start because the emulator path on the compiled game is not corresponding with the path on the original machine .

So i have created an input field which allows me to change the directory of the emulator, but when i quit the application i lost the setting, so if i restart again the app i have to rewrite the correct path in the input field ...

QUESTION IS :

how can i SAVE the new location set by input field? What i can do for the app REMEMBER the path ??

i've tried with playerprefs but it didn't works... My idea is to load a string from a TXT file , it is possible ?

thank you for your help and suggestions !!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: help for save settings in builded game
« Reply #1 on: February 04, 2022, 10:43:05 AM »
Hi.
What actions did you use with the input field?

did you use "Ui Input Field Get Text" and then "PlayerPrefs Set String" to save

and when you start the game "PlayerPrefs Get String" and then "Ui Input Field Set Text"

markettounity

  • Playmaker Newbie
  • *
  • Posts: 30
Re: help for save settings in builded game
« Reply #2 on: February 06, 2022, 10:17:46 AM »
Hi  djaydino and thank you for the answer !!

I solved the problem like this :

I've used playPrefs options in playmaker... With the input filed i used "get property " from TEXT in input field... Then stored the result in a variable.

in the same AFM i created a second state within "UI END EDIT" as new transition event.

On second state also "get event String data" and send the variable to "playerPrefs set string" action.

Finally i' ve created a new FSM in player object with "PlayerPrefs get String" and than  i've created "set property" relative at the C# script for launching emulator + romname where the variable connected to the input field is "emulator path" in string format :)

It Works !! :D

If you have some corrections to optimize the process please let me know about ! :D

thanks again ! :D


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: help for save settings in builded game
« Reply #3 on: February 06, 2022, 06:50:20 PM »
Hi.
Quote
I've used playPrefs options in playmaker... With the input filed i used "get property " from TEXT in input field... Then stored the result in a variable.
There should be dedicated actions to get the string from the ui input. (Ui Input Field Get Text)

try minimize using Get/Set Properties as it uses mirroning therefore is slower and you also may have issues if you build to a different platform.
Its main there for 3rd party scripts that do not have actions and if you don't know how to make a custom action.
But in your case it should be fine.

for the Set Property that should be fine, you can try to make a custom action for it, but it should be fine

i never used the "get event String data"  but that should be fine.
i like more to use Get/Set fsm String/Int/Float/Etc. and then send a event.

markettounity

  • Playmaker Newbie
  • *
  • Posts: 30
Re: help for save settings in builded game
« Reply #4 on: February 08, 2022, 09:25:08 AM »
Thank you for your suggestions !!

Using get-set text all the actions are more easy ... Now next step for me is to implement the Mame gamelist.xml file to manage the arcades ... But for now is very difficult for me...

datamaker and management of xml files using playmaker is too hard for me ...



djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: help for save settings in builded game
« Reply #6 on: February 08, 2022, 03:22:46 PM »
Btw i would love to see the result of your project.

i had a self build full size Mame cabinet myself some years ago and I am planning to build one again this year :D

markettounity

  • Playmaker Newbie
  • *
  • Posts: 30
Re: help for save settings in builded game
« Reply #7 on: February 09, 2022, 05:47:58 AM »
hi !!

hahaha !! Ok, how can i show you my work ??

About datamaker, thanks for the tutorials, but it seems to start from an advanced step .... anyway i'm learning about ;)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: help for save settings in builded game
« Reply #8 on: February 09, 2022, 07:44:22 AM »
Hi.
Yeah its a bit intimidating at start.

Feel free to ask, if you have issues.
Also join our Discord channel, we have a friendly and helpful community there :)

to show your work you can make some pictures or a video :)

markettounity

  • Playmaker Newbie
  • *
  • Posts: 30
Re: help for save settings in builded game
« Reply #9 on: February 12, 2022, 07:58:30 AM »
hi djaydino!!

Here some screen from my very preliminary version of Frontend :D

on the 3nd screen you can see the string that appear when i enter the cabinet trigger ... The name of the game is different for every machine.

On the last screen there is the pause menu (appear the menu, but the game is still running on background and i don't know how to stop it and resume when exit from the menu ^_^" ) with the input field to set the path of the emulator ( not yet configured )

Let me know what do you think about if you want...

cheers !

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: help for save settings in builded game
« Reply #10 on: February 17, 2022, 08:52:46 AM »
Hi.
looks  nice!

I believe mame has a 'Pause Button'

maybe you can use a input simulator.
I used this for a project I made for my Launchpad (midi controller)

here's a link to it :
https://www.softpedia.com/get/Programming/Other-Programming-Files/Input-Simulator.shtml#sgal_0

to use it you can use Get/Set properties,make custom actions or get my
'Third party asset actions for PlayMaker'

only thing is probably that when the users would change the keybind to pause.

markettounity

  • Playmaker Newbie
  • *
  • Posts: 30
Re: help for save settings in builded game
« Reply #11 on: February 19, 2022, 09:17:53 AM »
Hi !!
thank you ! i'm very happy that you like my work :D

Maybe i wasn't clear in my explanation ... I need that my Compiled unity application pause when i open the pause menu, not the emulator :D

Now i'm thinking about how to use xml file to create cabinets, but it seems very hard with my actually experience ... For every cabinet i have these components (.obj models created by Cinema4D)

MAIN ARCADE (parent)
  - cabinet ( external cabinet case )
  - Marquee ( Texture .png that changes by name of the roms and point to "marquees" folder in my pc )
  - Bezel ( Texture .png that changes by name of the roms and point to "Bezels" folder in my pc )
  - Screen ( video-player component, loads .mp4 clips that changes by name of the roms and point to "videosnaps" folder in my pc )

For now i worked with "set material texture" and "video player set url" actions that  loads files according to rom name, it works, i have some limitations , like the aspect ratio of the "screen" for videosnaps ... all my videos will stretched on 4:3 proportions , but i want that the aspcet ratio changes according to the porportions of the video. In other words , i want that the program automatically choose the .obj model of the screen for the video player , according to Videosnap.mp4 aspect ratio ...

I think that with your suggestions about XML files solves my problem, but i don't know how to start ... First of all , How can i create the XML File ??

sorry for my questions , i'm learning slowly about unity :D

Like Always , Thank you for your help ! :D