Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Goober5000 on April 17, 2003, 03:44:35 am

Title: Custom hitpoints implemented
Post by: Goober5000 on April 17, 2003, 03:44:35 am
Well, after a humongous session of cutting, pasting, finding, and replacing, I think I've been able to implement custom hitpoints.

Although this feature is straightforward in principle, it was far from simple to implement, requiring changing lines and variables all over the place - dozens of lines in each of about a dozen files.  I've carefully double-checked and triple-checked the code, but I'd like to post it here for testing before I think about committing it.  Please make sure all the regular features with hull and shields work, in addition to your curiosity about the new feature.  All the legacy code for hull strength, shield strength, and subsystem strength had to be rerouted through the new routines, so I want to make sure everything still works. :)

So, without further ado, here's what I've come up with...
http://fs2source.warpcore.org/exes/fs2_open_hitpoints.zip
Title: Custom hitpoints implemented
Post by: Black Wolf on April 17, 2003, 07:33:18 am
Ooooh... Fancy!

:yes:
Title: Custom hitpoints implemented
Post by: redmenace on April 17, 2003, 09:32:31 am
NO NEW CODE!!!!!!!!:mad:
Title: Custom hitpoints implemented
Post by: Black Wolf on April 17, 2003, 09:54:59 am
Quote
Originally posted by redmenace
NO NEW CODE!!!!!!!!:mad:
Whoa, whoa! Anger, Fear, Aggression - remember?
Title: Custom hitpoints implemented
Post by: CP5670 on April 17, 2003, 10:46:28 am
Wonderful! This is the one feature that I have really been looking forward to; thanks for adding it in. :yes: I will test this exe out in a bit and see if everything works correctly.
Title: Custom hitpoints implemented
Post by: Goober5000 on April 17, 2003, 10:53:07 am
Quote
Originally posted by CP5670
Wonderful! This is the one feature that I have really been looking forward to; thanks for adding it in. :yes: I will test this exe out in a bit and see if everything works correctly.


Thanks! :)

Quote
Originally posted by redmenace
NO NEW CODE!!!!!!!!:mad:


:wtf: Reread the first post.  I haven't committed this code to CVS yet, nor do I intend to until a) I'm sure that it's working; and b) I get Inquisitor's permission.
Title: Custom hitpoints implemented
Post by: Bobboau on April 17, 2003, 10:57:30 am
so.. what is this again?
Title: Custom hitpoints implemented
Post by: redmenace on April 17, 2003, 11:04:19 am
I was just kidding around with you. I have no problem with new code. I knew you hadn't committed. But I think huge modifications that would be potentially too complicated and potentially full of bugs should be put on hold for now.
Title: Custom hitpoints implemented
Post by: karajorma on April 17, 2003, 11:04:31 am
If I've understood it correctly it's an ability similar to special explosion but instead it gives a ship a custom number of hitpoints instead :)

Goober : Does it only change hitpoints (and shields by the look of it) or can you change subsystem strengths using it too?
Title: Custom hitpoints implemented
Post by: CP5670 on April 17, 2003, 11:21:06 am
I haven't tried the game yet, but a couple of issues seem to have cropped up in FRED2_open. It performs an illegal operation error and exits the editor whenever I delete a ship. This also occurs when I try to load one of my missions that opens fine with the standard 3.53, so there might be a conflict with one of the sexps as well.

Also, there seem to be some problems with the showing of ship model outlines in the editor; they don't show up at all in some missions (there is the ship name but no model, not even the generic circle thing to mark the ship's position). In one mission, there is a black waypoint-like object next to the player ship that cannot be selected but shows up as highlighted when the player ship is clicked instead. :wtf: Not sure if all this has anything to do with the hitpoint function, but I thought I should probably point it out.

Let me see if the game itself works normally...
Title: Custom hitpoints implemented
Post by: Stryke 9 on April 17, 2003, 11:31:31 am
Major modifications should be put on hold until... when? The point where everyone loses interest because nothing's going anywhere and quits the SCP? Ragnarok? Tuesday?

I mean, yeah, needs to be bugchecked more thoroughly than a mod that makes the Shivans shoot purple, but there's a difference between appropriate caution and putting something off for no good reason.
Title: Custom hitpoints implemented
Post by: Goober5000 on April 17, 2003, 12:21:56 pm
karajorma: The subsystem values in ships.tbl are specified as a certain percentage of the ship's entire hull value.  I carried this over to the special hitpoint modifications, so that when you change the hull the subsystem strength goes up or down accordingly.  Adding in the ability to modify each subsystem individually would be a huge amount of work.

CP5670: The only difference, to my knowledge, between this fred2_open and the released 3.5.3 is in fact the special hitpoint dialog. :sigh: I'm not getting the graphical errors or the crash on mission load, but I am getting the ship deletion error.
Title: Custom hitpoints implemented
Post by: CP5670 on April 17, 2003, 12:41:42 pm
Those things only happen for certain missions while others work fine; I have no idea what could be causing it, though.

Also, I just tried the game itself and it will not load any mission at all. The briefing shows up fine, but when I click commit it CTD's immediately. :(

