Git Product home page Git Product logo

h2codez's Introduction

H2Codez

A mod for the H2EK that aims to restore use of existing broken or otherwise disabled functionality, fix bugs/crashes, and add new features or re-add removed ones.

status

Changelog

  • Restore tool commands used by bungie to distribute lightmapping over multiple machines.
  • Real-time tag editing.
  • Increased FPS in Sapien (hardware TCL/vertex processing).
  • Unit playtest mode. Spawns a player letting you test how something would work with one/seeing the map from an in-game point of view. (no movement).
  • Some H2tool commands restored. (model-collision, model-physics).
  • Basic render model import method (BSP conversion).
  • Shared tag removal made optional.
  • Restored JMS import function. Can import both CE JMS and JMSv2.
  • Tag restrictions removed in Guerilla.
  • Some hardcoded limits have been increased/removed. (BSP 2D checks, BSP 3D checks, max 3D BSP depth)
  • Open as text has been restored and will open a temp txt file with the source text inside. Buttons labeled as "open as text" have been relabeled as "export as text".
  • Baggage.txt command now usable and no longer causes a crash.
  • Hs_doc added to Sapien and Guerilla drop down menu. Modified to include script globals.
  • New input box for commands in Sapien to replace console. Allows copy and paste.
  • New command that allows use of lost misc commands. See extra-commands in H2Codez manual.
  • Rich Presence has been added to the toolset. (Discord integration)
  • Allows compiling of scenario types other than multiplayer.
  • Support editing larger scripts.
  • Add "New Instance" menu item to Guerilla and Sapien.
  • Removed limitation on multiple Sapien instances.
  • Added copy (ctrl + c), paste (ctrl + v) and clear (delete) support to Sapien console, paste replaces the whole line.
  • Add configurable console history size.
  • Add back support for the following HS types
    • AI behaviour
    • Conversation
    • AI orders
    • AI (starting locations referenced by block index)
    • Point reference
    • Style (internal ID only)
    • Navpoint (internal ID only)
    • AI command list (internal ID only)
    • HUD message (internal ID only)
  • Use default OS style for file/folder selection dialog.
  • In-game display settings option in Sapien.
  • Custom director speed.
  • Workaround for graphical artifacts on some Nvida cards.
  • Some misc changes and fixes.

Installation

  • Apply the patches using bspatch.
  • Download the latest build of h2codez from releases
  • (optional) Install the Osoyoos launcher so you don't need to use the command line.

Contributing

Contributions are welcome, MSVC 2019 is currently used to build release DLLs, and is therefore the recommended IDE. If you are not sure what you want to work on take a look at the bug tracker.

Compiling

  • Clone and build the MSVC solution, if the toolkit is installed in an unusual location you might need to change the output directory.
  • Follow the steps listed under installation to get patched exes or manually inject H2Codez.dll into the process at startup.

Reporting Issues

  • Report issues on the bug tracker, please include an explanation of how you caused the issue.
  • If the issue in question causes a crash, a minidump should be generated, hang on to it as it might be needed to fix rare bugs.
  • If in doubt about including a detail, include it as more details about a bug make it easier to understand and fix.

H2PC Project Cartographer Team

Visit: www.halo2.online

Project Cartographer Repo: https://github.com/PermaNulled/cartographer

Our Discord: https://www.discord.gg/fqgj44m

Hope to see you in-game :)

Credits

  • Kornman00 for his research in this field years ago as part of OpenSauce, which has helped a lot with this project.
  • General-101, Ling Ling, Twinreaper and others, for testing the patches and suggesting new ones.
  • Authors of all thrid party libraries used.

Acknowledgements

  • Cyboryxmen for his modified JMS export script known as Waltzstreet
  • TheGhost/CtrlAltDestroy for the modified JMS exporter known as JMS_Exporter_v1-0-3
  • Grimdoomer, for writing the guerilla layout viewer which was a huge help in understanding the tag defintion format.

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

h2codez's People

Contributors

berthalamew avatar general-101 avatar himanshu-01 avatar nukeulater avatar num0005 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

h2codez's Issues

Folder Names

When you create a folder for one of the object types in Sapien it will name the folder the first character of what you enter in the input box for it.
image
image

