GSC: Object-oriented or procedural?

broken avatar :(
Created 1040 days ago
by JR-Imagine
0 Members and 1 Guest are viewing this topic.
3,037 views
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 51 days ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
Signature
"Deleted code is debugged code." - Jeff Sickel
"Mathematicians stand on each others' shoulders and computer scientists stand on each others' toes." - Richard Hamming
×
JR-Imagine's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
The past few months I've gotten rather familiar with the internal workings of GSC as I've been expanding CoD4's server binaries with new functionality such as input detection and HTTP POST requests etc. Now I've gotten the idea for this little discussion from someone who actually mentioned this in a shoutbox on another forum at some point and I thought it would be really interesting to see how much people actually know about the scripting language they're using on a daily basis.

So the basic question is: Is CoDScript/GSC/... (whatever you want to call it) object-oriented or procedural?

In the shoutbox discussion I saw a few very interesting answers and wanted to hear what the scripting community on UGX-Mods thinks about this subject. For the record, I'm purely doing this to spark a discussion as I'm legitimately interested to hear about people's views and I myself already know the answer to this question (if the community can't work it out I'll actually post the answer later).

For those not familiar with these terms:
Object-oriented programming (OOP): [You are not allowed to view external links. Register or Login to see them]
Procedural programming: [You are not allowed to view external links. Register or Login to see them]

PS: Pwn please don't spoil it, pretty sure you know the answer as you're quite familiar with the internal workings of CoD yourself. :P
Last Edit: June 14, 2016, 05:28:19 pm by JR-Imagine
broken avatar :(
×
broken avatar :(
Location: kp
Date Registered: 29 July 2015
Last active: 253 days ago
Posts
435
Respect
Forum Rank
Perk Hacker
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
children should not be playing call of duty
Signature
⠀⠀⠀⣴⣴⡤
⠀⣠⠀⢿⠇⡇⠀⠀⠀⠀⠀⠀⠀⢰⢷⡗
⠀⢶⢽⠿⣗⠀⠀⠀⠀⠀⠀⠀⠀⣼⡧⠂⠀⠀⣼⣷⡆
⠀⠀⣾⢶⠐⣱⠀⠀⠀⠀⠀⣤⣜⣻⣧⣲⣦⠤⣧⣿⠶
⠀⢀⣿⣿⣇⠀⠀⠀⠀⠀⠀⠛⠿⣿⣿⣷⣤⣄⡹⣿⣷
⠀⢸⣿⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⢿⣿⣿⣿⣿⣿
⠀⠿⠃⠈⠿⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⠿⠿⠿

⠀⢀⢀⡀⠀⢀⣤⠀⠀⠀⠀⠀⠀⠀⡀⡀
⠀⣿⡟⡇⠀⠭⡋⠅⠀⠀⠀⠀⠀⢰⣟⢿
⠀⣹⡌⠀⠀⣨⣾⣷⣄⠀⠀⠀⠀⢈⠔⠌
⠰⣷⣿⡀⢐⢿⣿⣿⢻⠀⠀⠀⢠⣿⡿⡤⣴⠄⢀⣀⡀
⠘⣿⣿⠂⠈⢸⣿⣿⣸⠀⠀⠀⢘⣿⣿⣀⡠⣠⣺⣿⣷
⠀⣿⣿⡆⠀⢸⣿⣿⣾⡇⠀⣿⣿⣿⣿⣿⣗⣻⡻⠿⠁
⠀⣿⣿⡇⠀⢸⣿⣿⡇⠀⠀⠉⠉⠉⠉⠉⠉⠁
×
Koan's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Oil Rig Beta Access
Oil Rig Beta Access
Koan's Contact & Social Linksh-r_Koan_my website


Wouldn't it simply be both? Multi-paradigm? It's object oriented in that, for example, you can refer to entities with self etc, but it's also procedural cause you can make functions that can be called at any point. Basic examples but you get the idea.
Last Edit: June 14, 2016, 06:00:23 pm by Koan
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 1028 days ago
Posts
2,794
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet

Assuming that the WIKI links are actually accurate:

Object Orientated, I think. Every function is an abstract interface that can accept any object(via self). No object is bound to any single function or set of functions unless the scripter specifically checks for it because "self" is abstract and isn't specific to any object type.
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 51 days ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
×
JR-Imagine's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
@Both:
The keyword "self" is actually an integer holding an entity number:
typedef int scr_entref_t;

Behind the scenes that integer is passed onto a function through a simple argument:
void PlayerCmd_spawn( scr_entref_t arg );

The way these functions then get the correct entity is by simply pulling it from the entity list:
gentity_t* gentity;

if( HIWORD( arg ) ) {
Scr_ObjectError( "Not an entity" );
} else {
gentity = &g_entities[ LOWORD( arg ) ];
}

I've kinda already spoiled too much with this but whatever... :P
broken avatar :(
×
broken avatar :(
Location: hkHong Kong
Date Registered: 26 August 2012
Last active: 650 days ago
Posts
17
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
JustForFun119's Groups
JustForFun119's Contact & Social LinksJustForFun119
I'd say it is procedural because the so-call 'objects' are structures similar to C's struct.
It's just how scripting is conceptually easier to understand when we turn different game entities into some metaphors of objects.

When OOP is mentioned, some concepts such as objects, classes, inheritance, polymorphism, are expected; though it is not a part of the 'CoDScript', so I don't think it is related to OOP :)
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 187 days ago
Posts
947
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
just asking. do procedural or object programing has anything to do with the ability to write the main function wherever you like in gsc vs lets say in c++ having to at least write the prototype of a function above the main function so you dont get compile errors? :noob_asked_be_cool: xD
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 51 days ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
×
JR-Imagine's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
just asking. do procedural or object programing has anything to do with the ability to write the main function wherever you like in gsc vs lets say in c++ having to at least write the prototype of a function above the main function so you dont get compile errors? :noob_asked_be_cool: xD
It doesn't. A good example of this is both C and C++ requiring a prototype to be declared before the main function whilst C is procedural and C++ is object-oriented. ;)

Just FYI: Prototypes should be declared in header files while writing C/C++.
Last Edit: June 16, 2016, 11:06:19 am by JR-Imagine
broken avatar :(
×
broken avatar :(
The OG Polish Modder
Location: pl
Date Registered: 19 June 2013
Last active: 97 days ago
Posts
1,666
Respect
Forum Rank
Zombie Destroyer
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
#RyukoRocks
Signature
[FS] Social Networking, Lead Animator and Scripter
[You are not allowed to view external links. Register or Login to see them]
[You are not allowed to view external links. Register or Login to see them]
×
Ray1235's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
I'm not Pwn, so....
Sorry but you are not allowed to view spoiler contents.
Last Edit: June 16, 2016, 11:16:28 am by Ray1235
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 187 days ago
Posts
947
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
It doesn't. A good example of this is both C and C++ requiring a prototype to be declared before the main function whilst C is procedural and C++ is object-oriented. ;)

Just FYI: Prototypes should be declared in header files while writing C/C++.
oh  :o thanks, thats good to know xD
broken avatar :(
×
broken avatar :(
Location: usCali(fornia)
Date Registered: 21 December 2013
Last active: 216 days ago
Posts
418
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Signature
The sound of God is the screech of tires, lights and magnets, bolts and wires. Strayed from the road, this very one, still to come. The sound of tires is the sound of God, the electric version.
×
mrpeanut188's Groups
mrpeanut188's Contact & Social Linksmrpeanut1881337p34nutmrpeanut188
Procedural. Don't have much OOP experience, but it's not hard to take one look and see it's procedural.
Last Edit: June 23, 2016, 05:13:52 pm by mrpeanut188

 

Login

or login with an authentication provider below
Twitter
Discord
Steam
Twitch
Google
Loading ...