Outpost Universe Forums

Projects & Development => Outpost 2 Programming & Development => Topic started by: rmiddle on October 09, 2015, 01:07:48 PM

Title: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: rmiddle on October 09, 2015, 01:07:48 PM
I see instructions for VS 2012 but I can't figure out how to make those instructions work with VS 2015.

Thanks
Robert
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: leeor_net on October 09, 2015, 01:13:08 PM
Visual Studio 2015 shouldn't be much different than VS2015 so setup should be basically the same.

We're looking into creating official VS2015 project files and packages in an effort to bring the development API's to modern IDE's.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: Arklon on October 09, 2015, 02:22:33 PM
Yeah, it shouldn't be too different to set up VS2015 to use the SDK. You can't convert the MSVC6 project files directly to 2015, though, and I don't know if the project files on the SVN have been converted yet. If they're not, you need to get VS2008 (you should be able to find the express version around still), load the MSVC6 project in it to convert it to VS2008 format, and then you can load the VS2008 project in VS2015.
I don't have VS2015 installed yet myself, but I will soon. As in, when I feel like cleaning up C: to make room for it, because Microshit refuses to let you install VS since 2012 on any other partition.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: Hooman on October 09, 2015, 02:51:12 PM
A few months back I converted a few of the MSVC6 project files in SVN to VS2012. Those project files might work with VS2015.

Microsoft doesn't seem to have VS2008 up for download anymore, which is the last free version that can still read the MSVC6 project files. I hear the newer pro versions can still read the old project files. If anyone has an old copy of VS2008, or a pro version floating around, feel free to upgrade project files. When I did the conversions, I was doing it by manually recreating new project files. It's tedious, hence I didn't finish doing it for every project.

And yeah, there's been talk of standardizing things for VS2015. Maybe someone can do that soon. I downloaded VS2015 recently (it took days over an unreliable wifi connection), but I never got around to installing it to a Windows virtual machine. I'm hoping to give it a try in the next few days.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: leeor_net on October 09, 2015, 05:54:38 PM
Alas I just finally replaced 2008 with 2015. :P

I'll see what I can bang out this weekend.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: rmiddle on October 09, 2015, 11:28:23 PM
Yeah, it shouldn't be too different to set up VS2015 to use the SDK. You can't convert the MSVC6 project files directly to 2015, though, and I don't know if the project files on the SVN have been converted yet. If they're not, you need to get VS2008 (you should be able to find the express version around still), load the MSVC6 project in it to convert it to VS2008 format, and then you can load the VS2008 project in VS2015.
I don't have VS2015 installed yet myself, but I will soon. As in, when I feel like cleaning up C: to make room for it, because Microshit refuses to let you install VS since 2012 on any other partition.

I haven't been able to find VS 2008 anywhere. 

Thanks
Robert
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: leeor_net on October 10, 2015, 12:35:03 AM
Looks like Microsoft decided to yank it. Good riddance too, frankly it was awful. Your best bet if you really want VS2008 is to probably torrent it.

I'll be looking at the code and the projects this weekend and hopefully get a VS2015 project set up and usable by the end of Sunday or Monday. That's my goal anyway. Unless Hooman wants to jump in and do it before I get to it (hint hint, nudge nudge).

Will keep you posted.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: rmiddle on October 10, 2015, 02:45:57 PM
Looks like Microsoft decided to yank it. Good riddance too, frankly it was awful. Your best bet if you really want VS2008 is to probably torrent it.

I'll be looking at the code and the projects this weekend and hopefully get a VS2015 project set up and usable by the end of Sunday or Monday. That's my goal anyway. Unless Hooman wants to jump in and do it before I get to it (hint hint, nudge nudge).

Will keep you posted.

That would be great.  I kinda want to play with OP2 code a little.

Thanks
Robert
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: leeor_net on October 10, 2015, 06:39:00 PM
You and me both. I've been skirting around it for years but I think it's time I just dove in and got started.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: dave_erald on October 28, 2015, 12:03:37 PM
I think I have the SDK loaded into VS 2015 correctly, load up templates, put the include and lib folders in VC, however I do get this

