Jump to content
SirMrE

[SPMC] Supremacy Framework v0.6.0 (September 2nd 2016) - Multiplayer Sandbox Framework.

Recommended Posts

Supremacy Framework
Latest Release: 0.6.0 (changelog) - September 2nd 2016

I wanted to learn more about how ARMA 3 modding worked, and there is really no better way than "code to learn". Everything is coded from the ground up, except for the below mentioned 3rd party scripts.

 

Reddit

I have made a sub reddit since that might be more useful for a lot of people: r/ArmaSupremacy.

 

Features

  • World loot spawns
  • World vehicle spawns
  • World stationery spawns
  • Dynamic Groups
  • Player spawn/respawn (cities, random, world)
  • Timed, random placement, airdrops
  • Equipment Shops
  • Vehicle Shops
  • Clothes Shops
  • Simple HUD (fps, health and money)
  • Persistent player data (MySQL)
  • Loot spawn in buildings and world loot spawn (vehicles, crates and stationary)
  • Skill & Experience system
  • Revival, heal, repair and other skills.
  • Air drop events
  • Ammo repacking
  • Timed Rewards

Maps

  • Altis
  • Tanoa

Usage/Installation
It uses strictly "vanilla" (including expansions) content. No client-side mods required.

  • Upload the content of the "Dist" folder to your ARMA 3 dedicated server root (where the arma3server.exe file is).
  • Edit the "LaunchServer.bat" files launch parameters to suit your needs.
  • Edit the "@extDB2\extdb-conf.ini" file, adding your database connection details.
  • Import the "@extDB2\spmc_server.sql" to your database.
  • Import any "spmc_server - x.x.x to x.x.X update.sql" files in the correct order (by version).
  • Run the "LaunchServer.bat" file.

You can modify the "\Source\supremacy_server\compile\core\config.sqf" to make changes to a lot of the elements in the framework.
There is no wiki yet, but I hope to get working on that soon.

Using This Framework or some of it's Code?
If you do not mind, please let me know! I would love to see what others have made using this framework or some of it's code!

License
Code released under CC BY-NC 3.0 License.
To read the human-readable summary of the CC BY-NC 3.0 License, click here.

The license does NOT apply to or included any of the 3rd party material (sounds, code, icons etc). All 3rd party material can be found in the "\3rdparty" directory in the client and server source code.

I did not create or own any of the 3rd party material. Please see their credits below and in their files were applicable.
 
Arma Server Monetization
You have permission to use this framework on a monetised arma server(s).
IMPORTANT NOTE: This does NOT apply to any of the 3rd party material (sounds, code, icons etc). All 3rd party material can be found in the "\3rdparty" directory in the client and server source code.

3rd Party Credits
A big thanks to the following people for their scripts, icons, sounds and extensions which are required to make the SPMC framework tick.
A special thanks to Kilzone_Kid and Tonic for inspiration and code/resources which I have learn a lot from by reading.

Code

Extensions

Testing

Sounds

Icons

Download
You can grap the source code and latest release here: https://github.com/MrEliasen/Supremacy-Framework/releases/
 
Uk9xw9t.jpg
 
thr8TrG.png
 
5CUCYrr.jpg

  • Like 4

Share this post


Link to post
Share on other sites

Just had a quick glance of your code
Always nice to see someone else using extDB2 :)

Small pointer, will help improve server performance
 

mresArray.sqf
mresString.sqf
mresToArray.sqf

These are functions life servers used to make raw SQL Statements safe, to prevent injection attacks.

You only need to worry about this when using SQL_RAW.

SQL_CUSTOM_V2 is using Prepared Statements, so you don't need to worry about this.

Note: If you use CUSTOM_INPUTS just use the strip options to make it safe from injection attacks.

Share this post


Link to post
Share on other sites

Just had a quick glance of your code

Always nice to see someone else using extDB2 :)

Small pointer, will help improve server performance

 

mresArray.sqf
mresString.sqf
mresToArray.sqf
These are functions life servers used to make raw SQL Statements safe, to prevent injection attacks.

You only need to worry about this when using SQL_RAW.

SQL_CUSTOM_V2 is using Prepared Statements, so you don't need to worry about this.

Note: If you use CUSTOM_INPUTS just use the strip options to make it safe from injection attacks.

 

Thank you :).

Also thank you for making that ext. - took a bit of time to get my head around how to interact with the DB. Once I am more proficient i'll contribute to the Wiki.

I was aware of them escaping but they where really just there to convert arrays to strings to be able to easily save in the DB.... thought I just realised as I type this.

str _array should work right? and then just toArray _str ? (or something similar like toArray - as it only converts to numbers?)