Script issues

Issues that prevent scripts from SP maps from just working that go beyond missing assets.

ai_current_actor
appears to be a command script related function. Somehow gets the name of the squad through the squads that get this command script assigned to them?

points
cs_go_nearest has cases where only the point set name is used instead of the point name and then a specific point. This doesn't seem to be accepted by the compiler. Is there something where tool randomly selects a point or where the game randomly does this?

Script Size
Acts strange when it reaches the default campaign script size. Starts cutting off a small portion at the end and it can be worked around by adding extra lines.

cs_movement_mode short
Compiler doesn't accept this. I'll need to look into what this is later.

ai_combat_status ai
This script function is used to return an integer and that is usually used in an if statement to see if the AI is active and do something. However it is comparing integers and the scripts use words like ai_combat_status_active. Is there sentences with assigned levels to them that the original toolset understood?

Missing Sapien map type strings.

Sapien is missing the strings for the map type as seen here.

https://i.imgur.com/r3ezRl7.png

Looking at H2alang.DLL one can find the strings here in ResourceHacker you can find the strings.

https://i.imgur.com/sdIpUF2.png

310, "\000Single Player" 312, "Multiplayer" 314, "\000Main Menu" 316, "\000Multiplayer Shared" 318, "\000Single Player Shared"

According to Ale(Num0005), the \000 means that the string is commented out and thus shows empty in the editor. If we simply remove the \000 and save the DLL like so...

310, "Single Player" 312, "Multiplayer" 314, "Main Menu" 316, "Multiplayer Shared" 318, "Single Player Shared"

We now get this when using Sapien.

https://i.imgur.com/ZyqwD33.png

Getting this into H2Codez would be helpful for users.

Collision gets built outside directory.

When building a collision it ends up outside the directory. This isn't really an issue as you just have to copy the file into the directory where it belongs but still. This causes issue for the model-object command. If you have the collision file where it was built then it won't be able to find it. If you just move it back into the folder where it belongs the command will bug out. If you add a \ at the end of the command so that it builds inside the folder it will but it will have no name and even if you rename it, model-object will bug out because the file doesn't exist outside the folder.

Singleplayer maps compiled using single_player_shared.map instead of shared.map crash.

There is a section in H2Codez here

https://github.com/Himanshu-01/H2Codez/blob/H2OS_EK/H2Codez/H2Tool_Commands.cpp#L364

Uncommenting this line causes the compiler to crash whether the map is singleplayer or not. Not sure if bin files might affect anything as you can delete the bin folder and maps will still compile. Here is the log

https://pastebin.com/U6E3PH20

Look at line 106-109. This is what tool says about the missing bin files

file_open('C:\Program Files (x86)\Microsoft Games\Halo 2 Map Editor\bin\ui_shared_resource_header.bin') error 0x00000003 'The system cannot find the path specified. '
file_close('C:\Program Files (x86)\Microsoft Games\Halo 2 Map Editor\bin\ui_shared_resource_header.bin') error 0x00000006 'The handle is invalid. '
file_open('C:\Program Files (x86)\Microsoft Games\Halo 2 Map Editor\bin\multiplayer_shared_resource_header.bin') error 0x00000003 'The system cannot find the path specified. '
file_close('C:\Program Files (x86)\Microsoft Games\Halo 2 Map Editor\bin\multiplayer_shared_resource_header.bin') error 0x00000006 'The handle is invalid. '

Map still functions ingame and seems to suffer no negative effects.

This is a log and dump file with line 364 in H2Tool_Commands.cpp uncommented.

https://pastebin.com/suR0xBzC

https://mega.nz/#!l8kgXD5A!2_0EcCrfn-3FPBjxVcL8FXQvZYrmQfA5fcVYSnFcZac

Same map from before except with that line uncommented packaging fails.

Model-object command does not work as expected.

The model-object command can find the render/collision/physics folder and recompile them if it needs to. The problem is that it then generates the model and object tag in the data folder instead of the tags folder. If you try to correct for it and replace data with tags it can't find the asset folders but everything else seems to work fine. On top of that the code that writes the path to the tag doesn't correct it so it writes the full path to the tag instead of just writing the path local to the tags folder.

