Renegade Projects Network Forums
Internal logics as pseudocode - worth posting or not? - Printable Version

+- Renegade Projects Network Forums (https://forums.renegadeprojects.com)
+-- Forum: Modding (https://forums.renegadeprojects.com/forumdisplay.php?fid=3)
+--- Forum: C&C Modding Encyclopedia (https://forums.renegadeprojects.com/forumdisplay.php?fid=7)
+--- Thread: Internal logics as pseudocode - worth posting or not? (/showthread.php?tid=963)



Internal logics as pseudocode - worth posting or not? - DCoder - 08.04.2008

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.


RE: Internal logics as pseudocode -worth posting or not? - pd - 08.04.2008

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


RE: Internal logics as pseudocode - worth posting or not? - gordon-creAtive - 09.04.2008

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...?


RE: Internal logics as pseudocode - worth posting or not? - Marshall - 23.04.2008

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.


RE: Internal logics as pseudocode - worth posting or not? - DCoder - 24.04.2008

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.


RE: Internal logics as pseudocode - worth posting or not? - DCoder - 07.05.2008

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.)


RE: Internal logics as pseudocode - worth posting or not? - Marshall - 07.05.2008

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.