[Question] Scripting references?

Making or wanting help making your own asset? Check in here
Post Reply
geogob
Posts: 294
Joined: 2007-03-07 16:36

[Question] Scripting references?

Post by geogob »

Hey all.

Well, I decided to start coding for BF2 and PR. I've been coding for years now on the unreal engine where I worked on additions for a mod called Infiltration.

Anyway, I'm looking for references concerning coding for BF2 and, possibly PR. A good start point for Unreal coding is the unreal wiki (a wiki covering about anything concerning coding in the unreal engine - describing base functions, classes and all). Does something like that exists for BF2?

For PR, is there any existing documentation on the code?

As a first experiment, I'd like to write a QM report script allowing commander and squad leaders to have an overview of issued kits and available kits.

I'd also like to experiment a few Ideas I have on kit moderations systems.

Anyway, I'll be around.
Image

Image
e-Gor
Retired PR Developer
Posts: 3752
Joined: 2006-03-06 22:40

Post by e-Gor »

There are two types of scripting for BF2. There's server side python and then the .con file scripting - which are basically just a huge load of console commands. For a QM script, you'd need the python side of it. The best documentation there is can be found at bf2tech.org
geogob
Posts: 294
Joined: 2007-03-07 16:36

Post by geogob »

I was indeed looking for server side scripting. Thank you for the info! I will look into the bf2tech.org site.

It's always nice to have a few good starting points :)
Image

Image
geogob
Posts: 294
Joined: 2007-03-07 16:36

Post by geogob »

I'm still trying to figure things out. The wiki is a good start, but lacking some basic information.

I see that in PR, all scripts are compiled python scripts on ...\mods\pr\python\game (except the config files)
Of course, there isn't much I can do with a compiled script I guess.

The variables I need to access are variables only related to PR (kit system). Is there a way to get a list of them somehow. Or could someone tell me how to access them if I list those I need? (because I guess I can't count on the source code :p ). Or am I missing something about the compiled python code and what can be done with it.

Or maybe I need the server files (I only looked at the client files).
Image

Image
e-Gor
Retired PR Developer
Posts: 3752
Joined: 2006-03-06 22:40

Post by e-Gor »

Sorry, this thread fell off my radar somehow.

Yes, the python code is closed up... blame certain server admins for that. And we can't distribute the uncompiled python, as this could be used in place of the compiled ones on servers. The server has the same .pyc files as the client.

This was done mainly to prevent server side modding, as we've had some bad experiences with that in the past and have decided to no longer support it.

You should be able to add functionality, but changing PR functionality is not really possible. So the only way to get around this is to write your own QM script from scratch and replace the PR one with that, unfortunately.
geogob
Posts: 294
Joined: 2007-03-07 16:36

Post by geogob »

[R-DEV]e-Gor wrote:Sorry, this thread fell off my radar somehow.

Yes, the python code is closed up... blame certain server admins for that. And we can't distribute the uncompiled python, as this could be used in place of the compiled ones on servers. The server has the same .pyc files as the client.

This was done mainly to prevent server side modding, as we've had some bad experiences with that in the past and have decided to no longer support it.

You should be able to add functionality, but changing PR functionality is not really possible. So the only way to get around this is to write your own QM script from scratch and replace the PR one with that, unfortunately.
Exactly as I thought by looking through the PR files. Thanks for the reply. I'm a bit disappointed, but meh. I had hoped I could bring my experience in here to help improve the game. But I'm no modeler, no mapper, and a bad animator (although I manage to get good work done, but it takes me hours). Coding is really my force.

I do understand why you decided to make such things impossible. Sad, but understandable.

If the code is unavailable, could it be possible to have a list of variables giving me information on kit distribution? Or would knowing those variables allow me to access and modify them, making SSM possible, which would go against the idea of not releasing them in the first place?
Image

Image
dbzao
Retired PR Developer
Posts: 9381
Joined: 2006-06-08 19:13

Post by dbzao »

What exactly you want to do with the kit system?

If you want to help, maybe we can get some ideas that need coding for you to work on.
geogob
Posts: 294
Joined: 2007-03-07 16:36

Post by geogob »

I'd like to work on a reporting system to give SL and CO an overview of the available and issued equipment, which squads has what, etc. That's the basic idea.

To that, there are many things I wanted to experiment with; for the sake of learning on how the BF2 engine works and how to code for it:
- kit moderation (squad leaders need to approve kit selection)
- kit allocation (CO allocates kits to SL or SL request kits for their squad)
- kit info for players (players know which kits are available to their squads)
- Vehicle inventory (for SL and CO to know what vehicles are available)

First implementation would be text based. Eventually (and as possible) integrated in the BF2 command interface.

For the command interface, I'd also like to work on a better information system for squad leaders to get feedback from actions done by other SL in the team and on a maker system for CO and SL to mark areas (other than using the infamous "boat spotted").
Image

Image
danthemanbuddy
Posts: 842
Joined: 2006-11-12 19:07

Post by danthemanbuddy »

I say give this talented man a chance to prove himself and we add to our coding genius Devs.

This can only mean better things in the future.
geogob
Posts: 294
Joined: 2007-03-07 16:36

Post by geogob »

Actually, my best talent so far is finding new exquisite ways to crash games engines :D

My night vision system in INF had ways to crash the engine while I experimented with it, it was unbelievable.
Image

Image
KingofCamelot
Retired PR Developer
Posts: 2365
Joined: 2006-01-07 18:17

Post by KingofCamelot »

geogob wrote:I'd like to work on a reporting system to give SL and CO an overview of the available and issued equipment, which squads has what, etc. That's the basic idea.

To that, there are many things I wanted to experiment with; for the sake of learning on how the BF2 engine works and how to code for it:
- kit moderation (squad leaders need to approve kit selection)
- kit allocation (CO allocates kits to SL or SL request kits for their squad)
- kit info for players (players know which kits are available to their squads)
- Vehicle inventory (for SL and CO to know what vehicles are available)

First implementation would be text based. Eventually (and as possible) integrated in the BF2 command interface.

For the command interface, I'd also like to work on a better information system for squad leaders to get feedback from actions done by other SL in the team and on a maker system for CO and SL to mark areas (other than using the infamous "boat spotted").
No offense mate, but you're really looking at doing stuff that is pushing the limits of Python in BF2, and far beyond your knowledge at the moment. Its extremely hard to communicate information to just one player from the server, hence all the kit request spam in-game. I've experimented with ways and have found a method which works, but it requires the cooperation of both the Python code and the HUD coding. Still in experimental phase.

However, I do plan on adding the kit availability into v0.7, so theres one of your wishes. :)
Ruthless Executioner of 280 SpamBots
Image
Retired Lead Coder for Project Reality - 0.25 through 0.4
geogob
Posts: 294
Joined: 2007-03-07 16:36