1>LibCTiny.lib(DLLCRT0.OBJ) : warning LNK4229: invalid directive '/OPT:NOWIN98' encountered; ignored

Is that the link in that library file its getting upset with? As near as I can tell I have it in the right folder and most everything else. I downloaded the OP2devolpment.zip file and got everything moved around to where I believe it needs to be, but I did not see a OP2script.dsp file anywhere.

I would like to try and get this to work, if I have jumped too far ahead and missed something let me know and I'll go back an reread some stuff. I've started on sirbombers tutorials but am missing some of the SDK setup info, of course that was for vs2008 I think.

Thanks

Dave.



Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: leeor_net on October 28, 2015, 02:53:09 PM
That's a linker option. I'm assuming it's coming as a legacy command line switch from the original VC6 solution.

I'm going to be looking into this tonight to see about making it easier and cleaner with modern IDE's and tools. Will probably have more answers tonight or tomorrow.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: dave_erald on October 28, 2015, 07:02:48 PM
That's about how I'm interpreting it, but what the hell do I know. I think if it wasn't in the right folder of VS I would get reference not found errors. On a side note does anyone have a op2script.dsp? Or is it in that op2devolopment.zip I downloaded and I'm just blind?
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: Hooman on October 29, 2015, 01:52:25 AM
LibCTiny is a replacement for the CRT (C Run Time) library. If you remove the reference to it, the code should compile with the default compiler provided version. LibCTiny was used with the Visual Studio 6 projects to produce a smaller DLL file. It was never strictly needed, just used to produce smaller output. I remember there being issues trying to use it with newer compilers, and so I don't think it was part of any Visual Studio 2008 (or 2012?) projects.

I'm guessing you're using an old zip file of the SDK. The zip files haven't been maintained or updated in ages. You're probably better off getting the code from SVN. The LibCTiny issue has likely already been resolved there, at least for the projects that were updated to Visual Studio 2012. You can use TortoiseSVN to download updated stuff from:
https://svn.outpostuniverse.org:8443/svn/outpost2 (https://svn.outpostuniverse.org:8443/svn/outpost2)

The .dsp files are Visual Studio 6 project files. You can ignore them if you've got a project setup with a newer version of Visual Studio.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: leeor_net on October 29, 2015, 11:45:22 AM
Working on putting together an updated downloadable package now that will work with VS2015.

Not many of the projects on the SVN were updated to VS2015. I also have an idea as to how to set it up to make it easier for newbies to just download and roll without having to jump through hoops, etc. Not going to make any changes on the SVN though.


EDIT:

Didn't want to double post.

I pulled the old SDK zip file, updated all of the OP2 API code to what's currently on the SVN and built a VS2015 project file for it. All of the linker and compiler settings allow it compile and the DLL's built work just fine.

Working having it be even easier for someone new to just open the ZIP, load the solution and just start writing.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: dave_erald on October 29, 2015, 04:30:12 PM
This is great. Playing this again makes me want to break out Star Wars Rebellion and Fallen Haven. I'm not going to bother doing game coding for those, largely because I don't think those games have a following even close to this one ( not that this one is overwhelming, just dedicated is the biggest thing )

Awesome, I'm going to keep checking and working away learning.

EDIT - just thought of something, none of the templates have files for manipulating objects in game, vehicles and such? Take an existing Laser tiger and redesign it? Is there a forum section for that?
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: Hooman on October 29, 2015, 10:05:50 PM
@leeor_net: Why not make changes in SVN? That's what it's there for. If the changes prove to be a bad idea, they can always be undone. There's no need to think of the SVN contents as sacred or anything.

@dave_erald: What do you mean by redesign? Changing unit behaviour is not something supported by the game engine, but since DLLs are executable code you can hack anything into the game you want, if you really know what you're doing. It's not simple though, and certainly not a beginner topic.

Simpler manipulations are possible though. You can order units to do simple things, move, turn lights on or off, idle buildings, unload garages, that sort of thing. You can also mix and match weapons with chasis when you create units, including putting normal weapons on scorpions.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: dave_erald on October 29, 2015, 10:15:01 PM
No no not looking to do anything outrageous right now, just hoping to get compiling maps and trying my hand.