Text field gets cut off

Last few lines in a long script file get cut-off when saving, can be worked around by padding the file with extra lines to avoid script text being destroyed.

Likely related to #19, reported in #57 for script fields, have not verified it happens with all text fields like the previous issue.

Fix running tool from guerilla.

Used by bitmaps, models and a few other things. It's attempting to launch tool instead of h2tool and when it does launch we see issues with character encoding.

  • Fix name used for Tool by Guerilla.
  • Fix character encoding issues.
  • Fix discord rpc crashing on tool exit.

Model-render will crash if import file is located in the my documents tag folder

Leaving this here so that people are aware if someone else asks.
Any import files used to build a render_model that are located in

C:\Users(USERNAME)\Documents\Halo 2\tags

will cause h2tool.exe to crash as soon as it has finished building the scenario_structure_bsp. I'm assuming the cause for this is as soon as the first step is finished it then attempts to locate the file which is not in the place it expected it to be. All render_models should be built from their standard location in program files for the time being.

ai_current_actor possible missing global.

reported in #57

Saw something like that set in halo2.exe need to check if it's exposed as a global, if it is a global it's part of the bigger issue of globals missing or having the wrong ID in the toolkit.

Overly complicated shader view

The current shader editor in H2Codez I assume was part of Korns plan to change the shader system in Sapien to somehow used compiled shader files from the extracted maps. Either way the current system we have in place makes things really complicated for no reason. If you comment out line 38 and 39 in H2Guerilla.cpp like so.

// Disable Tag Template Views
//BYTE k_mod_bytes[0x3] = { 0x33, 0xC0, 0xC3 }; // xor eax, eax; retn
//WriteBytesASM(0x48E730, k_mod_bytes, 0x3);

This disables the more advanced shader view and returns it to its vanilla form. I would prefer that this would be changed to be something we can enable much like expert mode in Guerilla. Something where the default view is the vanilla shader template system we use and a drop down menu to enable advanced shader editing to view the more complicated shader outline. This is because the extracted shader files still have data that can only be viewed here and is useful for remaking the shader files properly.

Mismatched global IDs.

Global IDs are mismatched with the ones used in halo2.exe likely due to globals being removed.
There was a similar issue with command IDs/opcodes but that was easier to fix as the mismatch was smaller.

This results in some globals not working correctly even if they are linked up to a value in the game.
Possibly related to #61.

Some enum types broken.

There was some weird stuff going on with how it looked up the enum value even resulting in crashes.

Guerilla script length

The default amount of maximum characters allows in a script is pretty short. Scripts like the one linked below do not fit into the editor. In order to get around this we use a program called H2V Script Maker. This helps us make longer scripts than what is normally allowed in default H2Guerilla. Even default scripts from the campaign do not even fit into the script entry and will be cut off. I would like to see this be changed so that we can type much longer scripts inside the editor. Scripts made with the H2V Script Maker will work fine. They will even display fine when you open them in Guerilla. They will be cut down to back 4098 bytes if you attempt to edit them in Guerilla though.

https://pastebin.com/rafaUuqW
http://www.h2mt.org/tools/2_Vista/Scripts/H2V%20Scripting%20Maker/1.1/
https://i.imgur.com/DCL1jsr.png

Add sound import functionality to h2tool.

Some of the functionality seems to be there, needs to be looked into more. If that doesn't work it could be rewritten from scratch. Low priority since there is a work around using HEK.

Split off from #8 as it's a separate issue.

Widgets tag block doesn't work properly

The widgets tag block in Guerilla takes .cloth tags but the tag can't be seen in the file browser. Just open
objects\weapons\multiplayer\flag\flag.weapon
and scroll down to widget. Clear and attempt to relink the cloth tag.

Character tags do not get their dependencies added

This issue affects maps packaged with a character tag. Character tags unlike any other tags will not have their dependencies added to the tag under seemingly no circumstances. Attempts to use the tag shared removal or hex editing shared to change the name of the resource it looks for does not resolve the issue.

