Jump to content


Photo

[REL] Commandos 2 Mod Kit (Updated: 2016/06/22)

commandos 2 commandos 3 mod kit

  • Please log in to reply
20 replies to this topic

#1 Nightingale1

Nightingale1
  • Members
  • 38 posts

Posted 12 April 2016 - 10:26 AM

c2-mod-kit is a modding utility that aims to enable modders to better use in-game debug information and engine capabilities to mod Commandos 2 more easily. It works only on C2:DP 1.42 and C2-Nightingale mod.

It has a scripting prompt where you can execute commands and see the changes in game.

 

note: I have dropped C3 support.

Current features (Updated on 2016/06/22):

  • Toggle overlay debug info (FPS, Mouse location info, ...).
  • Toggle debug render options (Sectors, Sector Ids, Masks, ...)
  • Getting a list of all objects in the scene.
  • Spawning custom objects.
  • Logging opened files and parsed tags.

Here is a screenshot:

c2-mod-kit.jpg

Instructions:

  • Download latest binary from here.
  • Extract files into your Commandos 2 folder, where "comm2.exe" is.
  • Run "c2-mod-kit.exe"
  • In the console type the following command and press enter:
    %resume
    

Spawning:

While in a mission, you can spawn cigarettes by pressing CTRL+Z and German soldiers by CTRL+X.

 

Logs:

Logs are written in "c2-mod-kit.log".

 

Console:

You can run commands in the console and see the changes in the game:

Here are two example scripts to write and execute (Press enter after each line):

g = c2.getCurrentGame()
g.toggleDebugOverlay(1)
v = g.getMainViewport()
v.enableDebugRenderOption(2, 0)
g = c3.getCurrentGame()
g.toggleDebugOverlay(1)
v = g.getMainViewport()
v.enableDebugRenderOption(20, 0)

You can change the input to the functions and see other debug options. Be careful that some settings will crash the game.


Edited by Nightingale1, 25 June 2016 - 05:41 PM.


#2 The Mercenary

The Mercenary
  • Members
  • 45 posts

Posted 12 April 2016 - 10:42 AM

Huh, that's Chinese for me.



#3 Salvadorc17

Salvadorc17

    title available

  • Members
  • 507 posts
  • Location:Colombia
  • Projects:Destination Norway

Posted 13 April 2016 - 01:12 AM

You can change the input to the functions and see other debug options. Be careful that some settings will crash the game.

The crash is becuase wrong function parameters, or memory acess violation??



#4 Nightingale1

Nightingale1
  • Members
  • 38 posts

Posted 13 April 2016 - 07:46 AM

 

You can change the input to the functions and see other debug options. Be careful that some settings will crash the game.

The crash is becuase wrong function parameters, or memory acess violation??

 

 

I guess since C++ doesn't have array boundary checking, wrong parameters change wrong places in memory where leads to crash. You can mostly find valid numbers by counting up from 0 until a crash happens.



#5 Salvadorc17

Salvadorc17

    title available

  • Members
  • 507 posts
  • Location:Colombia
  • Projects:Destination Norway

Posted 13 April 2016 - 07:22 PM

I guess since C++ doesn't have array boundary checking, wrong parameters change wrong places in memory where leads to crash. You can mostly find valid numbers by counting up from 0 until a crash happens.


So i need to move from 0 in memory adress to the pointer where adress of function is located?? That is what you mean??

#6 Nightingale1

Nightingale1
  • Members
  • 38 posts

Posted 13 April 2016 - 07:35 PM

 

I guess since C++ doesn't have array boundary checking, wrong parameters change wrong places in memory where leads to crash. You can mostly find valid numbers by counting up from 0 until a crash happens.


So i need to move from 0 in memory adress to the pointer where adress of function is located?? That is what you mean??

 

 

No you need to change the function parameters from 0 up so you can find out the correct parameters.

 

For example:

g.toggleDebugOverlay(0)  // This one toggles FPS overlay
g.toggleDebugOverlay(1)  // This one toggles Cursor position overlay
...


#7 Salvadorc17

Salvadorc17

    title available

  • Members
  • 507 posts
  • Location:Colombia
  • Projects:Destination Norway

Posted 13 April 2016 - 08:47 PM

No you need to change the function parameters from 0 up so you can find out the correct parameters.
 
For example:

g.toggleDebugOverlay(0)  // This one toggles FPS overlay
g.toggleDebugOverlay(1)  // This one toggles Cursor position overlay

Yes, no problem, have you tried other functions that does not have only 0 and 1 as value, maybe some function to spawn enemies or something else..



#8 Nightingale1

Nightingale1
  • Members
  • 38 posts

Posted 14 April 2016 - 05:37 AM

 

No you need to change the function parameters from 0 up so you can find out the correct parameters.
 
For example:

g.toggleDebugOverlay(0)  // This one toggles FPS overlay
g.toggleDebugOverlay(1)  // This one toggles Cursor position overlay

Yes, no problem, have you tried other functions that does not have only 0 and 1 as value, maybe some function to spawn enemies or something else..

 

 

I am trying to find ways to spawn and modify objects. But it's much harder than these simple functions that I managed to find.

I'm searching for the function that lists the objects in the scene, after that I'll search for function that can *delete* objects.

After that finding ways to spawn objects will be much easier.



#9 Salvadorc17

Salvadorc17

    title available

  • Members
  • 507 posts
  • Location:Colombia
  • Projects:Destination Norway

Posted 15 April 2016 - 10:09 PM

