Some projects I'm working on
#1

Hi!

Woah it's been a while since I've started a thread here... I've been half-inactive for the past year or so; "hard at work" at university!

For those of you who don't poke around my GitHub from time to time, I decided to write a little summary of some SA:MP related projects I've been working on as well as some ideas for new things.



#1 Pawpy - Pawn and Python, united at last! (No, it's not just another bindings project).


One of my new favourite languages recently has been Python. Python is amazing. Simple language, extremely fast to write scripts, prototypes, build tools, automation, basically anything!

I've wanted to write a plugin for ages so I jotted down this idea with no intention of ever properly trying it. Sat down one morning and coded the first version before lunch so it's safe to say it went better than expected.

"Oh, lame, just another 'write your gamemode in x language' project that will not keep up with SA:MP updates, libraries or plugins"

Nope! Pawpy is actually a plugin to run Python scripts from within Pawn. You can run little scripts in the same thread as Pawn which is pretty fast and doesn't cause any noticeable hanging. But if you want to do something a little more complex (most use cases) it fully supports threaded execution of a Python script with callback support.

I suddenly realised all the plugins and libraries this project would make completely obsolete:
- Sockets - just use Python sockets, urllib.requests, wget, so many options
- Mail - thousands of email packages for Python
- SQL - there are drivers for pretty much all the popular databases (MySQL, Postgres, Mongo, etc)
- GeoIP - maxmind have a Python library for reading their data, no more converting to SQL
- Regex - Python has a very fast regex engine built in
- CTime - built in, along with many date/time/calendar packages
- GPS - there are loads of packages for this
- MapAndreas - okay, you'd probably want to use the plugin version for this but I did rewrite it in Python!
- Any maths plugins/libs - as complicated as you can think of, there will be some way to do it in numpy/scipi
- Logging - cached, sql, flatfile, complex analysis, possibilities are endless!
- JSON - DJson is outdated and doesn't follow spec, SAMPSON only supports reading, Python has it built in

And then of course there's a bunch of cool stuff you can do:
- Generate graphs of your player data
- Connect to your website/forum/panel with ease
- You like statistics? Python has statistics coming out the wazoo. Log and track anything.
- Neural networks? Want to write an AI that learns something from players? Go for it!
- OCR? somehow? could probably be useful...? A gamemode where players have to write text by driving around
- Why not just hook a Python call up to your coffee machine and allow players to trigger a brew?
- Okay I'm out of ideas



#2 SA:MP Build tools - not that interesting but useful


I recently added a build tracker and some other scripts to the SS repo which I plan to release as a more generic set of tools.

Summarised:
- A build number is stored alongside your project
- Every time you compile, that number is incremented (even for failed builds)
- Very useful for projects with multiple developers
- The number can be loaded and displayed in-game
- It can also be used to trigger updates to your players of new features

More stuff:
- Store your code on a repository, stable code on master branch
- Your public server has a small script (Python of course <3) which does a "git pull" and compiles/restarts
- Never upload an .amx through filezilla again!



#3 Scavenge and Survive


I had to add this to the list because the amount of people I've talked to who thought I abandoned this project just because I don't operate a server is crazy!

Quick primer: it's an open source gamemode which several servers run. It's PvP survival (no zombie nonsense) with a focus on harsh combat, constructing bases and hording loot!

I still very actively develop this project. I don't honestly know why but it's come a long way and I'm proud! Quite a few people have been contributing recently and the new features are great! I'm currently pushing stability and proper versioning while aiming to get some resource mining/processing mechanics into mainstream acceptance (so you can grow food, create potions, chop trees, craft things and be self-sustainable).



#4 Pawn guides and tutorials for new styles/techniques of writing good code


Some updated Pawn guides on core concepts and techniques I've been working on for years.

Particularly this includes object oriented stuff and writing class-like code in Pawn. People always say "Pawn isn't OOP" and my response to that is "you're not trying hard enough!"

Object orientation is just a concept, a methodology even. A language doesn't have to be "object oriented" to write object-like code. You can apply almost all the concepts of OO to Pawn and greatly improve your own mental model of your project along with the actual code, making bugs easier to find and features easier to build!



#5 MongoDB - SQL is a love/hate thing and MongoDB is just amazing


Sure, I could do this with Pawpy if I ever get the linux version finished and a stable release done.

But a standalone plugin would still be useful (and faster). Mongo just makes a lot of sense to me in the context of SA:MP, the way data is structured in most gamemodes would play nicely with the Mongo way of doing things.



#6 Clientside anti-cheat (that actually works, isn't blocked in chrome and gets updated)


I'm not sure why I wrote this because obviously I don't want to discuss the internals too much and it won't be open source either!

I'll probably write this with integration to the client over sockets with a Python backend and *actual proper encryption* unlike a lot of the previous attempts where users could just wireshark the app's outgoing, look at what it's sending and send what the server wants in order to assume you're not hacking!

The trick with AC is simple: obfuscation, frequent updates, good encryption!
(alright it's not really simple, but these things help a great deal!)


-


Alright that's it for now, I didn't mean to write that much but I guess it makes up for a few months! #5 is just a concept and #6 is half-baked but the first three are in very active development and you can expect to see more from them here on the forum in the future!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)