I was only looking ahead, wondering how much can be done is all.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: Hooman on October 29, 2015, 10:30:37 PM
With executable code in DLLs, theoretically anything can be done. Realistically though, it's somewhat limited what can be done easily.

Just getting units created is enough to make a playable map. You don't need to worry too much about manipulating them. The bulk of DLL code is just level setup, with a little bit extra for victory/failure conditions and random disasters.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: leeor_net on October 30, 2015, 01:15:36 AM
Hooman, it's not that I'm afraid to change it, it's that I'd like to have it review before I start making any commits. I'll be posting a new SDK download file by this tomorrow evening... don't think it will take me longer than that.



EDIT:

Got everything uploaded and a Redmine project set up for the SDK download package.

Head on over to Redmine and download v2.1. v2.1 includes Visual Studio 2015 project files so you can load it up and compile immediately without having to mess around with compiler or linker settings.

http://redmine.outpostuniverse.org/projects/op2-sdk/files
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: Hooman on November 11, 2015, 03:05:36 PM
Commit first, review later. ;)

The change is basically new project files, which don't even overwrite old stuff. It's a safe change.

Besides, code is easier to review once it's in the SVN, and if further changes are needed, or something needs to be undone, it can be documented in a commit message why the change is needed.

It's not a big deal to break what's in the SVN. In some organizations, with more developers, and a more rapid development cycle, you probably want to avoid breaking trunk since that affects other active developers, and with frequent commits, other people will have more difficulty knowing when the problem was introduced. Here we just don't have that problem.

Some review systems basically have an extra repository that you push changes to, and only once they are reviewed and accepted is that change pushed to the main repository that everyone clones from. That's overkill for us. It's also more process heavy than it needs to be. Our needs are simpler. Just break stuff, learn from it, and try again. We have only one repository, and generally just work from trunk, not on separate branches.


Thank you for dealing with this. I just checked out the package, and the older version too. The changes look quite straightforward.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: leeor_net on November 11, 2015, 03:20:44 PM
Leviathan has a few suggestions and insists that we stick with  the original layout. I ceded defeat and will have an updated 2.2 version released... whenever. Heh.

I want to get additional sample code added for a 2.5 release hopefully by the end of the year. Make it easier for newbies to learn coding in addition to the Wiki pages we want to get set up.

And I've got some thoughts on a 3.0 SDK release but that's for sometime in the future.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: Hooman on November 12, 2015, 06:59:57 AM
I am most curious.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: Hooman on December 28, 2015, 02:11:58 AM
Bump. I think this still needs some attention. I don't see any commits to SVN, but did notice a Redmine task about updating this to match the SVN layout.

@leeor_net: It might also be good to specify what code samples should be added to a future release, and what thoughts you had for a 3.0 release.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: leeor_net on January 01, 2016, 11:10:28 PM
Basically, based on what Arklon stated on IRC, I'm not sure it makes sense to bother updating the API SDK at all. I haven't had a lot of positive comments regarding the 2.1 release so I've pretty much shied away from it.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: Hooman on January 02, 2016, 01:33:42 AM
I'm not sure I agree, but I do admit the SDK doesn't get much usage lately. Not many people try making levels, and it can be difficult to do. I don't think that's about to change.

I think more examples and tutorials would be helpful for the few people that do take interest.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: dave_erald on January 02, 2016, 10:22:05 AM
If I run the SDK, as is, in full release it gets hung up on this:

Code: [Select]
void CreateStarshipVictoryCondition()
{
Trigger trig;

// Create victory conditions for - Colony, Starship
trig = CreateCountTrigger(1, 1, -1, mapEvacuationModule, mapAny, 1, cmpGreaterEqual, "NoResponseToTrigger");
CreateVictoryCondition(1, 1, trig, "Evacuate 200 colonists to spacecraft");
trig = CreateCountTrigger(1, 1, -1, mapFoodCargo, mapAny, 1, cmpGreaterEqual, "NoResponseToTrigger");
CreateVictoryCondition(1, 1, trig, "Evacuate 10000 units of food to spacecraft");
trig = CreateCountTrigger(1, 1, -1, mapCommonMetalsCargo, mapAny, 1, cmpGreaterEqual, "NoResponseToTrigger");
CreateVictoryCondition(1, 1, trig, "Evacuate 10000 units of Commom Metals to spacecraft");
trig = CreateCountTrigger(1, 1, -1, mapRareMetalsCargo, mapAny, 1, cmpGreaterEqual, "NoResponseToTrigger");
CreateVictoryCondition(1, 1, trig, "Evacuate 10000 units of Rare Metals to spacecraft");
}


