Quantcast

Jump to content

» «
Photo

What is it?

10 replies to this topic
WDR
  • WDR

    Saviour of Mankind

  • Members
  • Joined: 31 Jan 2009

#1

Posted 27 July 2010 - 06:50 PM

Hi...I tried looking for this in Google Search and in the forum search as well. But I couldn't find anything!

Question: What is the programming language used in GTA San Andreas? I know there have been a few programs for editing the main.scm file like Sanny Builder, etc. But I first want to learn the program language in order to edit it! Pleae help!! Cheers! biggrin.gif

BnB
  • BnB

    The Yardies

  • Members
  • Joined: 28 Jun 2010
  • Saint-Vincent-and-the-Grenadines

#2

Posted 27 July 2010 - 06:56 PM

Read this

WDR
  • WDR

    Saviour of Mankind

  • Members
  • Joined: 31 Jan 2009

#3

Posted 27 July 2010 - 07:21 PM

I know that topic...I want this information in general!! Someone pls tell me!!

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#4

Posted 28 July 2010 - 02:01 AM

GTA San Andreas doesn't use a programming language... Mostly because the main.scm isn't a program.

Inside a main.scm, you find nothing but pure binary/hex.

CODE
A4 03 09 4D 41 49 4E 00 00 00 00 6A 01 04 00 04 00 2C 04 05 93 00 0D 03 05 BB 00 97 09 05 3B 05 F0 01 04 06 11 01 04 00 C0 00 04 08 04 00 E4 04 06 FE 88 1B 45 06 AE 5B D0 C4 CB 03 06 FE 88 1B 45 06 AE 5B D0 C4 06 DE 02 56 41 2A 06 05 A5 00


That's the first 50 bytes of the main.scm (after the inital DEFINE OBJECTS, MISSIONS, SCRIPTS etc.)

There's no real language until we decompile it.


Here's the first batch of hex... Which is converted by the decompiler into one line of text.
CODE
A4 03 09 4D 41 49 4E 00


It is broken up and turned into something more readable.

CODE
A4 03       > 03A4 (this is the only hex we still see when coding)
09          > (removed from our view completely.. this tells the game what the next thing will be... a short string)
4D 41 49 4E > MAIN


So now we technically have..
CODE
03A4: 'MAIN'


Then some text is added to explain what the line does...
CODE
03A4: name_thread 'MAIN'