Not sure why I didn't think of this before.

Thanks for the heads up and suggestions - appreciated!

 

Ohh briliant! So stoked about this - appreciated!

Share this post


Link to post
Share on other sites

0.3.2 released. Fixing bugs and addings some minor additional "features".
 

If you are using a version before 0.3.2, it is recommended you upgrade as it fixes a lot of stuff.

Share this post


Link to post
Share on other sites

@mre
You don't need to convert the arrays at all, just send them as is.
 

str(_array);
or
format["%1", _array];

When fn_async is fetching the result it is call compiling it, so it will get converted back to an array for you.

 

------------------

The only thing you need to worry about is if you are saving PlayerNames, PlayerInput

 

If a player name is: Player"Name

The str command won't escape quotations for you.
You can either do sqf code to turn:  Player"Name -> Player""Name
Or you could strip out all quotations or use toArray toString to convert the playername.
But that makes it harder to read database for playernames though.


----

But there really is no nice way todo this.
BIS really need to make a newer str command that escapes quotations properly :(

Share this post


Link to post
Share on other sites

@mre

You don't need to convert the arrays at all, just send them as is.

 

str(_array);
or
format["%1", _array];

When fn_async is fetching the result it is call compiling it, so it will get converted back to an array for you.

 

------------------

The only thing you need to worry about is if you are saving PlayerNames, PlayerInput

 

If a player name is: Player"Name

The str command won't escape quotations for you.

You can either do sqf code to turn:  Player"Name -> Player""Name

Or you could strip out all quotations or use toArray toString to convert the playername.

But that makes it harder to read database for playernames though.

----

But there really is no nice way todo this.

BIS really need to make a newer str command that escapes quotations properly :(

 

About the arrays, I figured it out with the arrays, turns out it was pretty easy to and and "load" arrays from the database :) (Just like you said).

Good point on the usernames.. maybe if I do toArray and strip " only and the toString it after? In theory that should work? The usernames are only for the modders to easily see who the data belongs to, it will not be used in the game itself.

Thanks for the tips and tricks, appreciate it!

Share this post


Link to post
Share on other sites

If the usernames are never fetched from the database, don't bother to strip them of quotations it will be fine.

It only effects it when you try to call compile it.

-------------
 

Infact there is an option  i.e 1-String_Escape_Quotes
That will escape the quotes from a playername, if you ever do fetch the playername from the database.
Completely forgot i added that in.

Share this post


Link to post
Share on other sites

If the usernames are never fetched from the database, don't bother to strip them of quotations it will be fine.

It only effects it when you try to call compile it.

-------------

 

Infact there is an option  i.e 1-String_Escape_Quotes

That will escape the quotes from a playername, if you ever do fetch the playername from the database.

Completely forgot i added that in.

Ah cool ok then.

I do not intend to fetch the name from database to use in game, that said, I might be in the future (if I do some sort of "clan" or high scrore lists etc).

Oh, haha! Nice! I'll keep that in mind then. Sounds like the perfect solutions to me (String_Escape_Quotes) :).

Cheers!

Share this post


Link to post
Share on other sites

NEW RELEASE

Version:0.4.0 - Download link in OP.

Features/Changes:

  • Added item spawn in buildings (careful, can take a long time to init server if you increase % too much).
  • Added comments to each value in the config.
  • Added more configurable options, like sell percentage, to the config.
  • Added skill and experience system.
  • Added names to the loot markers which are visible in debug mode.
  • Added progress bars.
  • Added revival and healing system.
  • Added vehicle repair
  • Added many other passive abilities and functions as part of the skill/experience system.
  • Added ammo to price list.
  • Added ability to synchronise animations.
  • Network optimisations when selling items and vehicles.
  • Network optimisations to saving player data.
  • Updated ExtDB2 to the latest (66) version.

Bugfixes:

  • Fixed some minor issues where final compiled scripts where defined twice, server side.
  • Fixed an issue where the handgun items would not load from the databse.
  • Fixed an issue where the hangun would not equip if you didn't have a primary weapon.
  • Fixed a bug while loading the players money from the database.
  • Fixed an issue where pricing where not checked client side (protentially saving a large number of requests).
  • Fixed an issue in the extdb-conf.ini file not loading the correct database details.
  • Fixed an issue where you would not respawn propperly if deconnecting and rejoining the server.
  • Fixed sell prices for vehicles and items being calculated wrong.
  • Fixed the purchase price not being calculated correctly.
  • Fixed selling vehicles now confirmes server side like equipment (so money saves).
  • Fixed the issue with vehicle sales not being done properly and validated.
  • Fixed an issue where vehicle loot and supply crate loot tables where switched.

Share this post


Link to post
Share on other sites
I follow tutorial and recieve a infinite Client initializing, please wait....

 

Ext log

 



extDB2: Version: 66
extDB2: https://github.com/Torndeco/extDB2
extDB2: Windows Version
Message: All development for extDB2 is done on a Linux Dedicated Server
Message: If you would like to Donate to extDB2 Development
Message: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2SUEFTGABTAM2
Message: Also leave a message if there is any particular feature you would like to see added.
Message: Thanks for all the people that have donated.
Message: Torndeco: 20/02/15


extDB2: Found extdb-conf.ini
extDB2: Detected 4 Cores, Setting up 4 Worker Threads


[16:45:29:395990 --2:00] [Thread 1432] extDB2: Database Type: MySQL
[16:45:29:408991 --2:00] [Thread 1432] extDB2: Database Session Pool Started
[16:45:29:408991 --2:00] [Thread 1432] extDB2: Failed to Load Protocol: SQL_CUSTOM_V2
[16:47:09:161697 --2:00] [Thread 1432] extDB2: Error Unknown Protocol: 268178 Input String: 2:268178:loadPlayer:76561197988048248
[16:47:09:162697 --2:00] [Thread 1432] extDB2: Error: Syntax error: Not a valid integer: Error Unknown Protocol
[16:47:09:162697 --2:00] [Thread 1432] extDB2: Error: Input String 4:Error Unknown Protocol
[16:50:06:703852 --2:00] [Thread 1432] extDB2: Error Unknown Protocol: 268178 Input String: 2:268178:loadPlayer:76561197988048248
[16:50:06:703852 --2:00] [Thread 1432] extDB2: Error: Syntax error: Not a valid integer: Error Unknown Protocol
[16:50:06:703852 --2:00] [Thread 1432] extDB2: Error: Input String 4:Error Unknown Protocol
[16:51:02:239028 --2:00] [Thread 1432] extDB2: Stopping ...


Share this post


Link to post
Share on other sites

 

I follow tutorial and recieve a infinite Client initializing, please wait....
 
Ext log
 
extDB2: Version: 66
extDB2: https://github.com/Torndeco/extDB2
extDB2: Windows Version
Message: All development for extDB2 is done on a Linux Dedicated Server
Message: If you would like to Donate to extDB2 Development
Message: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2SUEFTGABTAM2
Message: Also leave a message if there is any particular feature you would like to see added.
Message: Thanks for all the people that have donated.
Message: Torndeco: 20/02/15


extDB2: Found extdb-conf.ini
extDB2: Detected 4 Cores, Setting up 4 Worker Threads


[16:45:29:395990 --2:00] [Thread 1432] extDB2: Database Type: MySQL
[16:45:29:408991 --2:00] [Thread 1432] extDB2: Database Session Pool Started
[16:45:29:408991 --2:00] [Thread 1432] extDB2: Failed to Load Protocol: SQL_CUSTOM_V2
[16:47:09:161697 --2:00] [Thread 1432] extDB2: Error Unknown Protocol: 268178  Input String: 2:268178:loadPlayer:76561197988048248
[16:47:09:162697 --2:00] [Thread 1432] extDB2: Error: Syntax error: Not a valid integer: Error Unknown Protocol
[16:47:09:162697 --2:00] [Thread 1432] extDB2: Error: Input String 4:Error Unknown Protocol
[16:50:06:703852 --2:00] [Thread 1432] extDB2: Error Unknown Protocol: 268178  Input String: 2:268178:loadPlayer:76561197988048248
[16:50:06:703852 --2:00] [Thread 1432] extDB2: Error: Syntax error: Not a valid integer: Error Unknown Protocol
[16:50:06:703852 --2:00] [Thread 1432] extDB2: Error: Input String 4:Error Unknown Protocol
[16:51:02:239028 --2:00] [Thread 1432] extDB2: Stopping ...

 

 

 

Seems like the ExtDB2 plugin is not setup properly.

Did you copy the sql_custom_v2 directory as well and made sure the file in there ("spmc.ini" by default) is the same name as the mysql connection you setup in your extdb config?

 

d9bJUO0.png

 

 

EDIT:

 

I see the folder structure is a bit wrong on the release.

the ExtDB folder structure should look like this:

 

(file) @extDB2 / extDB2.dll
(file) @extDB2 / extdb-conf.ini
(dir)  @extDB2 / extDB / 
(dir)  @extDB2 / extDB / sql_custom_v2 / 
(file) @extDB2 / extDB / sql_custom_v2 / spmc.ini
 
Hope it helps - I will update the release today.

Share this post


Link to post
Share on other sites

This is pretty interesting. Been looking for a framework like this... Does this support CBA and other 3rd party mods like RHS, ACE3, ALiVE etc? Mostly wondering about adding missions and what not. Also what is the idea for this? Usable in PvP, TvT, PvE engagements? Sorry for the 20 questions but I've been looking for something like this and would just like some more clarification on what server admins can do with this and what play styles can be supported. Thanks!

Share this post


Link to post
Share on other sites

This is pretty interesting. Been looking for a framework like this... Does this support CBA and other 3rd party mods like RHS, ACE3, ALiVE etc? Mostly wondering about adding missions and what not. Also what is the idea for this? Usable in PvP, TvT, PvE engagements? Sorry for the 20 questions but I've been looking for something like this and would just like some more clarification on what server admins can do with this and what play styles can be supported. Thanks!

 

No problem I will try answer then all to the best of my ability!

 

I am not aware of any compatibility issues with other 3rd party mods, but with that said, I have not done anything to implement or make sure any other 3rd party mods will work with this (I am still discovering how all that works and not to make things compatible with each other).

 

I initially wanted to make a gamemode for ARMA 3 called "Supremacy". Basically territory control-like system where the more you control the more access to equipments or like you get. I wanted to learn how to do this so I thought I might as well just do it from the ground up to really get to understand how to work with this scripting language. Instead of just making this game mode, I decided to make a framework for others to use as well and to create their own things with (inspiration was Altis Life and Wasteland).

 

Right now there is not really an "admin" panel. I made a teleport script and that is about it! haha. I want to make a web-facing control panel for this at some point, but that is sort of low-ish priority.

 

So to sum up what this framework is made for: Others to see how to make things like this, use of the code or the whole thing (within the license's scope). But also to allow people to quickly throw together new game modes, test ideas or just build a big FFA war zone (grouping system is expected in 0.5.0 - 0.6.0).

 

I hope this answered your questions. Sorry I cannot be more direct with my answers when it comes to 3rd party mods etc. I just dont actually know for sure!

Share this post


Link to post
Share on other sites

About the arrays, I figured it out with the arrays, turns out it was pretty easy to and and "load" arrays from the database :) (Just like you said).

Good point on the usernames.. maybe if I do toArray and strip " only and the toString it after? In theory that should work? The usernames are only for the modders to easily see who the data belongs to, it will not be used in the game itself.

Thanks for the tips and tricks, appreciate it!

 

If you want / need to strip " from a players name you can still utilize mresString.sqf as that was designed to strip out unwanted characters like " to make it SQL friendly and obviously also preventing SQL injections from a string which is only used for player names in life code or any string that can be manipulated by the client.

 

mresArray.sqf and mresToArray.sqf was used for making arrays safe to be injected into the database, with extDB2 its a pointless piece of functionality, functionality that was originally made for arma2MySQL as it did not play nice with SQF formatted arrays, it only exists now as compatibility with older databases.

 

Just a tid bit of information about why those functions exist, useless now a days but hey, the more you know am I right?

Share this post


Link to post
Share on other sites

If you want / need to strip " from a players name you can still utilize mresString.sqf as that was designed to strip out unwanted characters like " to make it SQL friendly and obviously also preventing SQL injections from a string which is only used for player names in life code or any string that can be manipulated by the client.

 

mresArray.sqf and mresToArray.sqf was used for making arrays safe to be injected into the database, with extDB2 its a pointless piece of functionality, functionality that was originally made for arma2MySQL as it did not play nice with SQF formatted arrays, it only exists now as compatibility with older databases.

 

Just a tid bit of information about why those functions exist, useless now a days but hey, the more you know am I right?

 

Thanks for the clarification! I think it's good to know why or for reference if anyone was wondering.

 

EDIT: By the way, let me know if you want me to link your credit somewhere else :). Thanks!

Share this post


Link to post
Share on other sites

can you build in ACE3 Support? I have been looking for something like this to replace the buggy A3 Wasteland system.

Share this post


Link to post
Share on other sites

Hey,

 

Sorry about the lack of replies. I haven't had a lot of time since Jan 3rd so I haven't been logged in to the forums.
Please note this framework is, a framework. If you need anything from it or want it to work differently then you have to add it or extract it yourself. It's open source for a reason :).

I am happy to help where I can but please note that this is not the only thing I do in my limited free time.

 

Thanks!

Share this post


Link to post
Share on other sites

Version 0.5.0 released.

Tanoa map now included - see changelog for all the changes.

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×