YesNoOk
avatar

Region tags, Git and Git hooks for MUGEN development (Read 20998 times)

Started by Jesuszilla, October 11, 2016, 05:40:27 pm
Share this topic:
Region tags, Git and Git hooks for MUGEN development
#1  October 11, 2016, 05:40:27 pm
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
Hello everybody!

As I mentioned in my WIP thread a few days ago, I've been experimenting with the idea of using Git for MUGEN version control. This has several advantages:

1. You can see exactly what was updated in each commit. No more forgetting what you updated!
2. You can tag commits as version numbers. No need for readme changes for version numbers (unless you want them to automatically go there, then use a Git hook!)
3. Users who prefer older versions can download the older version they prefer, or, if you made a change you don't like, you can revert it to the older version.

The only problem is, MUGEN isn't very object-oriented. You can only override entire states. That's why I came up with region tags. How do they work? Simple: you specify them as follows:
Code:
;#region file.txt
;#endregion

This would take the contents of file.txt and replace the region between the two tags with the contents of file.txt. This is really handy for coders whose systems have a lot of heavy -2 code with no changes, so hey can define the regions that rarely ever change except during system update time, so they never forget to replace that region. If you put it in its own subrepository (aka a submodule) in the character folder and set up the script as a Git hook in post-commit for example, those files are pulled into the regions before you commit, meaning they get updated along with your other updates. You can also define it as a post-merge hook so it updates every time you pull a newer version.

You can run the script on its own too, of course, if that makes you more comfortable and you don't want to learn Git just yet, but anything that speeds up your process so you can do more of the things you want to make, the better, right? :)

Link to the script is here https://github.com/Jesuszilla/Misc-Scripts/blob/master/regionreplace.py

You will need Python 2.7. For proper Git hook support, I recommend Bash on Ubuntu on Windows for Windows 10 users in the Insider Program, or MinGW for other Windows users.

If you want me to teach Git, I will be glad to write a tutorial! I taught it to my entire office, I can teach it to you guys! :)


Other uses:

Having files dedicated to triggers for names. For instance, Benimaru has intros against women. With Git, users can contribute to a repository that contains triggers for women. Bluestreak has an intro against superheroes and super villains, so users can add more names to that list. Creators themselves can add names for their own characters! Then if your character ever has an intro like one of these, you just include the repo by cloning it and add the file using the region tags! It will get updated every time you update your character! Pretty cool, huh?
Last Edit: October 11, 2016, 06:05:05 pm by Jesuszilla
Re: Region tags, Git and Git hooks for MUGEN development
#2  October 11, 2016, 08:33:39 pm
  • ******
    • www.justnopoint.com/
This will be super helpful with my DS project! Too bad it wasn't around when I started a HDBZ char from scratch
Re: Region tags, Git and Git hooks for MUGEN development
#3  October 13, 2016, 07:54:46 pm
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
Just throwing in some thing to test later

I've yet to test if it works with nested region tags, come to think of it. If I recall, they're found in order, so nesting should work as it is.

So if you modify the script correctly, you could even have character-specific things in their own files as well which could be included in the system code imported from another file.

e.g
;#region special_template.cmd
[State -1, ChangeState]
value = 1000
triggerall = command = "x"; this could even do a lookup to automatically convert it to the corresponding variable in the buffering system!
;#region special_specific_triggers.cmd
;#endregion
;#endregion


Of course maybe stuff like this is better suited for JSON and string formatting.... hmmmm, yes, a CNS compiler... I recall [E] or Insanius working on such a tool. But let's not get ahead of ourselves...
Re: Region tags, Git and Git hooks for MUGEN development
#4  October 13, 2016, 11:13:03 pm
  • ******
  • [E]
    • Mexico
it's ben almost 10 years, but I made a tool that did similar things to what the github thing does, minus being abel to use verison or upload/share stuf, etc... iirc it used constants and allowed you to define parents for sctrls.tho I migth be confusing parts of that with a scripting system I made more recently that also supports parents for sctrls
Re: Region tags, Git and Git hooks for MUGEN development
#5  October 14, 2016, 05:59:06 pm
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
Well it's not up on GitHub yet, but those following this should be excited to know that nested region tags work now!

They work with innermost tags having the highest priority. What does this mean?


Say you have:

Test.txt
Code:
Mission start
;#region test2.txt
Hello!
;#region test3.txt
This is a test!
;#endregion
;#endregion

test2.txt:
Code:
This is getting overwritten!
;#region test3.txt
But what about this?
;#endregion

test3.txt:
Code:
Nope! Not at all!


Then when you run the script on Test.txt, it will look like this:

Code:
Mission start
;#region test2.txt
This is getting overwritten!
;#region test3.txt
Nope! Not at all
;#endregion
;#endregion
Re: Region tags, Git and Git hooks for MUGEN development
#6  July 26, 2017, 06:13:58 am
  • avatar
    • China
I hope my English can speak well
This is a good idea, but how does it apply to the character,automatically
Re: Region tags, Git and Git hooks for MUGEN development
New #7  September 14, 2017, 03:17:03 am
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
The script does it when you put it in your git hook.


Also major bump. Need a host AND want to manage source code? GitHub may have you covered.


I asked them if it would be OK to host such content, and while this isn't a solid "yes," it does certainly imply that GitHub itself has no problem hosting the content. However, as I mentioned in the comments, they are required to comply with any takedown notice, so use at your own discretion. But as history has shown, the two big companies, Capcom and SNK, have no intention of issuing such notices. You're risking it with Nintendo, though I've seen a couple Pokémon fan games also have GitHub repos with ripped sprites as tiles.


TL;DR GitHub is a valid host, and probably better than MediaFire and all that crap because you also have the added benefit of version control.



So what does this mean?
  • If you use it as intended, you'll have a full history of your versions, line-by-line.
  • You can have tagged versions to look back upon.
  • You can use region tags like this topic originally presented.
  • You can package certain commits as release versions.
  • Users can download the latest update of your character/stage/etc. just by typing in "git pull," even if it's a WIP.
  • Your users don't have to (re)download your entire SFF just because you updated the CNS, nor do you have to keep up with patches or deal with long upload times if you didn't change any large files. Again, a "git pull" is all that is necessary for them to do, and a "git commit" + "git push" is all you need to do.
  • Other people can submit to you pull requests for fixes for issues they've found, if they're nice enough and you approve of said changes.
  • Your code is hosted on a trusted site that probably isn't going anywhere anytime soon.
Last Edit: September 14, 2017, 03:30:17 am by Jesuszilla