[edit] One mission did load correctly (a really generic test mission I made to test out mods; it has almost no events) and I was in the game for about a second, but then it aborted to windows with the following error:

Error: Unhandled obj type -56 in obj_render
File:E:\Languages\Visual Studio Projects\Visual C++\fs2_open\code\Object\Object.cpp
Line: 1863
Title: Custom hitpoints implemented
Post by: karajorma on April 17, 2003, 12:45:13 pm
Quote
Originally posted by Goober5000
karajorma: The subsystem values in ships.tbl are specified as a certain percentage of the ship's entire hull value.  I carried this over to the special hitpoint modifications, so that when you change the hull the subsystem strength goes up or down accordingly.  Adding in the ability to modify each subsystem individually would be a huge amount of work.


Yeah. I figured that was most likely the case. It would be nice to individually increase the percentage for a subsystem but if it's a lot of work I`ll wait until I have a specific use in mind for one of my campaigns before I ask for it :)
Title: Custom hitpoints implemented
Post by: Goober5000 on April 17, 2003, 12:56:29 pm
Quote
Originally posted by CP5670
Those things only happen for certain missions while others work fine; I have no idea what could be causing it, though.

Also, I just tried the game itself and it will not load any mission at all. The briefing shows up fine, but when I click commit it CTD's immediately. :(

[edit] One mission did load correctly (a really generic test mission I made to test out mods; it has almost no events) and I was in the game for about a second, but then it aborted to windows with the following error:

Error: Unhandled obj type -56 in obj_render
File:E:\Languages\Visual Studio Projects\Visual C++\fs2_open\code\Object\Object.cpp
Line: 1863


:mad:

And I double-checked all my code thoroughly, so now I have no idea where to start looking. :(
Title: Custom hitpoints implemented
Post by: Goober5000 on April 17, 2003, 04:44:04 pm
This is extremely strange - for some reason, Visual Studio wasn't compiling all the changed files.  It had somehow managed to successfully link the older compiled versions of two files with the rest of the project, and the result was a whole bunch of access errors when you ran it.  I was able to fix this by rebuilding the whole project.  I can't understand why that may have happened, as MSVC is supposed to keep track of which files need rebuilding. :confused:

Anyway, this version should work a lot better.  Tell me what you think. :)

[link removed -- see first post]
Title: Custom hitpoints implemented
Post by: Goober5000 on April 18, 2003, 01:33:20 am
*bump*

Maybe I should have posted in the first place, instead of editing the previous post. :)
Title: Custom hitpoints implemented
Post by: CP5670 on April 18, 2003, 11:56:10 am
sorry, I couldn't find this thread last night for some reason; was probably just too sleepy... :p

Quote
This is extremely strange - for some reason, Visual Studio wasn't compiling all the changed files. It had somehow managed to successfully link the older compiled versions of two files with the rest of the project, and the result was a whole bunch of access errors when you ran it. I was able to fix this by rebuilding the whole project. I can't understand why that may have happened, as MSVC is supposed to keep track of which files need rebuilding.


Ah, that would explain it. I was wondering what could be causing some of those things, since they seemed to be quite unrelated to the hitpoint mods.

Quote
Anyway, this version should work a lot better. Tell me what you think.
http://www.3dap.com/hlp/hosted/14_y.../fs2_open_r.zip


Cool, I will try it out in a few minutes.
Title: Custom hitpoints implemented
Post by: CP5670 on April 19, 2003, 12:49:36 am
I didn't get much time earlier today but I tried out the exe a few minutes ago and everything seemed to be fine, although it has the problems of 3.53; any chance of merging this into Bobboau's version? Also, do you happen to have a fred2 to go with this? (want to make a mission with the hitpoint edit to make sure it works correctly)
Title: Custom hitpoints implemented
Post by: Goober5000 on April 19, 2003, 03:17:09 am
The previous zip file contained a FRED that ought to work.

Unfortunately, merging Bobboau's stuff is going to take a bit of effort - we probably need to set up a SCP chat or something.  I noticed several insidious bugs (such as the bank loadout bug) in Bobboau's build that had been fixed in the committed CVS stuff - and if there are problems there, there may be elsewhere as well. :sigh: :(
Title: Custom hitpoints implemented
Post by: CP5670 on April 19, 2003, 11:05:42 am
I tried making a mission with that but the game would not open it at all, but it loads missions built with the normal 3.53 fine. Maybe fred2 also had those issues with the compiling old files that you mentioned earlier.

Is there a way to implement it by just using notepad or something?
Title: Custom hitpoints implemented
Post by: Goober5000 on April 19, 2003, 07:33:55 pm
Yeah, but it's a bit complicated.  I recompiled both FRED and FS2, made a test mission, and it works. :) I edited the first post with the final link, so download and check it out. :)
Title: Custom hitpoints implemented
Post by: CP5670 on April 19, 2003, 10:01:06 pm
Thanks, this time the editor works fine; I didn't realize you had updated the original link. I will try making a test mission with this and see if it works.
Title: Custom hitpoints implemented
Post by: Goober5000 on April 20, 2003, 08:53:30 am
Well, I only edited the first post when I made that previous post. :) I made a test mission which worked, so let me know if you have any unforeseen problems.