Author Topic: i hate defines.txt!!  (Read 4267 times)

0 Members and 1 Guest are viewing this topic.

brian corr

  • Guest
i hate defines.txt!!
« on: December 16, 2001, 09:50:48 PM »
because if you change it u have to recompile EVERY logiC!!

so im doin sumthin bout it. im gonna remake the template game so that it doesnt use a text file it uses a logic.

so there
« Last Edit: December 31, 1969, 07:00:00 PM by 1018072800 »



Offline Chris Cromer

Re: i hate defines.txt!!
« Reply #1 on: December 17, 2001, 12:25:16 AM »
Hey thats a great idea I think I might do that with my templates on my web site. Do you mind if I use this idea in my templates?
« Last Edit: December 31, 1969, 07:00:00 PM by 1018072800 »
Chris Cromer

It's all fun and games until someone get's hurt then it's just fun. ;)

Offline Nailhead

Re: i hate defines.txt!!
« Reply #2 on: December 17, 2001, 08:56:47 AM »
That is a pretty cool idea.
« Last Edit: December 31, 1969, 07:00:00 PM by 1018072800 »

brian corr

  • Guest
Re: i hate defines.txt!!
« Reply #3 on: December 17, 2001, 06:22:56 PM »
sorry guys, it wont work - defines cant be called in a separate logic because hey only work for the logic theey are defined in. thats the point of the txt file ,it puts them in every logic...so having a new logic with them in wont help.

*sniff*

doesnt really bug me though cos i dont use those defines anyway, in fact i dont use any defines, i think its easier that way


but feel free to try and et it working if you want
« Last Edit: December 31, 1969, 07:00:00 PM by 1018072800 »

Offline Chad Goulding

Re: i hate defines.txt!!
« Reply #4 on: December 18, 2001, 12:31:24 AM »
I think if you change the defines.txt file you don't have to recompile every logic manually since you can just rebuild all the vol files (which should only take a few seconds). I presume doing that recompiles every logic in the game and saves a *lot* of hassle.
« Last Edit: December 31, 1969, 07:00:00 PM by 1018072800 »

Offline Chris Cromer

Re: i hate defines.txt!!
« Reply #5 on: December 18, 2001, 01:55:50 AM »
That is the problem I ran into when trying it. So I just decided not to bother with the defines.txt in the templates
« Last Edit: December 31, 1969, 07:00:00 PM by 1018072800 »
Chris Cromer

It's all fun and games until someone get's hurt then it's just fun. ;)

Offline Joel

Re: i hate defines.txt!!
« Reply #6 on: December 19, 2001, 08:35:02 AM »
You only have to recompile all the logics if you change the var numbers around.

For example, if your defines.txt looks like this:

#define fSomeFlag f100

And your logic 2 looks like this:

set(fSomeFlag);

If you change the defines.txt file to:

#define fSomeFlag f101

then you will have to recompile logic 2 because fSomeFlag now refers to f101 -- if you use fSomeFlag in logic 3 without recompiling logic 2, then logics 3 and 2 will be working with different flags (100 for logic 2 and 101 for logic 3), but if you change the defines.txt file to:

#define fSomeFlag f100
#define fSomeOtherFlag f101

then you do not have to recompile logic 2 because fSomeFlag is still defined as f100. If you add logic 3 that says:

reset(fSomeFlag);
set(fSomeOtherFlag);

then your code will work fine without recompiling logic 2.

Personally, I don't see how anybody can stand working without defines.txt, but I guess if you can work without symbolic names good for you.
« Last Edit: December 31, 1969, 07:00:00 PM by 1018072800 »

Offline Joel

Re: i hate defines.txt!!
« Reply #7 on: December 19, 2001, 08:39:35 AM »
To state that a little more simply: you have to recompile the logics if you CHANGE the value of a #define that was already in defines.txt. You do NOT have to recompile all the logics if you simply ADD a new #define.
« Last Edit: December 31, 1969, 07:00:00 PM by 1018072800 »

Offline Chris Cromer

Re: i hate defines.txt!!
« Reply #8 on: December 19, 2001, 10:54:06 AM »
There is a way to not use defines.txt try defining names in the logic you want to use it in. Example:

Logic 2:

#define door o1
#define door_open F100
#define door_not_open F101

if (new_room) {
 new room stuff here
 set(door_not_open);
}

