Hi all,
today i worked on the implementation of trust gauges.
I took a broader approach that will give us some flexibility when working on the section later.

I created a table in the database that will hold information about the game's gauges. I also created a small script that will allow us to manage the information in that table.
you can find it here: your_path_to_hackit/admin/gauges.php
In there you can add new gauges and modify existing ones.
This section could be considered a very small stub of the future admin section for the game. By doing this i removed the need to modify and increase the size of the config files for each new gauge (1 gauge has 4 params, which means that for 6 gauges there would have been a total of 24 new lines in the config)

On the user class:
I added functionality that once a user is initialized, it will check to see if the user has all the existing gauges defined. This means that we can add a new gauge at any time and every users that enters the game afterthat will have that gauge active. I added functionality that depletes the points from the gauges as the time passes (according to the parameters defined for each gauge) I added the reward functionality that fills a certain gauge with the number of points specified. If no number of points is specified, the gauge is filled with the default number of points defined in the admin side.

On the front end:
I used Xavier's mission window as a starting point and i made the gauges window similar to it. Right now when you open hackit, there should be 2 "book"icons. One of them opens the missions and the other one opens the gauges window. For sure there could be some improvements on the graphics of the gauges. I think Deborah can give us a hand here.

Mission integration
I added the function give_gauge_reward in the mission abstract class.

An example use case for the whole system will be this:
An editor goes to the gauges admin and adds a new gauge: It specifies the name, how fast it depletes, how many total points, what should be the default refill reward. Once he does this, every user that enters the game will have that gauge on his screen. Then the editor can go and write a mission that uses that gauge: he only has to call the function give_gauge_reward('the gauge name','how many points') in the mission script. Then a user can complete that mission in order to get the reward points and refill its trust gauge.

Note: the admin script is not secured in any way. Basically right now, everybody can go in there and add his own gauges. By no means that script should be on a production server in its current state :-)

Also, i did a make release after i finished, so if you do a make upgrade on your end with the new code, you should be good.

I await your feedback,


Merry Christmas!!

Vlad

_______________________________________________
Farsides mailing list - [email protected]

Wiki:  http://farsides.com/
List:  http://farsides.com/ml/
Forum: http://farsides.com/forum/
Ideas: http://farsides.com/ideas/
Chat:  http://farsides.com/chat/

Reply via email to