Jump to content


How to I get started creating patches?


  • Please log in to reply
10 replies to this topic

#1 Michkov

Michkov

    Member

  • Member
  • PipPip
  • 15 posts
  • Gender:Male

Posted 17 January 2018 - 05:06 PM

I'd be interested in learning how to create patches maybe physics down the line. Now I've looked into the xml files that come with the mods but they are unintelligible from where I sit now. Is there some kind of manual? Or does one need to do an apprenticeship with one of the current coders?

#2 ginetto

ginetto

    Master Tracker

  • Administrators
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 8,794 posts
  • Gender:Male
  • Location:Lombardia ITALIA

Posted 17 January 2018 - 05:59 PM

I never understood how they works; I guess you need some basics in computer programming which I don't have.
For sure there are people that can give a better answer though, let's see if they pop in :)

Done these tracks and working on others.


#3 Lee

Lee

    Honored Member

  • Member
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 7,780 posts
  • Gender:Male

Posted 23 January 2018 - 07:46 PM

Michkov, do you have any programming experience and if so, which languages?

#4 Michkov

Michkov

    Member

  • Member
  • PipPip
  • 15 posts
  • Gender:Male

Posted 24 January 2018 - 06:14 AM

Let's call it lower mid level, mostly data analysis and a small amount of simple simulations in Matlab and Python. Wee amount of Javascript as well.

#5 Lee

Lee

    Honored Member

  • Member
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 7,780 posts
  • Gender:Male

Posted 24 January 2018 - 10:29 AM

The patches are in assembly language which is why I asked.

It took me about a year to become proficient in writing assembly language patches.  I had been programming in Visual Basic for years prior to that so already knew a good bit about writing code.

I've heard of Mathlab, Python, and Javascript, of course, but have no idea if they could be used to output assembly language code that is needed for a patch.

I think it is possible to output assembly code from C, but have never done it myself.

Edited by Lee, 24 January 2018 - 02:25 PM.


#6 sky

sky

    ultra highres junkie

  • Member
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 3,113 posts
  • Gender:Male
  • Location:Krautlandia

Posted 24 January 2018 - 12:09 PM

Of all the programming languages I have learned (and forgotten) assembler ranks #1 in terms of potential
speed but also #1 in terms of difficulty, especially for logic. So absolute kudos to you, Lee, for doing the
patches in assembler.
Back in the day when I was still involved in the (computer) demo scene on PC (mid to late 1990s) we used
to do the logic with C or some other high level language and the actual pixel output via assembler inserts
within routines... Mode 13h, ah memories from a long distant part of my um youth I suppose

mov ax, 13h
int 10h

bam 320x200 x 256 colours video mode entered

#7 Lee

Lee

    Honored Member

  • Member
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 7,780 posts
  • Gender:Male

Posted 24 January 2018 - 02:03 PM

You're right Roman...assembly language is the way to go for fastest speed, but there is huge learning curve as you have to pay much more attention to memory usage than you do with a higher level language.  I still have problems writing a new patch as I don't fully understand the .xml file format that allocates and uses runtime memory.  Nigel did of course, but he left before I got around to learning assembly and writing patches so it's all been trial and error...mostly error.

If Nigel hadn't left, I never would have bothered and wouldn't have lost much of the last 8 years of my life trying to get silly little patches to work.  :)

I can read C and normally understand the code, but have never programmed in it so I envy you for knowing how.  I believe Nigel probably used C as his patches are much too complex to write in assembly.

Michkov, I'm not trying to discourage you from learning how to write patches, but it's a very complicated subject, there is no tutorial, and you must have a good general knowledge of how to write complex programs to start.  Then you have to be reasonably proficient in assembly language which is another hurdle to cross entirely.

Without trying to brag, I think I've already written patches that address most of GPL's biggest shortfalls...at least to some extent.  I've been reading the "wish list" that others are wanting at SRMZ, and quite honestly, there is no way that most of those wishes could ever be done as they are much too complex.  Even a professional, full time programmer would have difficulty doing that.  Unless someone comes along like Nigel who wants to spend every waking minute for the next several years working only on GPL, we will just have to be happy with what we've got.

Edited by Lee, 24 January 2018 - 02:19 PM.


#8 Michkov

Michkov

    Member

  • Member
  • PipPip
  • 15 posts
  • Gender:Male

Posted 03 February 2018 - 10:31 PM

I'm still here, apologies for the radio silence, had a busy week.

If you are doing all this with trial and error and little understanding it makes the things your patches do even more impressive. I never imagined it being easy, but that there was at least some documentation.

I'm under no delusion that learning this skill will be easy. Still I consider myself stubborn enough to get something rigged together. That is if you indulge me and my stupid questions that will surely come up.

Let's start with an easy one. Are you directly writing the xml files or is there some source code that gets fed into some sort of compiler?

Also what assembly language are we talking about here, there seem to be different varieties.

#9 Lee

Lee

    Honored Member

  • Member
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 7,780 posts
  • Gender:Male

Posted 04 February 2018 - 07:04 AM

I use the freeware Go assembler available here to produce the COFF files:

http://www.godevtool.com/

I wrote my own loader program in VB to convert the COFF files to the format needed by an .xml patch.

Now before you start all this, we need to address the elephant in the room.  You can't write a patch to the GPL code unless you have some idea of what the code lines do.  There are over a million lines of code in the gpl.exe and they are all in assembly language.  We don't have GPL's original source code which was probably written in C or some other high level language and then compiled to machine language.

So to have any hope of writing a patch to the code, you need a detailed explanation of the assembly code...I like to call this the roadmap.  I didn't write the roadmap...it's far too complicated for my limited programming skills and took years of reverse engineering by others to develop.

It may surprise you that only a handful of people have access to the roadmap and none, other than myself, write patches.  This information is closely held because it contains information about how to modify gpl's physics.  If someone were unscrupulous, they could use the roadmap to change constants or write patches that modified the code's logic to cheat.

One of GPL's strengths has been that the physics cannot be easily modified without some knowledge of the roadmap.

We have a small group of trusted modders now, maybe two dozen, but the vast majority don't have access to the roadmap.  I will not give out the roadmap without permission from the others who do.

I'm not saying at all that you would write patches to cheat so please don't misunderstand me.  Your interest about getting into patch madness is a good thing, you've been around GPL for long time now, and have earned a measure of trust already, but the best way to gain access to the roadmap is to work on a mod team doing other stuff for a while before being handed the secret keys to the city.  In the meantime, you could learn assembly language.  :)

This is not meant as any disrespect to you, but I think it's important for you to know what you're getting into and what you're asking for.

Edited by Lee, 04 February 2018 - 07:11 AM.


#10 Michkov

Michkov

    Member

  • Member
  • PipPip
  • 15 posts
  • Gender:Male

Posted 14 February 2018 - 11:23 AM

View PostLee, on 04 February 2018 - 07:04 AM, said:

I'm not saying at all that you would write patches to cheat so please don't misunderstand me.  Your interest about getting into patch madness is a good thing, you've been around GPL for long time now, and have earned a measure of trust already, but the best way to gain access to the roadmap is to work on a mod team doing other stuff for a while before being handed the secret keys to the city.  In the meantime, you could learn assembly language.  :)

Allright, I'll familiarize myself with assembly. In the mean time how does one join the mod team(s)?

#11 Lee

Lee

    Honored Member

  • Member
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 7,780 posts
  • Gender:Male

Posted 14 February 2018 - 12:55 PM

You have to be invited by the team.