The quotes (') around the text tell our compiler to put an "09" before the text MAIN... Quotes won't make much sense to the computer, but to us it makes more sense than "09".


The compiling proccess is the same, but backwards. It removes the text and turns everything into hexadecimal... Then makes the main.scm file out of that. The game reads each opcode, which tells the game what operation to perform. Then it reads the parameter type, which tells it what type of parameter comes next... Then it reads the parameter, which gives it the information needed to perform the operation.

So we're not looking at an official 'language'... It is what it is smile.gif We call it SCM.

WDR
  • WDR

    Saviour of Mankind

  • Members
  • Joined: 31 Jan 2009

#5

Posted 28 July 2010 - 02:32 AM

QUOTE (Deji @ Jul 28 2010, 07:31)
GTA San Andreas doesn't use a programming language... Mostly because the main.scm isn't a program.

Inside a main.scm, you find nothing but pure binary/hex.

CODE
A4 03 09 4D 41 49 4E 00 00 00 00 6A 01 04 00 04 00 2C 04 05 93 00 0D 03 05 BB 00 97 09 05 3B 05 F0 01 04 06 11 01 04 00 C0 00 04 08 04 00 E4 04 06 FE 88 1B 45 06 AE 5B D0 C4 CB 03 06 FE 88 1B 45 06 AE 5B D0 C4 06 DE 02 56 41 2A 06 05 A5 00


That's the first 50 bytes of the main.scm (after the inital DEFINE OBJECTS, MISSIONS, SCRIPTS etc.)

There's no real language until we decompile it.


Here's the first batch of hex... Which is converted by the decompiler into one line of text.
CODE
A4 03 09 4D 41 49 4E 00


It is broken up and turned into something more readable.

CODE
A4 03       > 03A4 (this is the only hex we still see when coding)
09          > (removed from our view completely.. this tells the game what the next thing will be... a short string)
4D 41 49 4E > MAIN


So now we technically have..
CODE
03A4: 'MAIN'


Then some text is added to explain what the line does...
CODE
03A4: name_thread 'MAIN'


The quotes (') around the text tell our compiler to put an "09" before the text MAIN... Quotes won't make much sense to the computer, but to us it makes more sense than "09".


The compiling proccess is the same, but backwards. It removes the text and turns everything into hexadecimal... Then makes the main.scm file out of that. The game reads each opcode, which tells the game what operation to perform. Then it reads the parameter type, which tells it what type of parameter comes next... Then it reads the parameter, which gives it the information needed to perform the operation.

So we're not looking at an official 'language'... It is what it is smile.gif We call it SCM.

Thanks, dude!! Now I fully understood!! Your reply was very informative!! biggrin.gif icon14.gif

Is GTA IV done in the same way? It's just that I'm about to start a programming language course and would like to learn languages in the gaming field. Which is most commonly used in making games nowadays? Help me on this one, thanks!! colgate.gif

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#6

Posted 28 July 2010 - 03:38 PM

GTA IV uses native commands or something. It's very different from San Andreas.

I'm not too sure about much of how GTA IV works as I don't even play it. III and VC uses the same principle as San Andreas, though.

Most games aren't like this, though. The GTA games are much more moddable than any other game.

ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union

#7

Posted 28 July 2010 - 03:47 PM

QUOTE (Deji @ Jul 28 2010, 15:38)
GTA IV uses native commands or something. It's very different from San Andreas.

I'm not too sure about much of how GTA IV works as I don't even play it. III and VC uses the same principle as San Andreas, though.

The lua scripting with Alice plugin is very similar to cleo scripting
just use natives instead opcodes
but it's nevermore supported and works only on patch 1.0.0.4

scripthook and Netscripthook works on actually version
look in
IV Era Modding>>IV Coding

TheSiggi
  • TheSiggi

    Surgeon

  • Members
  • Joined: 05 Jul 2009

#8

Posted 02 August 2010 - 09:58 AM Edited by The_Siggi, 22 October 2010 - 01:15 PM.

A game can 'include' multiple languages of various types:

The engine is mostly written in a C-language while the internal level desgin, like missions, is created by a scripting language which passes the command to the engine.
GTA is entirely written in C++, like its favoured by most producers, and furthermore R* designed its own original scripting langauge for designing the world inside the game: .sc (compare: %\data\main.sc [open with notepad]).

The main.scm used this language aswell, but it was compiled in a differnt way, so it can't be decompiled with notepad.

When the GTA fan comunity began to decompile it step by step they 'formed' the style of .scm we uses nowerdays (low-level).

But there're also differnt ways of changing the game: Since the engine is written in C++ its 'pretty easy' to hool the games internal functions and ofc. its memory by using the same language.

C++ is also very common so if you consider working with games later C++ is a good reference and it might become handy for you one day (never did for me but who knows)

and now I'll go swimming again... too hot here

cheers


toonskull
  • toonskull

    Necromancer

  • Members
  • Joined: 04 Aug 2009

#9

Posted 02 August 2010 - 12:30 PM

About the only other language I can relate it to would be ASM. Heaven knows it is just as hard. For example;

CODE

JMP 111
E 102 'HELLO WORLD!',0D,0A,'$'
A 111
MOV DX, 102
MOV AH, 09
INT 21
MOV AH, 1
INT 16
JZ 118
INT 20


All that just to write "HELLO WORLD!" out to the console window. But technically GTA engine was most likely programmed in C++ while the script was cooked up in some in house firmware compiler.


Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#10

Posted 02 August 2010 - 03:18 PM

You know ASM? Wow, teach me tounge.gif

I can kinda get what a certain thing does by looking at it, but it still confuses the hell outta me. All this AH and ECX stuff.. Complex.

Still, ASM can be done within a CLEO Script, so we're looking at pretty unlimited capabilities when it comes to Advanced CLEO Scripting... We can do the same stuff as a C++ hook, it's just loads harder. I guess the only restriction is that CLEO Scripts aren't active until you start a game.

toonskull
  • toonskull

    Necromancer

  • Members
  • Joined: 04 Aug 2009

#11

Posted 02 August 2010 - 08:39 PM

QUOTE (Deji @ Aug 2 2010, 15:18)
You know ASM? Wow, teach me tounge.gif

I can kinda get what a certain thing does by looking at it, but it still confuses the hell outta me. All this AH and ECX stuff.. Complex.

Still, ASM can be done within a CLEO Script, so we're looking at pretty unlimited capabilities when it comes to Advanced CLEO Scripting... We can do the same stuff as a C++ hook, it's just loads harder. I guess the only restriction is that CLEO Scripts aren't active until you start a game.


A bit off topic:
I only know what little my Dad taught me, which is not much. He has an old book in his library titled "Using Assembly Language: 3rd Edition" it has to be from his college days (18 years ago). You will need something like that to look up all the codes. There are too many for anyone to memorize them.

JMP 111 skips the string I entered. I am told "by the book" that Interrupt 21, Service 09 is Output String. DX is the location where it can find the string. Then Interrupt 16, Service 01 is waiting for keyboard data, JZ 'jump on no data' to address 118, just loops until you hit any key. INT 20 ends program.

I prefer to work in high level programming languages like VB, C++, Python, etc.. Knowing a little about asm doesn't hurt but you will never program an entire game with it you could go bonkers. Depending on your Windows version I believe you can still use the DEBUG editor to make simple asm programs.

Also there is a game that will help you learn how those registers work. "AT Robots" is an old DOS game where you learn by programming fighting robots.

Sorry about the OT post, I felt everyone could benefit from it. What Deji said above got me to thinking how much Sanny Builder is like an old DEBUG asm editor.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users