Post by geogob »

No offense taken, KOC.

I very well know it is beyond my current knowledge. That's the point as it is my way to learning the engine. I do know that I will constantly hit myself at things that can't be done. But since I'm that stubborn, usually I find my way around of making these things that can't be done. It somehow worked well for me in the past.

You have to understand that those are not wishes I have for PR. Although I do think experimenting with them in the development would be a good idea to see how they turn out, that wasn't the point of this project. I do not intent nor plan on making a polished up working and stable version of any of this. The idea is to have a project to work on to learn the engine, PR and limitations (and imagining ways to go around them). In the end, some good idea could be pushed forward, but that would just be collateral damage :P

I don't have the intention to work on all these ideas at the same time either, for obvious reasons. Once I get more experienced with the engine, we'll take about making wishes for PR real... but not at this point.

Coding is something I do as a hobby and, frankly, it's damn more interesting than the game itself - even if my code never gets into the game :) I like to do little experiments with games and engines, like that penetration code Beppo and I wrote for Red Orchestra. (A game which I never really played nor coded for except for that one experiment). That was my first and last mod for Unreal2/RO. Took me about a week to start in from scratch and get it working reasonably well online on a full server - finding a few bugs in the RO code in the process and doing something the RO devs official announced as impossible.

There's no better way to test some code: "Hey! That function shouldn't return zero all the time...!" hehe

Just that we're clear on that. It's not a suggestion I'd like to make real myself ;)
Just a way for me to get into coding for BF2/PR - even if it never works.


Anyway, I find this place strange. I see mapping, modeling, and all sort of other art content related discussion on these modding forums, but really no coding "community". :S
Last edited by geogob on 2007-09-06 05:44, edited 1 time in total.
Image

Image
KingofCamelot
Retired PR Developer
Posts: 2365
Joined: 2006-01-07 18:17

Post by KingofCamelot »

Theres no community coding section cause theres really not a ton to discuss. :razz: Theres also not a ton of great coders in the BF2 community, only a dozen or so. Luckily we have some good ones on the PR team. ;)

I realize that you're trying to experiment to learn and see what you can do, and thats always been my attitude, its the best way to do it IMO. However, you're going to want to set simpler projects to learn how everything works. To accomplish the projects you mentioned you need a very solid understand about how Python and the engine interacts, as well as good knowledge about the engine in general, etc. Its a little much to just jump right into. Personally I'd suggest some smaller goals first to help you cement the basic understandings and build up from there. :)
Ruthless Executioner of 280 SpamBots
Image
Retired Lead Coder for Project Reality - 0.25 through 0.4
geogob
Posts: 294
Joined: 2007-03-07 16:36

Post by geogob »

You know the engine better than me, so I'll follow your advice on this. I'm really surprised there aren't more coders than that. Being from the Unreal community where coding is very active, it's really a surprise. I have the feeling it's not the complexity of the coding process that in cause, but more the lack of documentation on the engine interaction with the code. Coding for en engine without proper documentation is quite frustrating. I can see why many are not interested in it.

Sad part is that i'm pretty sure this documentation exists. It just hasn't been released.
Image

Image
dbzao
Retired PR Developer
Posts: 9381
Joined: 2006-06-08 19:13

Post by dbzao »

The only references I had was the bf2tech.org ones and KoC.
geogob
Posts: 294
Joined: 2007-03-07 16:36

Post by geogob »

Well, that pretty much explains it :P
Image

Image
KingofCamelot
Retired PR Developer
Posts: 2365
Joined: 2006-01-07 18:17

Post by KingofCamelot »

[R-DEV]dbzao wrote:The only references I had was the bf2tech.org ones and KoC.
I count as a reference. Cool. :D
Ruthless Executioner of 280 SpamBots
Image
Retired Lead Coder for Project Reality - 0.25 through 0.4
geogob
Posts: 294
Joined: 2007-03-07 16:36

Post by geogob »

[R-DEV]KingofCamelot wrote:I count as a reference. Cool. :D
Other coders are probably the best reference around. Especially in a community of 12 coders hehe.
Image

Image
KingofCamelot
Retired PR Developer
Posts: 2365
Joined: 2006-01-07 18:17

Post by KingofCamelot »

geogob wrote:Other coders are probably the best reference around. Especially in a community of 12 coders hehe.
True that, always keep other coders on your MSN, they can be quite useful. :)
Ruthless Executioner of 280 SpamBots
Image
Retired Lead Coder for Project Reality - 0.25 through 0.4
Post Reply

Return to “PR:BF2 Community Modding”