if (said("open", "door") && door_not_open) {
 end.of.loop(door,door_open);
 reset(door_not_open
}

if (said("close", "door") && door_open) {
 end.of.loop(door,door_not_open);
 reset(door_open);
}

return();

Who needs defines.txt when you can do it like this.
« Last Edit: December 31, 1969, 07:00:00 PM by 1018072800 »
Chris Cromer

It's all fun and games until someone get's hurt then it's just fun. ;)

Offline Joel

Re: i hate defines.txt!!
« Reply #9 on: December 19, 2001, 05:19:14 PM »
That's fine for local variables but if you wanted to change the value of a global define then it would be even more inconvenient than recompiling all the logics.
« Last Edit: December 31, 1969, 07:00:00 PM by 1018072800 »

Offline Nick Sonneveld

Re: i hate defines.txt!!
« Reply #10 on: December 19, 2001, 06:15:59 PM »
I think the whole point is, if it's a GLOBAL define then you'll have to compile it all anyway to make sure a variable isn't defined as something else

separate your defines into sections like global.txt, ego.txt, act1.txt, act2.txt, island.txt, debug.txt, intro.txt, endgame.txt, door.txt

depending on how your game is laid out.  For logic in certain sections of a game, just include act1.txt or something like that.  If you want to use some door code, include door.txt. Only put in real global definitions into global.txt (ie, the system vars/flags)

That way, if you change or add a variable to just the intro section.. you'll only have to recompile all the logics that have included intro.txt

- Nick
« Last Edit: December 31, 1969, 07:00:00 PM by 1018072800 »
Nick Sonneveld  |  AGI Dev  |  NAGI

brian corr

  • Guest
Re: i hate defines.txt!!
« Reply #11 on: December 19, 2001, 06:27:20 PM »
i dont understand how anyone CAN work with defines.txt

maybe sum1 should write a new one, with SHORTER defines.

i mean, "ego_touching_signal_line"?
peter kelly, what were you thinking.

i reckon its easier to remember "f3" than "ego_touching_signal_line", dont you?

and if youre unsure, check the help file



brian
« Last Edit: December 31, 1969, 07:00:00 PM by 1018072800 »

Offline Chris Cromer

Re: i hate defines.txt!!
« Reply #12 on: December 19, 2001, 06:40:09 PM »
I already knew about the define being a local thing. I was just giving an example of it.

Quote
i dont understand how anyone CAN work with defines.txt

maybe sum1 should write a new one, with SHORTER defines.

i mean, "ego_touching_signal_line"?
peter kelly, what were you thinking.

i reckon its easier to remember "f3" than "ego_touching_signal_line", dont you?

and if youre unsure, check the help file


I can update my templates and the help file so that it could be shorter. But is it just you wanting this or does other people want this
Chris Cromer

It's all fun and games until someone get's hurt then it's just fun. ;)

brian corr

  • Guest
Re: i hate defines.txt!!
« Reply #13 on: December 19, 2001, 10:44:08 PM »
i dont particularly want it cos i dont use defines neway but i think having mega-long defines defeats the purpose of the define - i used to use it and they were so long i had to check whta they were all the time.

so, the question.... WHO WANTS A NEW DEFINES.TXT???
« Last Edit: December 31, 1969, 07:00:00 PM by 1018072800 »

Offline Joel

Re: i hate defines.txt!!
« Reply #14 on: December 20, 2001, 07:33:42 AM »
I agree with you that some of the define names are ridiculously long. I also hate underscores in my variable names and I prefer prefixing my variable names with an abbreviation of their data type.

It's also fine to use f3 in place of ego_touching_signal_line...I do it sometimes myself. However, in a full scale game where you've got hundreds of variables and flags to keep track of, I find symbolic names much easier than keeping some kind of look-up table. That way I can come back to my code later and simply look at it and realize what it's doing. Otherwise I have to go into detail reading my comments or going to a look-up table.

As for recompiling...I would not at all recommend placing "local" type variables in defines.txt. I sure don't do it. But in any case, you do not AT ALL have to recompile all your logics if you go into defines.txt and add a new define name. You only have to recompile all your logics if you change an existing one. How often do you really do that? I hope it's not often, or you need to organize yourself better before starting the programming portion of your project.

There's only been one time I've had to recompile all my logics -- when I re-organized myself and set everything up so that all the vars and flags numbered below 200 were for global use and everything 200 and above was for local use. If I go in and add a new flag called fPlayerHasCompletedPuzzleX then I don't need to recompile all the logics.

If you're worried about name conflicts then just prefix all your global variables with "g_" or something.

There are ways to have defines.txt and keep things simple, too. Believe me, simplicity is my greatest concern when I program. Regardless, as updates to AGI Studio are made, there will be Recompile All functionality that will save the hassle of recompiling all the logics when you change (not add) a define to defines.txt. The Windows Linux AGI Studio already has this function, I think.

Nick's suggestions are good, too. Breaking code up into chunks and not putting it all in one place makes it even easier to handle.
« Last Edit: December 31, 1969, 07:00:00 PM by 1018072800 »


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.023 seconds with 15 queries.