You have update source, can you post your results here, with some screenshots?



#10 Nightingale1

Nightingale1
  • Members
  • 38 posts

Posted 22 April 2016 - 11:07 AM

Hey guys, I just uploaded an standalone test version here.

  1. Copy the two files from the archive to your commandos 2 folder (where comm2.exe is)
  2. Start c2-mod-kit.exe
  3. In the opened command prompt type:
    %resume
    
  4. Press enter and the game should start.

 

In this test version you can spawn german soldiers with CTRL+X and spawn cigarette packs with CTRL+Z

 

I would really appreciate if you share your test results here.



#11 canstay

canstay
  • Members
  • 91 posts

Posted 22 April 2016 - 02:34 PM

Hey guys, I just uploaded an standalone test version here.

  1. Copy the two files from the archive to your commandos 2 folder (where comm2.exe is)
  2. Start c2-mod-kit.exe
  3. In the opened command prompt type:
    %resume
    
  4. Press enter and the game should start.

 

In this test version you can spawn german soldiers with CTRL+X and spawn cigarette packs with CTRL+Z

 

I would really appreciate if you share your test results here.

But how to activate the add of the enemy, how to save the code to the MIS file ?

Attached Thumbnails

  • 地图人物添


#12 Nightingale1

Nightingale1
  • Members
  • 38 posts

Posted 22 April 2016 - 03:41 PM

 

Hey guys, I just uploaded an standalone test version here.

  1. Copy the two files from the archive to your commandos 2 folder (where comm2.exe is)
  2. Start c2-mod-kit.exe
  3. In the opened command prompt type:
    %resume
    
  4. Press enter and the game should start.

 

In this test version you can spawn german soldiers with CTRL+X and spawn cigarette packs with CTRL+Z

 

I would really appreciate if you share your test results here.

But how to activate the add of the enemy, how to save the code to the MIS file ?

 

 

Thank you for sharing the screenshot, it's good to know that it works.

 

This version is for testing only, there is still a lot to do to be able to save the mission, but I'm working on it.

 

My plan is to figure out important functions and get help from community to understand them and find ways to use them.



#13 canstay

canstay
  • Members
  • 91 posts

Posted 24 April 2016 - 03:19 PM

interesting



#14 Nightingale1

Nightingale1
  • Members
  • 38 posts

Posted 22 June 2016 - 01:10 PM

I added logging features to c2-mod-kit.

I also updated the instructions, you can run it easily by downloading the precompiled binaries.



#15 herbert3000

herbert3000

    Guilty Until Proven Innocent

  • Division Admins
  • 609 posts
  • Location:Austria
  • Division:Commandos HQ
  • Job:Division Admin

Posted 25 June 2016 - 01:10 AM

I wish I had the logging feature a few years ago :D

Looking at the end of the log file to figure out which script file crashed the game is much more comfortable than manually checking the MIS file for spelling errors or missing resources.

 

Would it be possible to detect invalid keywords in the MIS/BAS scripts? I think that the missions from Commandos 3 (converted to C2) have some keywords that are unkown in C2. Maybe those are responsible for corrupted save games.

 

BTW, getCurrentViewport() from the example script doesn't work anymore, is getMainViewport() the equivalent function?



#16 Nightingale1

Nightingale1
  • Members
  • 38 posts

Posted 25 June 2016 - 05:40 PM

I wish I had the logging feature a few years ago :D

Looking at the end of the log file to figure out which script file crashed the game is much more comfortable than manually checking the MIS file for spelling errors or missing resources.

 

Would it be possible to detect invalid keywords in the MIS/BAS scripts? I think that the missions from Commandos 3 (converted to C2) have some keywords that are unkown in C2. Maybe those are responsible for corrupted save games.

 

BTW, getCurrentViewport() from the example script doesn't work anymore, is getMainViewport() the equivalent function?

 

I know the hassle of manually finding errors, it really sucks. :sad2:

I think I saw something in code about handling invalid keywords, I'll let you know if I managed to add this to the logging feature.

Please keep mentioning ideas about features that could help modders like yourself, I'll be really happy to help as much as I can.

 

and yes, I forgot to change it in the thread, thank you for informing me.



#17 Salvadorc17

Salvadorc17

    title available

  • Members
  • 507 posts
  • Location:Colombia
  • Projects:Destination Norway

Posted 25 June 2016 - 07:19 PM

Good to see youre making progress in c2 modkit, but why you have dropped c3 support??



#18 Nightingale1

Nightingale1
  • Members
  • 38 posts

Posted 25 June 2016 - 08:03 PM

Good to see youre making progress in c2 modkit, but why you have dropped c3 support??

 

I thought that no-one is using it to mod C3 so I dropped it, but I'll be happy to bring back the support if it can be helpful to the community.

 

What do you guys think that could be done to make C3 more moddable? And is it worth the effort?



#19 Salvadorc17

Salvadorc17

    title available

  • Members
  • 507 posts
  • Location:Colombia
  • Projects:Destination Norway

Posted 26 June 2016 - 07:47 PM

Yes, c3 deserves a debug version.. It is worth, because can also be modded...



#20 Nightingale1

Nightingale1
  • Members
  • 38 posts

Posted 26 June 2016 - 09:31 PM

Yes, c3 deserves a debug version.. It is worth, because can also be modded...

 

So I will try to bring back the C3 support as soon as I finished adding more logging features to C2.

Any ideas about what features could help modders more? I guess the debug options and logging would be a good start.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users