Star Trek Fan Games
http://bote2.square7.ch/forum/

Software used for programming BotE and UI issues
http://bote2.square7.ch/forum/viewtopic.php?f=14&t=1925
Page 1 of 3

Author:  Sheppard [ 03 Oct 2007, 02:39 ]
Post subject:  Software used for programming BotE and UI issues

Hello, I have played BotE, and I am creating my own game. Well I was wondering what software you used. I was wanting to expand then software what I am using now.


Thanks

Author:  Malvoisin [ 03 Oct 2007, 07:17 ]
Post subject:  Re: Software

C++ with MS VS 2008, MFC classes, GDI+.

the UI however is bloody difficult to program with no real window manager at hand for the standard Microsoft MFC Foundation Classes..

Author:  Malvoisin [ 03 Oct 2007, 17:08 ]
Post subject:  Re: Software

heh, and sir p. just disproved me, the resolution thing is as good as solved. the english alpha4 will most certainly contain a resolution-unrestricted UI.. :D :idea: 8)

Author:  mstrobel [ 03 Oct 2007, 17:45 ]
Post subject:  Re: Software

Malvoisin wrote:
heh, and sir p. just disproved me, the resolution thing is as good as solved. the english alpha4 will most certainly contain a resolution-unrestricted UI.. :D :idea: 8)
Hey, that's great! I want me some Alpha 4 :mrgreen:.

@Sheppard: Supremacy is written in C#/XAML, and I use Visual Studio 2008 Beta 2 with the ReSharper plugin. The UI is much easier if you use WPF instead of MFC ;).

Author:  Malvoisin [ 27 Dec 2007, 13:22 ]
Post subject:  XNA integration in mfc applications like BotE

I found something promising (calls itself c++ interop, seems to be something really combining as native api, not wrapping) though I don't understand much of it, I'm not very proficient in APIs and stuff..

http://msdn.microsoft.com/msdnmag/issues/06/05/MixAndMatch/
http://blogs.msdn.com/jeremykuhne/archive/2005/09/08/462259.aspx

(in german): http://www.microsoft.com/germany/msdn/library/net/cplusplus/WindowsFormsInMFCAnwendungenUeberCplusplusInteropIntegrieren.mspx?mfr=true
http://msdn2.microsoft.com/de-de/library/2x8kf7zx(VS.80).aspx

guess sir p. needs to look at it too but I think that'll be not until next year.. ;)

Author:  Strings [ 27 Dec 2007, 13:41 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

The title of the first link is: "Integrate Windows Forms Into Your MFC Applications Through C++ Interop" At the moment I'm making XNA render into a UserControl, which can then be used on a Windows Form, so this is very promising. :D Good find.

The UserControl and Windows Form are in C# though.

Author:  Malvoisin [ 27 Dec 2007, 13:57 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

yeah I thought so too after I typed "XNA compatible with mfc api" in google and read the first entry ;). I guess - since it's native support - .NET 3.5 and XNA would then be needed for everyone to download in order to run the game. Well if that's the case I think we could even serve 2 different versions or make them bote.ini wise changeable, one with XNA, the other without so that people who don't wanna install a 200 mb Microsoft package for a game they don't know still give it a try ;). Also, does anyone know if XNA and .NET runs with WINE? Guess I have to google that too in a moment :).

Edit: how about this: http://www.codeproject.com/KB/cs/ManagedCOM.aspx
http://www.codeproject.com/KB/mcpp/ijw_unmanaged.aspx
http://ootaboys.blogspot.com/2007/09/ho ... ol-in.html
http://www.c-sharpcorner.com/UploadFile ... otNet.aspx
http://www.dotnet247.com/247reference/m ... 92569.aspx
http://www.devmaster.net/forums/showthread.php?t=1663
http://www.codeproject.com/KB/mcpp/MfcAppContainer.aspx
http://www.codeproject.com/KB/mcpp/Mana ... terop.aspx
http://msdn2.microsoft.com/en-us/library/ms177552.aspx
http://msdn2.microsoft.com/en-us/library/ahdd1h97(VS.80).aspx
http://blog.kalmbachnet.de/?postid=70 (<- sounds promising)
http://www.msdner.com/dev-archive/8/8-29-82466.shtm?