This is somewhat important as this tag controls the properties of the AI such as what weapons they can fire and how they fire them. Current animation swap requires a custom generic.character parent tag and because of this AI on maps will not fire until references to the weapons are added manually in Assembly.
For an example of this issue compare generic.char in a default shared.map to a compiled generic.char in a custom firefight map.

Crashing from packaged maps using shared reference removal.

Putting this here for reference in the future.

I've been working on the resource maps and found that a map packaged with H2Codez and the shared reference cause a crash when loaded ingame. I tried to see what was causing it and it seems to be something related to H2Tool_Commands.cpp.

void H2Tool_Extras::apply_shared_tag_removal_scheme()
{
BYTE* patching_offsets_list[] = {
CAST_PTR(BYTE*, 0x5887DF),//_postprocess_animation_data
CAST_PTR(BYTE*, 0x588C21),//_build_cache_file_prepare_sound_gestalt
CAST_PTR(BYTE*, 0x588D52),//_build_cache_file_add_tags
CAST_PTR(BYTE*, 0x588DCD),//_build_cache_file_add_sound_samples
CAST_PTR(BYTE*, 0x588E37),//_build_cache_file_sound_gestalt
CAST_PTR(BYTE *,0x588E99),//_build_cache_file_add_geometry_blocks
CAST_PTR(BYTE *,0x58908E),//_language_packing
CAST_PTR(BYTE *,0x5890A7),//_build_cache_file_add_language_packs
CAST_PTR(BYTE *,0x589105),//_build_cache_file_add_bitmap_pixels
//CAST_PTR(BYTE *,0x589181),//_build_cache_file_add_tags
};

BYTE patch[1] = { 0x0 };
for (int x = 0; x < NUMBEROF(patching_offsets_list); x++)			WriteBytesASM((DWORD)(patching_offsets_list[x] + 1), patch, 1);//patching push 1 -> push 0

}

Commenting out line 253 like so fixes the crash but doesn't add the tags to the map like it would before it seems. I do not believe this is a tag issue but I haven't done a lot of testing.

ai_movement_mode and ai_combat_status should be enum-like values

Reported in #57

cs_movement_mode seems to have accepted values like ai_movement_patrol when using the bungie toolkit according to dumped scripts. A similar issue happens with ai_combat_status related functions.

Could possibly be worked around by creating globals with those names and values? Or pre-processing the scripts and replacing the values. Will need to look into compiled scripts for more info.

Invalid script

(device_set_position_track dck_hog_rail track:rail 0)

track:rail is seen as an invalid string id. I'm not sure what track:rail is supposed to be. I was thinking maybe it works like (action):(node/marker?). I can't find anything labeled track in that object.

BSP Conversion Command Incomplete

Basically see title. I will try to explain as best as I can.

Add name . Basically just take the name of the scenario_structure_bsp file or the .ASS file name.

Check "force node maps" flag

Add a single region. Name should be default.

Node map offset in the region tag block should be -1

Add a single permutation. Name should be default.

change global_geometry_classification to rigid in section tag block. Should never be anything else for BSP imports.

Change geometry_classification to rigid in section tag block. Should never be anything else for BSP imports.

Rigid node should be set to frame in section tag block.

In the parts tag block "override triangle list" flag should be checked for all part indexes.

Material should be assigned in the parts tag block.

A single node map should be added per section tag block. Index 0 should be the only number used as there should only be one node in a BSP import.

A section groups tag block added and all LOD flags checked

Add a single node named frame. Needs to have the exact same setup as shown in modelCOMPLETED.render_model

All materials from the materials tag block brought over.
model.zip

See
https://num0005.github.io/h2codez_docs/w/H2Tool/Render_Model/BSP_Conversion.html
for a more indepth explanation.

Blender object scales not converting correctly

I'm new to making custom H2 maps. I followed the blender tutorial here: https://github.com/Project-Cartographer/H2Codez/wiki/Blender-Map-Making-Tutorial., but I'm having a problem. Somewhere between the process of extracting the .blend file as a .ass, and converting the .ass with h2tool, the dimensions of my objects are changing. I'm just working with basic cube shapes right now, but if I set the scale of the cube in blender to 10x10x5 for example, the scenario that opens in Sapien is never that same dimension. Sometimes it's a perfect cube, 10x10x10. Sometimes the scales get stretched in the opposite direction too, making it appear as a 10x10x30 cube.

