Renegade Projects Network Forums

Full Version: Internal logics as pseudocode - worth posting or not?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was wondering, would posting chunks of internal logic flow like this (WIP) be worth having at ModEnc? It does provide the insight, but will probably need someone to simplify it into layman's terms.
Since DLLs will be coded in C++ and the code you type using YR++ will look similar (not equal to that of course!), it might indeed be helpful as examples.

Besides, it makes the code accessible by people who can't read ASM. Wink
For normal modding this is quite useless (I think) although i find it VERY interesting. But I think with the release of YR++ this will be important...?
I concur with gordon's sentiments. For RP2 I suspect pd will release the source of his DLLs which should be sufficient for us to create further ones, however knowing how the game's native logics tackle things would be useful and interesting.

EDIT:
I've been looking at that pseudocode for some time and have finally figured out what was confusing me:
Code:
if ( weap1->Warhead->IsLocomotor
           && target
           && target->WhatAmI() == IS_BUILDING )
        return USE_SECONDARY;
...is completely unneccessary as long as the Verses are set up correctly.
I've switched MagneticBeam and MagneShake in my mod so that the Magnetron can attack walls, and it works fine.
Lol at WW.
My thoughts when asking were that a sample like this explains the internals in detail (which is not always the same as what observing a game from a modder's perspective suggests), and is easier than typing out all the cases in plain English. (Case in point: the sample I gave already shows how many special case weapons assume they will only be in a particular primary/secondary weapon slot.)

Edit: Marshall, I believe that snippet was a block to avoid Locomotor weaponry attacking buildings when the locomotor weapon code was still in development, since internally buildings derive from a different class than the mobile objects and thus special code is needed to detect that (well, two lines of special code is not much, but ... we all know who wrote this game.). I think I should describe the main concepts in the game before posting more snippets.
I'm updating the repository bit by bit, and now I have a few questions: thus far, I've been posting simplified pesudocode that resembles C++, but isn't quite C++. I've been doing that to avoid the unnecessary complexity of C++ and focus on the actual algorithms. However, I have no way of assessing the readers' skill level in C++. Some of you might be familiar with it from high school/university, some might use it everyday, and some might not have seen it at all. So, I don't know if I should extend the quick reference to cover C++ basics like for/while/new ? Or should I stop dumbing it down and post it like it should be, full of gory scopes and dangling pointers? I'm asking because not understanding the way object functions work can lead to confusion and misinterpretations.

(Yes, I know my colorifications don't help that much. I'm not an artist, remember, that is a close approximation of what my IDE looks like.)
I understand [most of] what you've posted thus far.
Seeing as how the RP2 dlls will be C++, it makes sense for any pseudocode gleamed from the exe to be the same.