// For use in multiplayer. Note: Computer controlled opponents do not count towards this.
// You win when there is only one human opponent left or all surviving human players are allied.
// This also creates corresponding failure conditions
void CreateLastOneStandingVictoryCondition()
{
Trigger& trig = CreateOnePlayerLeftTrigger(1, 1, "NoResponseToTrigger");
CreateVictoryCondition(1, 1, trig, "Eliminate your opponents.");
}


// Fail if the number of active Command Centers becomes equal to 0.
void CreateNoCommandCenterFailureCondition(int playerNum)
{
Trigger& trig = CreateOperationalTrigger(1, 1, playerNum, mapCommandCenter, 0, cmpEqual, "NoResponseToTrigger");
CreateFailureCondition(1, 1, trig, "");
}

...and it throws these errors

Code: [Select]
>OP2Helper.obj : error LNK2019: unresolved external symbol @__security_check_cookie@4 referenced in function __unwindfunclet$?CreateLastOneStandingVictoryCondition@@YAXXZ$0
1>OP2Helper.obj : error LNK2019: unresolved external symbol __EH_epilog3 referenced in function "void __cdecl CreateLastOneStandingVictoryCondition(void)" (?CreateLastOneStandingVictoryCondition@@YAXXZ)
1>OP2Helper.obj : error LNK2019: unresolved external symbol __EH_prolog3 referenced in function "void __cdecl CreateLastOneStandingVictoryCondition(void)" (?CreateLastOneStandingVictoryCondition@@YAXXZ)
1>OP2Helper.obj : error LNK2019: unresolved external symbol ___CxxFrameHandler3 referenced in function __unwindfunclet$?CreateLastOneStandingVictoryCondition@@YAXXZ$0
1>.\Release\OP2Script.dll : fatal error LNK1120: 4 unresolved externals

Which is after in Visual Studio 2015 I set code generation to Multithreaded, and I set Linker advanced properties to Yes/NOENTRY point.
This is with the SDK 2.1 Release

It's just linking errors, if I cut it out it's fine. I think I just need to move it, or add an #include to something it can't find.

Thoughts?

EDIT: Changing the Linker Setting from No to Yes/NOENTRY point fixed this error:

Code: [Select]
1>LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12

Fix one, create another.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: leeor_net on January 02, 2016, 01:42:10 PM
Agreed. It would also be helpful to have a mapper that was... I dunno... useful. No hard feelings toward whoever built what's currently available but it's just not intuitive and is very unfinished and unpolished.

I'm also thinking about something you had proposed awhile back, or at least I think you proposed it... building a DLL file that could be used to load a different breed of map file that defines things like starting points, AI scripts, etc. I'm not sure how the hooks would work to make it generic like that but something tells me it's doable. On top of that, you'd have the mapper offer a clean interface toward setting starting locations and AI personalities (aggressive, defensive, hybrid, etc.) and possibly scripted events... what comes to mind is StarCraft's mapper tool. Something along those lines.

But that is probably a rather big project which would require a good amount of thought and developer effort to pull off effectively.
Title: Re: How to setup Op2 Sdk With VS 2015 + Project Templates?
Post by: Hooman on January 02, 2016, 09:42:53 PM
This needs to be looked into.

Designing a new level format, and editor to go along with it is a large task. I feel ultimately something like that is important if we really want people to start making new missions. The current way to too slow and too involved. Such a project won't happen overnight though, and with our track record might never be finished, so I feel the current SDK needs to be maintained. It's the only current way to build levels for Outpost 2, and will probably form a foundation for any future ways to build levels.

I'm a little embarrassed I haven't jumped on this earlier. I've only recently tried installing the copy of Visual Studio 2015 that I'd downloaded months ago. The install never seems to finish, probably due to heavy swapping while running a VM. I'll have to get this sorted.