Here's a test where I have one flat cube, and one tall cube in blender. After extracting and converting, and opening it in Sapien, the flat cube is now tall, and the tall cube is now a perfect cube. Does anybody know what could be happening here?

Any help is appreciated :)

issue1
issue2

Needed Sapien improvements

Sapien is missing a lot of important things. One of the more frustrating things is the missing items from the list as seen in the following image.

H2Sapien
https://i.imgur.com/5CSBJBn.png

Compare this to H1Sapien
https://i.imgur.com/esXdyeu.png

Most likely the H2Sapien Bungie had. Found in the map editor tutorial on page "Place Spawn Points in H2Sapien". While similar it is probably not H1Sapien.
https://i.imgur.com/AXECMwh.jpg

We are missing a lot of the AI related stuff. If we want to create SP maps in the future then a lot of this stuff has to be restored to Sapien. Most of this can be done through Guerilla but it is painfully slow and more labor intensive in most cases.

Sapien also seems to have a similar problem to Guerrilla in terms of certain tag types being disallowed. Sapien will usually not allow the addition of certain tags to its object palettes. Things like bipeds and more advanced tags like UI stuff.
The above was an error on my part. Tags in documents are not added to the palette because Sapien only reads from the H2EK install path.

Missing script functions also make it difficult to test scripts related to AI. Things like AI_place will not work in Sapien. Most of these things can be found in halo2.exe according to Himanshu. Not the most important thing in the world if it works ingame but will be useful.

Lighting maps with multiple pc's

Wondering if the functionality of compiling the lightmaps over multiple Pc's like Bungie did with their "light farms" is still in the h2tool's and if so could be brought back or could be reworked to make the tool use multiple cores to help speed up lighting times when compiling maps on super or on higher lightmap resolutions.

Some enum types broken.

There was some weird stuff going on with how it looked up the enum value even resulting in crashes.

Script expected something different?

(sleep_until (= (volume_test_objects vol_hangar_center ai_current_actor) TRUE)) is not considered valid

Error from tool output
[04a_gasgiant_mission line 1361] i expected a value of type object_list, but the variable ai_current_actor has type ai: ai_current_actor) true))

Edit: Had to edit the script to be
(sleep_until (= (volume_test_objects vol_hangar_center (ai_get_object ai_current_actor))
as the way it currently is doesn't make sense.

Sound functions

As you may or may not know, H2Guerilla has issues with managing sounds Most of the sound related options in the sound tag cause H2Guerilla to crash due to I assume the code behind handling how to do that missing. My suggestion is for someone to somehow port over sound related workings from H1Guerilla into H2Codez. As you also may or may not know we use Halo 1 tool to convert sounds for Halo 2. Normally these sounds would not work out of the box if compiled in H1tool, but if you compile it with an Xbox codec using a linked pack below you can get a result that is compatible with H2EK. Most of the options you can use to edit said sound in H1Guerilla also seem to affect H2Guerilla. It would also be beneficial to also try bringing over the sound import function for H2tool since it has worked so far to bring over sounds. This would be a fantastic step forward as we can begin to phase out the usage of H1tools. This codec pack can also be used to play sounds in H2Guerilla when placed in the bin folder.

https://mega.nz/#!YwsEwbTB!fBE5nZ_2f4XHhVlhvVJmwVa5Fgiy4oGHWwA5UphmNSM

Crashes if structure painter is selected

It won't crash if the game window isn't being rendered. No clue on what structure painter even is. I'm pretty sure this is a default bug in Sapien and not a H2Codez bug but it's there if anyone gets curious.
image

Document settings.

Not sure how to go about this, could try and put the description in the config or could just document it on the wiki.

Broken HaloScript types.

The converters for the following types are missing and need to be recreated.

  • AI
    • AI Squads
    • AI Squad Groups
    • AI Squad Starting locations.
  • Style
  • Navpoint
  • AI command list (unused)
  • Hub message (obsolete, functions that use it appear to be non-functional, hud rendering code removed?)
  • Point reference

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.