a german detailed description: http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.de.vc&tid=7e373fa4-b85f-48d5-99d3-8aa95cd980ed
http://www.codezone.de/DetailPage.Codez ... 58a9f0defb


seems like recently a linux port for xna has started: http://code.google.com/p/monoxna/

Author:  Strings [ 27 Dec 2007, 14:21 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

Yeah, XNA does have a lot of prerequisites redists: .NET, XNA, DirectX, oh and a graphics card with 1.1 shader support :P and judging from the amount of trouble people had getting the model viewer to work last week, I agree with you that having two versions is the best plan.

But I know of a CodePlex project for an installer that checks for and if necessary install the redistributables required to get the XNA game running (DirectX 9.0c October 2006, .NET Framework 2.0 SP1 and XNA 1.0 Refresh), adding 27 MB to the game's size. It can also check for a certain level of shader support on the target system.

Cool, loads of links with info that looks really promising! :) I'm glad that we're finally getting started on solving the problem. it's been nagging me quite some time.

Author:  Malvoisin [ 27 Dec 2007, 14:38 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

from what I understand, having a c# written form and unmanaged c++ mfc whatever should work together without much hassle (hopefully). I guess even if it takes code line fumbling it shouldn't be too much to do since the planets and the 3D engine are just 2 forms basically, right?

Edit: a german how-to: http://download.microsoft.com/download/4/7/a/47aca5b1-ad88-4248-949b-d0333d238516/msdnMagazin_WindowsFormsInMFCAnwendungenUeberCppInteropIntegrieren.pdf

Author:  Strings [ 27 Dec 2007, 14:49 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

We shall have to investigate and see, lets hope it just works if we follow the examples.

Found an actual MFC and Windows Forms code sample from Microsoft, requires building first though, it's a Visual Studio project.
http://www.microsoft.com/downloads/deta ... aa50b0f599

Author:  Malvoisin [ 27 Dec 2007, 14:54 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

okay, let's wait on our code guru before we proceed any further. I don't have the full VS2005 btw. to check any sample form out quickly but I think there's an express version which maybe has the necessary functionality to test..

Author:  Strings [ 27 Dec 2007, 14:56 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

I will try building it and if it works, post the compiled .exe on here.

Author:  Malvoisin [ 27 Dec 2007, 14:58 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

okay thx. In the meantime I'll try the express version out.

Author:  Strings [ 27 Dec 2007, 15:18 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

It compiled in VS2008, but I am not not clear whether it is working correctly. Maybe Sir P. will understand it better. Or maybe I'll understand how it works if I read more about it.
http://www.mediafire.com/?4rchpxlpzfu

Author:  Malvoisin [ 27 Dec 2007, 15:48 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

the express version terminates with an unknown error message while compiling. Also your exe does not run showing a "application configuration incorrect" (or rather something likewise translated into german ;)). I'm installing the microsoft platform sdk right now, maybe the Visual Studio Express version alone is not enough..

Author:  Strings [ 27 Dec 2007, 16:10 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

*shrugs* I don't know man :D I was surprised it even compiled after the conversion to VS2008, when it runs it shows something like the screenshot I attached.

Now I'm reading this document again to try and understand what's going on, http://msdn.microsoft.com/msdnmag/issue ... fault.aspx

Attachments:
MFCWinFormsSample.png
MFCWinFormsSample.png [ 158.96 KiB | Viewed 14905 times ]

Author:  Malvoisin [ 27 Dec 2007, 16:18 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

well, at least I know now why it doesn't compile. The MFC libraries aren't supported by the Express versions of VS.

as for your compiled exe, it's strange that it does not run with my pc since I have everything installed that one could possibly imagine except any dev tools or sdk (okay, safe for the MS platform sdk which I just installed). Gonna read this page too you linked..

Edit: I could try the vc2008 redist though..

Author:  Strings [ 27 Dec 2007, 16:25 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

This is what I can grasp from a quick read and what the sample app showed me.

- The C++ code in BOTE have to be compiled with the /clr flag before it can use .NET features.
- Something called Mixed-mode compiling allows just a small part of the BOTE code to be compiled with /clr.
- A feature called "C++ interop or IJW (It just works)" can then be used.
- A special class in MFC, CWinFormsControl allows you to host Windows Forms controls in MFC dialog boxes ( I think this is what happens in the sample app ).

So, if we get it to work, the UserControl with the XNA rendering will be inside a dialog box. Hmm..

Edit: No wait, you can host Windows Forms controls as views too. But I dont understand that bit of the article at all. :oops:

Author:  Malvoisin [ 27 Dec 2007, 16:34 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

hehe a dialog box, well, I guess we have to cut the dialog option out of that box then don't we.
anyway, did you compile mfc04 with a 64bit flag or something? Even after download the vc2008 redist, it still gives the error message..

Author:  Strings [ 27 Dec 2007, 16:39 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

I compiled it as Win32. It was either Win32, or Itanium (wtf, server thing?) or x64.

And I just thought of this, if we dont want to involve Dialog boxes, we can simply not render to the UserControl, I can modify the XNA code to render to the actual background of the Form instead.

Author:  Malvoisin [ 27 Dec 2007, 16:43 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

strange. Hope it's just their buggy code ;). Can somebody else try and download this file and see if it runs on his machine?

Edit: well, do it! (but first talk to sir p. cause I don't know what he wants here ;)).

Author:  Strings [ 27 Dec 2007, 16:50 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

Just done it :) it was pretty easy, just passed the handle of the Form instead of the handle of the UserControl, in fact, I reckon that's what I'll use from now on when I dont actually have other GUI elements in the Form. But for the model viewer, I'll keep UserControl or I can probably use something even simpler, like say, a blank Panel.

Author:  Malvoisin [ 27 Dec 2007, 16:53 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

good. I guess MouseOverEvents will still be possible in such a form? BotE currently features a simple MouseOver-Event when hovering over a planet. On the left bottom side, a short planet class description text is displayed. Will that work with a rendered planet too?

Edit: btw. I get this message (third one on the page): http://www.codeproject.com/KB/cpp/vcredists_x86.aspx . Seems like it has something to do with certain CRT files that are missed by the compiled program..

http://forums.microsoft.com/MSDN/ShowPo ... 9&SiteID=1 (this seems also very interesting for troubleshooting. Looks like this /clr option needs special care with mfc dll repositories..)

Author:  Strings [ 27 Dec 2007, 17:06 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

In a purely XNA setting, I can get that to work quite easily by checking if where the mouse is on the screen projects an invisible line that intersects the BoundingBox / BoundingSphere of a model, and then display a string somewhere if it does intersect. This is a technique called picking.

So if we are thinking about planets, I would use the bounding sphere instead of the bounding box for a better fit, and if a planet is intersecting with the line from the mouse, then the string, for example, "Planet9 mousedOver" can be passed to BOTE to process properly (have to look into how to pass messages between MFC / Windows Forms.) Or XNA can process it too, and show what planet type it is tooltip style.

So I'm pretty sure it is doable.

Malvoisin wrote:
Edit: btw. I get this message (third one on the page): http://www.codeproject.com/KB/cpp/vcredists_x86.aspx . Seems like it has something to do with certain CRT files that are missed by the compiled program..


yeah, something about Side-by-side DLLs... have to do something with them, in the Manifest, or something. I'm not sure :mrgreen:

Author:  Malvoisin [ 28 Dec 2007, 13:31 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

following one of my links from page1, I found a lot of seemingly useful webcasts by a german MS developer which sir p. might find very interesting:

1. http://www.microsoft.com/germany/msdn/w ... =100100266 (use of .NET and c# written forms in unmanaged code)
2. http://www.microsoft.com/germany/MSDN/w ... 1032314634 (like in 1. but this time with focus on implementation in Visual Studio 2005)
3. http://www.microsoft.com/germany/MSDN/w ... 1032303161 (a general WPF introduction webcast series)
4. http://www.microsoft.com/germany/msdn/w ... 04-01.mspx (c++/cli in Visual Studio 2005)
5. http://www.microsoft.com/germany/MSDN/w ... =118757735 (cli explained in 4 episodes)

btw. registration on windows live! is required. If someone already has a live account and can download and quick upload these to sharepoint (we'll remove it after download) that would be extremely helpful I guess.

Author:  Strings [ 29 Dec 2007, 06:47 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

In one big .rar
http://rapidshare.com/files/79775489/Ma ... _.rar.html

I couldn't upload to the sharepoint because it kept giving me errors :( but here it is anyway.

Author:  Malvoisin [ 29 Dec 2007, 09:35 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

downloading :bigthumb:

yep, for sharepoint you either need a (university) 100Mbit/s Internet connection or split all files up in 7mb packages. It may be a settings thing with the site, mstrobel might know more about this.

Author:  Malvoisin [ 29 Dec 2007, 12:50 ]
Post subject:  Re: [3D engine] XNA integration in mfc applications like BotE

okay, next (and last) one is 40 min long and the one about c++ and cli in vs 2005. Well from what I learned so far is that all .net components (dlls) need to be COM-compatible in their attributes when calling them from unmanaged code. .net-own specific classes and types need to be processed in the .net component in an "encapsulated" way. Even multithreading in vb6 is easily done that way. However, it's even possible to call such classes that communicate via non-com-compatible types but it's a non-supported feature and may be scrapped or is already scrapped. .NET 1.0 originally was intended to be fully compliant with unmanaged code. That approach was abandoned in 2.0 but still the feature is working.

All in all, it seems viable to use any given .NET component and also Windows Forms via wrapping as long as the .NET specific "work" is done inside the .NET component to be used/called in the unmanaged code.

I guess Strings, you and puste like we call sir p. on our german boards, should sit together and try to implement a more or less rudimentary 3D planet view. This IJW and CLI thing seems only to be useful the other way round, i.e. when you have managed c++ and you want any unmanaged c++ or managed .NET code to be combined in a single exe thus merging it completely, but from the managed c++ viewpoint.

Here are 3 links that I find useful: http://207.46.236.188/MSDN/ShowPost.asp ... 1&SiteID=1
http://msdn2.microsoft.com/en-us/library/zsfww439(VS.71).aspx
http://msdn2.microsoft.com/en-us/library/9x0wh2z3.aspx

and of course the pdf file linked in page1 (http://www.microsoft.com/germany/msdn/library/net/cplusplus/WindowsFormsInMFCAnwendungenUeberCplusplusInteropIntegrieren.mspx?mfr=true), which I'm currently reading. It covers Windows Forms User Controls in MFC applications via /clr. It's a little contracting to what I wrote above with IJW not really helpful. Guess that's wrong ;).

Author:  IB_ [ 01 Jan 2008, 21:24 ]
Post subject:  UI

I was going to wait till the new release to make suggestions, but the waiting is getting to me. One thing I think there is too much of is different screens. I think unifying the screens and cutting down on the amount of clicks you need to micromanage you empire is a good idea. I've started work on some rough draft 800*600 Paint layouts.

Author:  Malvoisin [ 02 Jan 2008, 07:02 ]
Post subject:  Re: UI

that is a good idea. Sure there is plenty of room to combine a few screens such as workers' and build menu, monopoly menu and trademenu. Techniques like integrated pull-down menus and stuff would help there tremendously but is very tiresome to implement in current mfc architecture which is btw. the reason why sir p. implemented that many different menus in the first place, it's much easier to code. But, if you can develop some good drafts (take 1075x750 as size), go ahead! Might bring this "feature" much more ahead in schedule than it is now (unifying menus is on the "after bote v.1.0" still-to-do-list ;)).

Page 1 of 3 All times are UTC [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/