Page 1 of 1

Using AHK for large scale software development

Posted: 17 Dec 2020, 09:26
by TheBigO
Hello,

I am new to this community (really, my first post), and also quite new to AHK as well. To be precise, I've come across AHK three months ago, cause I've been looking for a macro processor to automate some tasks in a virtual racing simulator. As usual, things got complex quite fast, I learned a lot about AHK and the list of ideas for my simulation automation software got really long. In the end, I decided to conduct a complete rewrite using the object oriented capabilites of AHK. I ended up with almost 8000 lines of code, several independent applications integrated with interprocess communication, a rules based build system similar to the good old make, but written competely in AHK, and a very capable plugin mechanism for extending the solution at the users site, since every simulation rig is different.

If you're interested take a look at the GitHub repository and the quite extensive documentation. Feel free to use parts of the code for any of your own projects, if you find something useful.

GitHub: https://github.com/SeriousOldMan/Simulator-Controller
Documentation: https://github.com/SeriousOldMan/Simulator-Controller/wiki

Have fun...

TheBigO

Re: Using AHK for large scale software development

Posted: 17 Dec 2020, 10:55
by iilabs
That is some fantastic stuff. Will definitely pick your brain when I start building my own. AWESOME!

Re: Using AHK for large scale software development

Posted: 18 Dec 2020, 03:56
by TheBigO
Yeah, thanks. It was quite some task. The biggest challenge was the fact, that finding errors in complex code ist not quite easy in AutoHotkey, since

Code: Select all


foo := false

foo.callBar()[42]

evaluates without error. Maybe something to change by a #Warn option in the future...

Re: Using AHK for large scale software development

Posted: 18 Dec 2020, 08:27
by Relayer
Impressive. You must have a strong background in programming. I have written assembly code and some C but I have learned most of what I know from AHK. I'm basically a hack with no formal training. I can learn a lot from looking at your code. I love classes but I can tell from your work that I have a long way to go to fully take advantage of what they can do.

Thanks for sharing.

Relayer

Re: Using AHK for large scale software development

Posted: 23 Dec 2020, 01:51
by TheBigO
Version 1.2 is available for download. Lot's of new stuff, including a themes editor for your own simulation worlds, like Rallye, F1, Flight Sim 2020, and so on.

Re: Using AHK for large scale software development

Posted: 29 Dec 2020, 14:07
by TheBigO
Version 1.3 is out since a few days. The Button Box visual representation now uses photorealistic graphics and you can interact with it using the mouse.

Re: Using AHK for large scale software development

Posted: 01 Jan 2021, 13:22
by TheBigO
Hi, I wish everyone here on the board a happy new year.

And I have a new release out. This time with a very interesting feature also for non-gaming projects, a multibyte, multilanguage translation system for each and every text used (> 400 entries). A graphical user interface that helps to define the translation rules for a new language is there as well.

TheBigO

Re: Using AHK for large scale software development

Posted: 02 Jan 2021, 14:13
by iilabs
That would be awesome. Really appreciate it!

Re: Using AHK for large scale software development

Posted: 03 Jan 2021, 07:27
by TheBigO
iilabs wrote:
02 Jan 2021, 14:13
That would be awesome. Really appreciate it!
It's all there already. You need to extract a few functions from Functions.ahk and isolate the TranslationsEditor classes from "Simulator Configuration.ahk". Nothing very complicated, I think it is doable in about 30 minutes.

Best, Oliver

Re: Using AHK for large scale software development

Posted: 03 Jan 2021, 17:27
by Delta Pythagorean
Give me a few days and I can port an error system that's somewhat similar to python. I use it everyday when creating script sand it works extensively well. Just have to extract it from my own libraries and not have it hard coded lol

Re: Using AHK for large scale software development

Posted: 08 Sep 2021, 08:50
by TheBigO
Time for an update. My software package is growing and growing. As of today, it consists of more than 15 separate applications with about 50.000 lines of AHK code and roughly 10.000 lines of C, C++ and C# code. I have even written a compiler and runtime environment for a hybrid logical programming language completely in plain AHK. This rules engine is used for voice chat capable digital assistants similar to Alexa (domain knowledge is of course racing simulations).

There are lot's of goodies, that might be useful in other AHK projects as well, for example a build pipeline (written in AHK) or a complete automatic software download, installation and update process (written in AHK), just to name a few. Please feel free to use this. I will also help, if you want to separate this from the rest of the system.

Re: Using AHK for large scale software development

Posted: 24 Oct 2022, 10:25
by SandroPaling
Welcome to the community! Your project sounds really impressive - it's great to see what can be done with AHK with a bit of creativity and effort. I'm sure other community members will be interested in looking at your code and learning from it.

Re: Using AHK for large scale software development

Posted: 26 Oct 2022, 07:11
by TheBigO
SandroPaling wrote:
24 Oct 2022, 10:25
Welcome to the community! Your project sounds really impressive - it's great to see what can be done with AHK with a bit of creativity and effort. I'm sure other community members will be interested in looking at your code and learning from it.
Hey, thank you. It is quite a long time, I posted here, but I a still producing tons of AHK code each day. And it is amazing, that it is possible to build really serious applications using a language which started like a simple automation macro language.

Latest addition to my framework, which might be of interest to the AHK community, is a task and coroutining library. I think that it can easily be used standalone with a couple of simple changes: https://github.com/SeriousOldMan/Simulator-Controller/blob/main/Sources/Libraries/Task.ahk

Usage is absolutely simple. Example:

new PeriodicTask(Func("keepAlive").Bind(connector, connection), 10000, kInterruptPriority).start()

This starts a Task, which runs every 10 seconds on interrupt priority level. The obvious question: Why not use SetTimer? Answer: Because you have full control over priority levels, can start, stop and suspend tasks, and things look familar to the coders eye.

Re: Using AHK for large scale software development

Posted: 26 Oct 2022, 12:11
by murataygun
How come you got familiar with AHK so fast. You must be a genius :D

Re: Using AHK for large scale software development

Posted: 18 Apr 2023, 04:49
by TheBigO
Puuh, ported roughly 120.000 lines to AHK 2. What a journey. Took 6 weeks almost fulltime. Tools like AHK2 Converter help a little bit, but in the end you have to take a look at every single line of code.

Learnings:

1. Performance increased by big numbers, especially when working with (hash) maps.
2. AHK2 is much more bullet-proof for the developer and finds many coding problems at startup time.
3. New type system is very flexible. I created a subclass of Gui, for example, which seamlessly implements a window reszing framework with rules integrated into the standard options of a new control (extended the Gui.Add method)
4. It is now very important to handle errors correctly. A lot more try / catch blocks are necessary to keep things running.

Next on my whish list for AHK: Optionally strongly typed variables!