Suggestions: StrCatChar() function and Game Merge

Started by SSH, Thu 22/04/2004 12:34:09

Previous topic - Next topic

SSH

EDIT: one thread for these two veyr different suggestions

StrCatChar would be handy to have, becuase currently if you want to add a keycode (for example) to a string, you need to do:

      StrCopy(temp, " ");
      StrSetCharAt(temp, 0, keycode);
      StrCat(mystring, temp);


which is a pain!

SUGGESTION 2:

One thing that would be incredibly useful for team development of games would be if there was a merge feature for joining games togetehr. It would also be handy for people who had already started a game but wanted to add in a "saved games with screenshots" template or something.

The principles of merging are: you have three versions: Base, A and B. Base is the common game that both A and B were based on. If there is something changed in A versus Base and nothign has changed in the same place in B versus base then the merged version should have that change added. And vice versa. Finally, if both A and B have changed versus base then there is a conflict that the user needs to resolve manually somehow.

If you've ever used CVS or a more advanced version control system you've probably come across merges. At the moment you could dump out scripts and even use CVS to merge them and re-import, but there are so many objects in AGS that this would exclude: Sprites, GUIS, etc.

It would be a pretty big task to implement, though, I guess. And then there's the CVS / Sourceforge integration to back it up...  ;)
12

strazer

Regarding suggestion 1:
Gilbert would call

StrFormat(temp,"%c",keycode);
StrCat(mystring,temp);

"the hard way". Why, I don't know.
Isn't it supposed to be done this way? Works for me.

stuh505

1) yes...strazer's code is the more normal way.  i don't think there is any necessity for the new function you are asking for...

2) I think merging is a very good idea.  But the hard part is knowing which parts to merge over, and not only would putting that in the hands of the software be difficult to program, but it would also take away control from the user.  Better to just be able to go, "import" and then select a game file, and then select, sprites/characters/GUI's/rooms(with scripts)/global script/game settings/cursors/text words...and then it concatenate any of the new material to what you already had.  

SSH

Strazer's code is a bit shorter (now why didn't I think of that?), but you still have to declare a temp string and it just feels inefficient to me to do that. Oh well, what's another 200 bytes when the whole thing is already 7Meg  just for the demo...

It just struck me that it would probably be pretty easy for our beloved Puma to implement...
12

Pumaman

1. Actually there's an undocumented feature you can use:

StrSetCharAt(mystring, StrLen(mystring), keycode);

ie. if you try to set the character position one after the end of the string, it will append it to the string.
This should really be documented as part of StrSetCharAt.


2. I do like the idea of a diff/merge system, and it could have wider uses than just merging two versions. However, it's really not easy at all to implement, and testing it and working the bugs out would be quite an exercise, since it would have the potential to really corrupt peoples games if there were any glitches.

stuh505

Quote2. I do like the idea of a diff/merge system, and it could have wider uses than just merging two versions. However, it's really not easy at all to implement, and testing it and working the bugs out would be quite an exercise, since it would have the potential to really corrupt peoples games if there were any glitches.

well....if you wanna make money on the newer versions, you're gonna need to add a lot of features like this that aren't available in the freeware version :P

Gilbert

#6
Quote from: Pumaman on Thu 22/04/2004 20:49:50
1. Actually there's an undocumented feature you can use:

StrSetCharAt(mystring, StrLen(mystring), keycode);

A much safer (and more easily understandable) way is:
StrFormat(mystring,"%s%c",mystring,keycode);

right ? ;)

(I'm not sure, but I suppose your way may not work well if the user somehow truncated the string by setting a character to 0, eg.

StrCopy(mystring,"BLAHBLAHBLAH!"); //BLAHBLAHBLAH!
StrSetCharAt(mystring,4,0);//BLAH
//Now suppose keycode=='T'
StrSetCharAt(mystring, StrLen(mystring), keycode);//BLAHTLAHBLAH!

which won't make the string into "BLAHT" as expected, right?)




Pumaman

Quote from: stuh505 on Thu 22/04/2004 21:53:09
well....if you wanna make money on the newer versions, you're gonna need to add a lot of features like this that aren't available in the freeware version :P

Err .. you do realise that thread was an april fool, right? :P

SteveMcCrea in Austin

Gilbot,
Since the StrSetCharAt at the end of a line appends the char, it must put a \0 after the char, so your code would do the right thing.

RE the merging,
I'd love to have more fine-grained import and export options, for example export GUI that doesn't attempt to export any code - just the sprites and the layout - and a view export.

Steve

Pumaman

Quote from: Gilbot V7000a on Fri 23/04/2004 03:12:40
(I'm not sure, but I suppose your way may not work well if the user somehow truncated the string by setting a character to 0,

It's ok because it does append a new 0 as well - this situation is catered for :)

Radiant

As to merging games, isn't it just possible to just take room files from several people, put them all into one directory, and compile the result?

TerranRich

Quote from: Radiant on Mon 26/04/2004 12:55:24
As to merging games, isn't it just possible to just take room files from several people, put them all into one directory, and compile the result?


I think he means for it to go further than that, meaning if you have two of the same room, those would be merged together. Or something like that. I think.
Status: Trying to come up with some ideas...

Pumaman

The game merge feature would be most useful for people working on team games.

The basic idea is that you all take a copy of a common 'baseline' version of the game. Then Person A adds some characters, Person B adds some dialog and Person C imports some sprites.

Then, the three people can 'merge' their modified games back together to create the next baseline.

It would be quite a funky feature to have, and I'd like to do it since it sounds quite challenging - but don't hold your breath.

SMF spam blocked by CleanTalk