Posted: Tue Jul 03, 2007 9:14 pm Post subject:
New Locomotor
Subject description: download and try
New locomotion type
Westwood had planned to make TS engine very upgradeable.
For unknown reasons, they didn't implement all
Test my new locomotion type for TS now!
1) Download NewLocomotor.zip.
2) Extract files from ZIP archive to good folder (you can use TS folder).
3) Run Reg.bat (On Windows Vista you must start it from administrator name)
4) Open your Rules.INI file
5) Change Locomotor= tag on some unit.
Please remember, that this is only example
This locomotion totally written on C++ language,
although it contains some version-based-code, because Westwood didn't implement all features.
(In other words, I have special layer, which is using code written on assembler)
This locomotion don't work with RA2/YR. It only works with TS 2.03.
Don't move dll file. If you forget to register dll file or move it, you will have IE, when unit will be created.
In other words, it's rather possible to write your own locomotors using high-level programming language!
(such as C, C++, VB, Delphi)
The programming language must support COM and DLL.
However here exist some problems, which should be researched.
Okay....that's weird....I'm not sure if there's any point in it, as the unit seems to bounce trough structures and terrain. Good start, though. _________________
Don't have TS installed to test this myself, but if it makes units go round in circles is it possible to make them turn as they move forward rather than stopping and turning when you give them an order? _________________ QUICK_EDIT
Don't have TS installed to test this myself, but if it makes units go round in circles is it possible to make them turn as they move forward rather than stopping and turning when you give them an order?
That would be a good feature for all non-tracked units. _________________
i say : go for proper flying locomotor, keep it up , btw please post some documentation as i have lots of free time and i know a little of assembler and C++ as well QUICK_EDIT
Ooo...Great work VK! This will help alot to some of us modders who know C. Now it's high time for a proper Fly Locomotor... _________________ "Don't beg for things; Do it yourself or you'll never get anything." QUICK_EDIT
IF you can use DLLs to make new locomotors, theoretcially, couldnt you use dll files to make anyhitng not already hard coded into the executable? _________________ DRIZZT DO'URDEN AKA ORCA004ky
SCORPION'S REVENGE MOD LEADER
http://www.cnc-source.com/forums/index.php?showforum=27 QUICK_EDIT
VK, you and I both know that code is useless without the proper headers.
(Theoretically I believe you could use this method for other features that use CLSIDs, however, aside from Locomotors, only the non-implemented AIGenerals use them.) QUICK_EDIT
mmm, looks nice , one thing though ;
why did the air transport locomotor stop working after patch ??
-because they changed it or because they changed some ingame coding
btw,why don't you post the old(working) air transport locomotor so we can all come up with other ways to get the same result QUICK_EDIT
it might contain useful info on how to modify(and probably create) dll's for those that don't know i haven't had the time to read much of it though QUICK_EDIT
Joined: 03 Sep 2005 Location: In a building,creating the fench Brotherhood of NOD and recruiting...
Posted: Thu Jul 05, 2007 1:12 pm Post subject:
So, it means that if we can add new locomotors, we can make planes flying like real planes and make them take off like in reality, i mean, a Bf 109 can't take off like a chopper... Do you see what i mean? _________________
and some comment on the code (for people who don't know about coding)
many code languages use not only variables but also classes,
variables can be of many types,for example :
float 2.3
char 'a'
String "TS rocks"
the concept of variable is extended with classes,and a "variable" that has as "type" a class, is called object
for example: harvester,mammoth tank,titan,etc could be objects of the class vehicle
a class contains :
variables,methods that can be called on the objects of that class and other methods,constans,etc
to reference a variable of a class, you need to use '.'
for example, if there is a class vehicle with a variable strength, to access strength,you write : object.strength (with object being an object from the class vehicle in this case)
Code:
if (m_bMoving)
{
// rotate an object
//m_crd appears to be contain the coordenate of the unit
m_crd.X = m_pos.X + m_radius * sin(m_angle);
m_crd.Y = m_pos.Y + m_radius * cos(m_angle);
m_crd.Z = m_pos.Z; the vehicle stays on the ground,so this doesn't change
TechnoClass::InterMoveLocker(m_pObject, 0);
TechnoClass::SetPos(m_pObject, &m_crd);
//m_pObject is the unit, and it's coordenates are set with m_crd,& means this method receives a reference to m_crd and not it's value
TechnoClass::InterMoveLocker(m_pObject, 1);
// increase an angle
m_angle += 0.01;
if (m_angle > 6.2831) //2*pi is an entire circle, so this means,it's ;back at where it started->m_angle=0, cuz 2*pi radians=0 radians
{
m_angle = 0;
}
}
return m_bMoving; Last edited by k212 on Thu Jul 05, 2007 1:37 pm; edited 1 time in total QUICK_EDIT
I wasn'ty aware trains were broken. They seem to follow the tracks perfectly fine...
I think the 2 most important ones are a jump jet locomoter with out thwe invincibilertty stuff and a flying locomoter that works with transports. But seeing as both those locos exist mayby it's easyier for CnC VK to fix those problems in ETS? QUICK_EDIT
trains are not broken, but you can't build them ingame without problems, this might(i'm not sure) give us the option to solve this
btw if you make a new locomotor with the same name of an existing one,does it overwrite the old ones, like when you put new shps and vxls in an expand.mix with the same name like the old ones or ...? QUICK_EDIT
nice "Proof of Concept" CNCVK, shame this particular loco is completely useless
Would it be possible to cart over any of the RA2/YR locos, to TS ?
also would a BalloonHover= (RA2 tag) effect be achievable via loco's
Finally, would it be possible to clone the Amphibious APC loco, so that it is possible to have more than just one amphibious loco (with alternate image)... i would imagine this would need further .exe editing to get working though
P.S. OT Please give us turrets on aircraft ability for rotors _________________ QUICK_EDIT
I think the biggest prioirty should be to try and make less buggy versions of the orig locos (eg jump jet vehicles that arn't invincible, turrets on aircraft etc) rather than bring in the RA2 locos.
@k212:
I highly dout a new loco will fix problems with trains seeing as I thought part of the problem was a train when built by a factory wouldn't be built on the track and also their isn't a way to make it so when you build X, Y and Z are also built which then do nothing other than follow X. QUICK_EDIT
@dragonfly : actually there is a way to set Z ,X and Y when you build a new unit , but only with airplanes i think ; when all helipads are full and you make a new airplane, it comes in flying (has height) , although i don't think this is to any use QUICK_EDIT
Also Known As: banshee_revora (Steam) Joined: 15 Aug 2002 Location: Brazil
Posted: Thu Jul 05, 2007 4:43 pm Post subject:
SMIFFGIG wrote:
nice "Proof of Concept" CNCVK, shame this particular loco is completely useless
Would it be possible to cart over any of the RA2/YR locos, to TS ?
You'd need to rewrite them.
Quote:
also would a BalloonHover= (RA2 tag) effect be achievable via loco's
No, because BalloonHover is a property from a class defined by game.exe. I believe that the locomotor dll receives parameters such as position, object and radius (as showed on CnCVKs sample above). So, you can change the values of the properties of the object, but you can't add new properties.
Quote:
Finally, would it be possible to clone the Amphibious APC loco, so that it is possible to have more than just one amphibious loco (with alternate image)... i would imagine this would need further .exe editing to get working though
I guess we could code something like that... QUICK_EDIT
also would a BalloonHover= (RA2 tag) effect be achievable via loco's
No, because BalloonHover is a property from a class defined by game.exe.
But BallonHover is nothing else than a Hover-Locomotor with a raised flying height. So i'm quite sure it is possible.
Something that would interest me is, from where do we get the variables?
I mean the Global Variables in rules.ini should be accessible. Like
HoverHeight, HoverDampen, HoverBob, HoverBoost, HoverAcceleration, HoverBrake
or the Jumpjet Variables like WobblesPerSecond etc.
Maybe it just suffice to use them in the code. But if not, what kind of variables do we have access? Can we have timer for infinite animations even while standing, like hoverwobbles?
What kind of classes do i can/have to import?
From where do i get those?
Do i have to use constructors/functions where i put the locomotor behavior code? How should they be named so i can use them in rules.ini?
Also Known As: banshee_revora (Steam) Joined: 15 Aug 2002 Location: Brazil
Posted: Thu Jul 05, 2007 8:05 pm Post subject:
BallonHover is a property of a vehicle type related class.
Quote:
I mean the Global Variables in rules.ini should be accessible. Like
HoverHeight, HoverDampen, HoverBob, HoverBoost, HoverAcceleration, HoverBrake
or the Jumpjet Variables like WobblesPerSecond etc.
Yea, they are suposed to be accessible, but only VK would know the answer for that. QUICK_EDIT
if there is a way to acces variables from rules.ini,we might actually add more superweapons, cuz probably they are just stored in an array[6] (length=6,cuz 6 superweapons)
i think it's an array ,cuz even if you add more to the list, it doesn't actually 'read' them, also it reads the superweapons secuencially, as proven in super weapon research (if you insert a new superweapon in the middle,the rest changes)
so maybe all we need to do to get them working, is to increment the size from 6 to whatever and it might work
also all these variables mentioned before all have virtual memory adresses,so we might be able to 'overwrite' hardcoded things if we find a way to change these values once the old ones have been written
for those who want to know more, if you have an except.ini in your SUN directory you might see something like : CS:EIP (CS is the segment, EIP offset) , these are of course numbers if we're talking about memory adresses and are mostly written in hex.in except.ini you'll see memory adresses where something 'wrong' happened :p QUICK_EDIT
Wow, very nice stuff going on here. Im actually very interested too see how this works, so some questions:
I understand the C++ code, but am not entirley sure how the game reads it...? And I'd also like to take a look at that assembly code you mentioned, I reckon that it the key to the above.
> The locomotors currently folow the format of GUID's, which is then read by the game right? Why though? Its not realy important, just curiosity - I can generate GUID's easy enough But how did you "tell" the game which GUID to use?
But in any case, very cool stuff here, Well done, very well done. _________________ Last edited by Creagor on Sat Jul 07, 2007 2:30 pm; edited 1 time in total QUICK_EDIT
Another question (@C&CVK):
As i can see, you can control what kind of animation the legs do. Am i right, that you can create this way a kind of Mech/Animal-Loco that can play more than just the walking frames? Like an additional standing anim or jumpjet flying animation.
Is it this way maybe even possible to have shp units with 32 instead of 8 facings? (for the walker section) _________________ SHP Artist of Twisted Insurrection: Nod buildings
The locomotor controls the way it moves, the way it uses the frames, rather than the frames thenselves. The C++ code above uses simple maths to create a circle pattern, but with enough thinking you could get interesting things... _________________ QUICK_EDIT
theoretcially, couldnt you use dll files to make anyhitng not already hard coded into the executable?
no.
Quote:
(Theoretically I believe you could use this method for other features that use CLSIDs, however, aside from Locomotors, only the non-implemented AIGenerals use them.)
AIGenerals isn't implemented.
Quote:
VK, you and I both know that code is useless without the proper headers.
As i can see, you can control what kind of animation the legs do.
no. this standard behaviour.
Quote:
Yea, they are suposed to be accessible, but only VK would know the answer for that.
it can be accessible by some code.
I don't modify any code in EXE file at all.
This is test - you will have IE, if you try to save/load game.
Short explanation how it work.
Because Westwood isn't realize all code, we still should use thunks on asm code.
In other words, we can compare TS Engine with Operating System.
OSy gives to programs different APIs.
(such as memory management, files system, UI things)
I can create a DLL file which will export most of important TS Engine functions.
So you will link you program with my DLL and you won't by worried by writing an assembler code.
So for example, if you want to see "Speed" value from RULES.INI file, you will call "Type_GetSpeed function".
theoretically, the DLL file with locomotor can be ... in another part of world. By using RPC
In attachment, you can see a VKLocomotor code.
Please DON'T use my GUID value.
(This code designed for CL.EXE 14.00.50727.42, if you want to use another compiler, I can create code for it)
do make planes which can land/take off on a run way (even if that runway has to be a preset direction) as jump jetting planes don't aways look to good. QUICK_EDIT
no, don't make new locos first of all.
Please make a tutorial how we can make new locos.
Else you get a huge amount of loco-requests: please make me plane-loco,mech-loco,jumpjet-loco, air-transport-loco etc _________________ SHP Artist of Twisted Insurrection: Nod buildings
No,I mean, how did you get the game to "know" that the GUID of {0C2F47D2-34F5-445a-A38A-D66C70329646} executes the code in the DLL.
Edit: Never mind, one look at Main.h explained all
Im still looking at the code now. Not being that familiar with C++ doesnt help, bit I can see how it works at least. I need to take a closer look, this is really interesting... I reckon other stuff - not just locomotors could be added/changed with this method, with the right coding and enough knowlage. _________________ QUICK_EDIT
Okay, you've got my attention. So much for being inactive for a year...
This is totally amazing! You've finally cracked TS's CLSID system! I have so many questions and interests, I'll just try to put down what I can think of:
-Is it possible to implement an AIGeneral, despite the feature being unused? Like, is the framework in place despite there not being any actual classes defined by the game, such that we could plug in one of our own if we could somehow figure out how they're supposed to work?
-Could you do the kindness of making a .h file defining a "generic locomotor" class that we can derive from and make our own locomotors with? To take care of all the mind-numbingly messy stuff to deal with.
-Can we make our own implementations of the classes defined in the TLB files? I'd guess they're totally unrelated to this, but I really don't know.
-Can we isolate and export the assembly code describing WW's own Locomotors, and put them into a DLL of their own? Would this allow us to splice RA2/YR Locos into TS, or possibly even import the working TS1.0 flight Locomotor without losing the FS stuff?
-How much control does a Locomotor have of the TS engine? Can we, say, make a Locomotor that spawns a trail of Tiberium behind the unit? Or a "chrono" locomotor that actually leaves an animation behind when it teleports?
-If Locomotors can control animation frames, could we make a better "slave miner" effort for vehicles that behave the same way as infantry?
-Are HVA animations controlled by Locomotors? Could we make a RA2-style loco that actually plays the HVA animations of units while they fly around, for stuff like rotors?
I could really just keep going on, but I'll spare you. QUICK_EDIT
Surely you would have expected this to be the next logical step in fully tearing down the walls and boundaries?
I am very pleased to see such work being pursued, might even convert PreRA2 over to YR if such stuff as this get put into Npatch. Seriously VK, you're a genius, this kind of stuff is what keeps these old games alive, and in this case makes them better. Good show! QUICK_EDIT
Joined: 14 Feb 2006 Location: Flying into hostile territory
Posted: Sat Jul 28, 2007 12:41 am Post subject:
wrong. I've gotten them to work. the generals are not referenced from the exe it references AI.tlb its just that they are under developed as ww seemed to have abandonned the feature in its early development. _________________
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum