[project1dev] Re: Project1 - SVN Update 754

  • From: Kent Petersen <kentkmp@xxxxxxxxx>
  • To: project1dev@xxxxxxxxxxxxx
  • Date: Fri, 21 May 2010 10:21:34 -0700

Yeah sounds right.

On Fri, May 21, 2010 at 10:18 AM, Alan Wolfe <alan.wolfe@xxxxxxxxx> wrote:

> i would just include it into the main menu code
>
> then when they click "main game" (new game) it would call the
> gamevars_clear function (that was defined in gamevars.lua).  That function
> would do a data_clearvars() to kill all global variables, then it would have
> a data_createvar() for each global variable the game uses.
>
> since those functions dont exist yet, i think gamevars_clear for now should
> just set some starting value to each global variable used in the game.  Like
> it would set health to 100 or whatever the starting health is.
>
> sound right to you?
>
>
> On Fri, May 21, 2010 at 9:59 AM, Kent Petersen <kentkmp@xxxxxxxxx> wrote:
>
>> I think that would cover it. How would you implement gamevars.lua. Would
>> you just add an include for it in the config lua?
>>
>>
>> On Fri, May 21, 2010 at 9:08 AM, Alan Wolfe <alan.wolfe@xxxxxxxxx> wrote:
>>
>>> cool deal.
>>>
>>> I'm also thinking that...
>>>
>>> #1 - We need a Data_ClearVars() function which will delete all global
>>> variables.  We would call this before loading a game or creating a new game
>>> to make sure no values persisted from one game to another that shouldn't be
>>> there.
>>>
>>> #2 - We need a function Data_CreateVar which you have to do before you
>>> can read or write to any variable.  If you try to use a variable without
>>> creating it, it will throw an error.  I figure we should make a rule that we
>>> are only allowed to use this function inside of gamevars.lua, specifically
>>> in the Gamevars_Clear() function.  This makes it so all global game
>>> variables are declared in one space, and if we mis type a variable name or
>>> try to use a variable that doesn't exist, it will throw an error and we'll
>>> see it.
>>>
>>> #3 - We'll need a Data_Save and Data_Load function for saving and loading
>>> games, but i'm thinking those guys will take a save game name and a version
>>> number.  This way, if you do something to the scripts like add or remove a
>>> global variable, and the save game data is no longer compatible with the
>>> script, you can increment the version number so that Data_Load will return
>>> failure if you try to load a save game of the wrong version number.
>>>
>>> I put these guys on the coding todo list
>>>
>>>
>>> On Fri, May 21, 2010 at 8:35 AM, Kent Petersen <kentkmp@xxxxxxxxx>wrote:
>>>
>>>> Ok, yeah that makes sense.
>>>>
>>>> On Fri, May 21, 2010 at 8:25 AM, Alan Wolfe <alan.wolfe@xxxxxxxxx>wrote:
>>>>
>>>>> hrm how about making a file, something like "gamevars.lua" and when
>>>>> they click "main game" on the main menu (which should be "new game"
>>>>> eventually hehe) it calls some function from that file such as
>>>>> GameVars_Clear() which initializes all the game vars to sane values?
>>>>>
>>>>>
>>>>> On Fri, May 21, 2010 at 7:54 AM, Kent Petersen <kentkmp@xxxxxxxxx>wrote:
>>>>>
>>>>>> Think I should put the health variable in the ui.lua or what then? It
>>>>>> only made sense to me to put it in the config.lua
>>>>>>
>>>>>>
>>>>>> On Thu, May 20, 2010 at 9:44 PM, Alan Wolfe <alan.wolfe@xxxxxxxxx>wrote:
>>>>>>
>>>>>>> oh...  config.lua is a special case lua file, it doesnt have access
>>>>>>> to all the functions that the other scripts have
>>>>>>>
>>>>>>> the reason is, it runs that file before anything about the engine is
>>>>>>> set up.
>>>>>>>
>>>>>>>
>>>>>>> On Thu, May 20, 2010 at 9:41 PM, Kent Petersen <kentkmp@xxxxxxxxx>wrote:
>>>>>>>
>>>>>>>> Bug? I don't think global variables are working. Check the config
>>>>>>>> lua
>>>>>>>>
>>>>>>>>
>>>>>>>> On Thu, May 20, 2010 at 9:40 PM, Apache User <
>>>>>>>> dhapache@xxxxxxxxxxxxxxxxxxx> wrote:
>>>>>>>>
>>>>>>>>> User:korgath
>>>>>>>>>
>>>>>>>>> Message: I thought I checked in these files but it looks like I
>>>>>>>>> didn't so I'm checking them in again. Sorry if I did once already
>>>>>>>>>
>>>>>>>>> --tried creating global variable for life but it doesnt seem to
>>>>>>>>> work
>>>>>>>>> --added life ui to main map (once again life value doesnt work)
>>>>>>>>> --updated bat hold to pop out bats at a different rate
>>>>>>>>> --fixed a type on bat
>>>>>>>>> --fixed a typo on trollhut
>>>>>>>>>
>>>>>>>>> <Files Changed>
>>>>>>>>> U   ActRaiser/Scripts/Enemies/OverWorld/Bat.lua
>>>>>>>>> U   ActRaiser/Scripts/Enemies/OverWorld/BatHole.lua
>>>>>>>>> U   ActRaiser/Scripts/Enemies/OverWorld/TrollHut.lua
>>>>>>>>> U   ActRaiser/Scripts/GameOverworld/UI.lua
>>>>>>>>> U   ActRaiser/Scripts/config.lua
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ==============================
>>>>>>>>> Project 1 Dev mailing list
>>>>>>>>> to unsubscribe, please send an email request to
>>>>>>>>> demofox@xxxxxxxxxxx
>>>>>>>>> Project 1 website: http://project1.demofox.org
>>>>>>>>> Project 1 SVN repository: http://pyotek.com/project1
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Other related posts: