View unanswered posts | View active topics It is currently 26 Nov 2024, 21:01



Reply to topic  [ 403 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 14  Next
 The BOTF2 Combat System (Download Is In The First Post) 
Author Message
Fleet Admiral
Fleet Admiral
User avatar

Joined: 13 Nov 2006, 01:00
Posts: 2111
Location: Germany
exactly as mike says. what I want to avoid is having to recode/recompile everything you coded in c# and also to have the .net framework needed to run our game (since it's quite a large download). Seems like those two things can't be put together. .net CLR is part of the .net framework and I doubt there is a way to completely include it into our bote build so no separate installation would be necessary. Guess we need to think about actually going after the first solution when you're finished, i.e. recode it in plain c++ and link it against the native irrlicht library..


03 Jul 2008, 06:32
Profile WWW
Combat Engineer
Combat Engineer
User avatar

Joined: 18 Jul 2005, 01:00
Posts: 1001
Thanks,

It shouldn't be to hard to recode it in C++, i wouldn't recommend I do it ;) as my C++ knowledge isn't exactly as broad as i would like.

I've been doing the UI using WPF so that may be a problem.

Regards Wolfe

_________________
Image


03 Jul 2008, 12:14
Profile
Fleet Admiral
Fleet Admiral
User avatar

Joined: 13 Nov 2006, 01:00
Posts: 2111
Location: Germany
As long as this WPFg isn't finished and usable, I think we might have a real problem there. Could be that in the end we would have to call your engine out of bote with a set of parameters and have it run in a sandbox giving back the result of the fight also in a xml file. Of course that never works if .NET isn't installed on the client's machine so only those ones would be able to take on tactical fights. that appears all interesting... :lol:


03 Jul 2008, 12:22
Profile WWW
Combat Engineer
Combat Engineer
User avatar

Joined: 18 Jul 2005, 01:00
Posts: 1001
Cross that bridge when we come to it :)

Things generally work out for the best in the end.

Regards Wolfe

_________________
Image


03 Jul 2008, 12:45
Profile
Fleet Admiral
Fleet Admiral
User avatar

Joined: 13 Nov 2006, 01:00
Posts: 2111
Location: Germany
sure. even if .NET is needed, who cares. We only have to care that the game runs without .NET and in that case without the 3D battle. Those who want 3D battles need to get the .NET framework installed. BotE should then react properly to each scenario.


03 Jul 2008, 12:54
Profile WWW
Chief Software Engineer
Chief Software Engineer
User avatar

Joined: 11 Aug 2005, 01:00
Posts: 2688
Ideally, the combat system ought to implement some sort of code interface that would allow any UI to interact with it. That way I can provide a seamless WPF UI in Supremacy, while the BotE guys could provide their own interface in MFC.

Something like this perhaps:

Code:
/// <summary>
/// Provides a controller mechanism (as in the 'model-view-controller' pattern) for the combat system.
/// </summary>
public interface ICombatController
{
    /// <summary>Gets the currently selected ships.</summary>
    /// <returns>The currently selected ships.</returns>
    CombatShip[] GetSelectedShips();

    /// <summary>Gets the combat maneuvers that may be assigned to the currently selected ships.</summary>
    /// <returns>The valid combat maneuvers for the selected ships.</returns>
    CombatManeuver[] GetValidManeuversForSelectedShips();

    /// <summary>Sets the combat maneuver for the currently selected ships.</summary>
    /// <param name="maneuverType">The combat maneuver to set.</param>
    /// <exception cref="System.ArgumentException">
    /// Thrown if <paramref name="maneuverType"/> is invalid for the currently selected ship(s).
    /// </exception>
    void SetManeuverForSelectedShips(CombatManeuver maneuverType);

    /// <summary>Signal that the player has finished giving orders for this round.</summary>
    void SetReady();
}

Obviously, more methods would be needed than that, but you get the general idea...
Malvoisin wrote:
exactly as mike says. what I want to avoid is having to recode/recompile everything you coded in c# and also to have the .net framework needed to run our game (since it's quite a large download).
Actually, if the combat engine is properly separated from the rest of the Supremacy client, we could eliminate any dependencies on WPF or other .NET 3.0+ components. That would reduce the requirements to .NET 2.0. Vista already ships with .NET 2.0 and .NET 3.0, and the vast majority of XP systems already have .NET 2.0 installed anyway. Hosting the CLR with just few of the standard .NET 2.0 assemblies wouldn't increase the memory footprint that badly, and the download size would still be quite manageable.

_________________
Lead Developer of Star Trek: Supremacy
253,658 lines of code and counting...


04 Jul 2008, 22:42
Profile WWW
Fleet Admiral
Fleet Admiral
User avatar

Joined: 13 Nov 2006, 01:00
Posts: 2111
Location: Germany
that would be good.

another thing, ever heard of that finnish 2005 fan film Star Wreck: In the Pirkenning? http://www-fi3.starwreck.com/tech.php

seems like they made their sounds themselves resp. used stuff that can't be violating any copyrights or otherwise with 6 million downloads so far, someone would have taken action I think.

anyway, I'm currently downloading the film and will watch it. judging from the cool screenshots, I guess there are lots of usable sounds and music in that film. good thing is that it's under Creative Commons, at least they say so on their website. Could possibly be a good source to replace some sounds with unknown copyright status or some that are still missing.


05 Jul 2008, 19:07
Profile WWW
Evil Romulan Overlord of Evil - Now 100% Faster!
Evil Romulan Overlord of Evil - Now 100% Faster!
User avatar

Joined: 02 Dec 2004, 01:00
Posts: 7392
Location: Returned to the previous place.
I saw that film a couple of months ago, mal. It might be in Finnish, but it's funny as hell and the special effects are jaw-dropping, easily competing with the best of Hollywood in some places.

They're currently making a sequel called Iron Sky. Matress can't wait. :mrgreen:

_________________
"Anyone without a sense of humour is truly at the mercy of the rest of us."

Image
Image


05 Jul 2008, 22:12
Profile WWW
Chief Software Engineer
Chief Software Engineer
User avatar

Joined: 11 Aug 2005, 01:00
Posts: 2688
Wolfe's demo crashes and burns if you're running a video resolution other than 1280x1024. May want to put a note to that effect in the Readme file.

_________________
Lead Developer of Star Trek: Supremacy
253,658 lines of code and counting...


14 Jul 2008, 20:08
Profile WWW
Combat Engineer
Combat Engineer
User avatar

Joined: 18 Jul 2005, 01:00
Posts: 1001
I'am guessing i set it to full screen rather then windowed mode. Next update should allow users to specify resolutions and screen modes.

Regards Wolfe

_________________
Image


14 Jul 2008, 20:50
Profile
Fleet Admiral
Fleet Admiral
User avatar

Joined: 13 Nov 2006, 01:00
Posts: 2111
Location: Germany
I have no problems running it in 1024x768 for example. Maybe it's just on widescreeners. Have to check it with my bro's computer..


14 Jul 2008, 20:51
Profile WWW
Combat Engineer
Combat Engineer
User avatar

Joined: 18 Jul 2005, 01:00
Posts: 1001
Come to think of it, i have a widescreen monitor but don't have any problems.

What exactly happens MStrobel?

Regards Wolfe

_________________
Image


14 Jul 2008, 22:43
Profile
Chief Software Engineer
Chief Software Engineer
User avatar

Joined: 11 Aug 2005, 01:00
Posts: 2688
cdrwolfe wrote:
Come to think of it, i have a widescreen monitor but don't have any problems.

What exactly happens MStrobel?

Regards Wolfe

The device initialization fails with an access violation exception. It might just be because I have a high-resolution monitor (1920x1200 at work, 2560x1600 at home), or maybe switching video modes isn't as straightforward in Windows Vista.

Can't test it at all at home, since it bombs on 64-bit machines as well. This is why I recommend avoiding unmanaged interop.

_________________
Lead Developer of Star Trek: Supremacy
253,658 lines of code and counting...


14 Jul 2008, 23:33
Profile WWW
Ship Engineer
Ship Engineer
User avatar

Joined: 10 Jul 2006, 01:00
Posts: 5130
Location: Space is disease and danger, wrapped in darkness and silence!
Watching your demos makes me want to create a trailer.

I hope some day we can use all the combat dialogs and your 3D engine to do just that.

Romulan Combat

_________________
Image


15 Jul 2008, 04:00
Profile
Combat Engineer
Combat Engineer
User avatar

Joined: 18 Jul 2005, 01:00
Posts: 1001
mstrobel wrote:
cdrwolfe wrote:
Come to think of it, i have a widescreen monitor but don't have any problems.

What exactly happens MStrobel?

Regards Wolfe

The device initialization fails with an access violation exception. It might just be because I have a high-resolution monitor (1920x1200 at work, 2560x1600 at home), or maybe switching video modes isn't as straightforward in Windows Vista.

Can't test it at all at home, since it bombs on 64-bit machines as well. This is why I recommend avoiding unmanaged interop.


Could be one of two things,

It seems some people have had problems with 64bit comps and Irrlicht, with one solution being setting Visual Studio to compile in '32bit' rather then 'any CPU'.

Also the main error which though doesn't seem to occur on my low end comp, i've tested on my brothers high end 6600 core 2 comp and it always occurs.

This is an access violation exception was unhandled due to corrupt memory yadda yadda.

It is always to do with trying to access a string associated with the ship scene nodes and then converting it into and integer.

Code:
// Selected ship is friendly, pass to first array index, using selected nodes parent name to get index of mesh array
                    friendly.setFShipSelectedUnits(0, 0,Convert.ToInt32(SelectedNode.Parent.Name));


It's some kind of coding issue / practice that i probably shouldn't be doing and i have yet to figure out how to solve.

Regards Wolfe

_________________
Image


15 Jul 2008, 17:01
Profile
Combat Engineer
Combat Engineer
User avatar

Joined: 18 Jul 2005, 01:00
Posts: 1001
With the loss of sharepoint we have also lost both demo's. They will be unavailable until we can find a copy of Strings demo.

My demo will either have to wait a week or so and i'll shove out an updated version or if it is looking to take a while i'll look to upload the last version.

Unless of course MOE overrules me and posts it anyway :P

Regards Wolfe

_________________
Image


23 Jul 2008, 01:02
Profile
Evil Romulan Overlord of Evil - Now 100% Faster!
Evil Romulan Overlord of Evil - Now 100% Faster!
User avatar

Joined: 02 Dec 2004, 01:00
Posts: 7392
Location: Returned to the previous place.
I've got the demo files so i'll zip them. But what should I do with the files? What's going to happen with sharepoint and is it safe to use yet?

_________________
"Anyone without a sense of humour is truly at the mercy of the rest of us."

Image
Image


23 Jul 2008, 01:40
Profile WWW
Chief Software Engineer
Chief Software Engineer
User avatar

Joined: 11 Aug 2005, 01:00
Posts: 2688
cdrwolfe wrote:
Code:
// Selected ship is friendly, pass to first array index, using selected nodes parent name to get index of mesh array
                    friendly.setFShipSelectedUnits(0, 0,Convert.ToInt32(SelectedNode.Parent.Name));


It's some kind of coding issue / practice that i probably shouldn't be doing and i have yet to figure out how to solve.

Well, there is an inherent problem with the code above, and it's probably something you've never even considered since you've never shipped a globalized application before. Convert::ToInt32 is actually a wrapper for the Int32::Parse method, which parses a number based on the number format of the language in which the operating system is running. With integers, this rarely makes a difference, but with Double or Decimal types (in which you may have decimal or place separators that vary by culture, e.g. '.'/',') it becomes a very big problem.

Generally, what you would want in place of the code above is the following:

Code:
// Selected ship is friendly, pass to first array index, using selected nodes parent name to get index of mesh array
// NOTE: You must import the System.Globalization namespace for this to work.
int shipId;
if (!int.TryParse(SelectedNode.Parent.Name, NumberStyles.Any, CultureInfo.InvariantCulture.NumberFormat, out shipId))
{
    /* failed to parse number; handle your error here (and probably return or exit). */;
}
friendly.setFShipSelectedUnits(0, 0, shipId);

By passing in "CultureInfo.InvariantCulture.NumberFormat" as the format provider, you are telling the method that it should attempt to parse the number using "invariant" number formatting rules. The "invariant" rules are the rules of the "invariant" culture--in other words, a "standard" culture that does not change based on the host computer's language/culture settings. In .NET, the invariant culture is the same as U.S. English, so you will need to ensure that your numbers are formatted appropriately (with the ',' character as the thousands place separator and the '.' as the decimal separator).

_________________
Lead Developer of Star Trek: Supremacy
253,658 lines of code and counting...


23 Jul 2008, 17:17
Profile WWW
Combat Engineer
Combat Engineer
User avatar

Joined: 18 Jul 2005, 01:00
Posts: 1001
Hmm, but all my string names are 'numbers' from 1 to 100, and therefore don't contain the ',' or '.' symbol.

It seems getting access to Strings has been a problem for the wrapper before, though more in Vista.

See:

http://irrlichtnetcp.sourceforge.net/ph ... light=name

http://irrlichtnetcp.sourceforge.net/ph ... light=name

I'am still waiting to see if they respond to my thread i created but it could be awhile.

Regards Wolfe

_________________
Image


23 Jul 2008, 18:00
Profile
Chief Software Engineer
Chief Software Engineer
User avatar

Joined: 11 Aug 2005, 01:00
Posts: 2688
cdrwolfe wrote:
Hmm, but all my string names are 'numbers' from 1 to 100, and therefore don't contain the ',' or '.' symbol.

Like I said, it's not really an issue for Int32s, but you should still use one of the Int32::TryParse overloads for parsing numbers, because it returns a boolean indicating success or failure (whereas Convert::ToInt32 or Int32::Parse will throw an exception).

EDIT: I've fixed your vista issue. Use the Irrlicht.NET assembly in the attached zip file.


Attachments:
Irrlicht.NET.zip [70.87 KiB]
Downloaded 252 times

_________________
Lead Developer of Star Trek: Supremacy
253,658 lines of code and counting...
23 Jul 2008, 19:33
Profile WWW
Combat Engineer
Combat Engineer
User avatar

Joined: 18 Jul 2005, 01:00
Posts: 1001
Ooo! what did you do? or what exactly was wrong?

On a side note MStrobel, though WPF is a beauty in itself, it's drag and drop ability a godsend it has one downfall.......

In the hands of a complete novice like me it grows into a gargantuan monster of code bloat :).

The 3D engine demo is only 19,000 lines of code long, while for all the WPF UI and more importantly all the code to handle the various button clicks and image changes amounts to 34,000 lines of code and i don't even think that includfes the xaml lol.

It just took over and kept breeding like a ravaging Tribble!, and this is for only four windows, of which the Select Race, Select Ships and Select Formations actually have something substantial lol.

My back is killing me :D

Regards Wolfe

_________________
Image


23 Jul 2008, 22:24
Profile
Chief Software Engineer
Chief Software Engineer
User avatar

Joined: 11 Aug 2005, 01:00
Posts: 2688
The problem with Irrlicht.NET and strings in Vista stems from the fact that .NET (under Vista at least) will automatically free the memory allocated for strings that get returned from unmanaged code. Thus the first time you called SceneNode::Name, the unmanaged name was deallocated, and subsequent access attempts would throw an AccessViolationException.

I fixed it by modifying the unmanaged SceneNode_GetName(IntPtr) method import so that it returns an IntPtr, and then I used a method that had already been written to copy the result into a new string, which now gets returned from SceneNode::Name.

WPF should enable you to reduce your boilerplate UI code significantly over other UI toolkits like Windows Forms. Unfortunately, the relatively steep learning curve (due to WPF being so different from everything else) makes it difficult for novices to learn best practices. I recommend you pick up a copy of WPF Unleashed by Adam Nathan (Sams Publishing). It's by far the best WPF resource out there. You should be taking advantage of the Command model for UI input, and shared styles and templates for your custom control skins. I'm not sure what you're doing now, but I can tell you that the entire UI for Supremacy is probably less than 34,000 lines of code, and it does a heck of a lot more than the few screens you just described 8O.

_________________
Lead Developer of Star Trek: Supremacy
253,658 lines of code and counting...


23 Jul 2008, 22:57
Profile WWW
Combat Engineer
Combat Engineer
User avatar

Joined: 18 Jul 2005, 01:00
Posts: 1001
Well you might be able to help out on one thing hopefully.

I have already posted this on the the WPF newsgroup but here goes.

Do you know of a method to compare two images, simple checks to tell me whether they hold the same file image.

I thought
if(Image.Source == Image.Source) would work but i've been told it won't due to some kind of override.

Here was the original thread,
http://forums.msdn.microsoft.com/en-US/ ... d2e1ebbbb4

I'am guessing that casting to bitmapimage means something like creating a new BitmapSource variable and then calling baseuri i.e

BitMapSource bmap = new BitMapSource();

bmap = Image.Source;
// Check string
bmap.BaseUri.AbsolutePath...... etc

Anyway why the code is so huge is i made the silly mistake of not placing all the images i wanted to change into an array, rather then what i do now is access them via the name, which means i can't use any for loops to cut down on code, and everything gets nested in a long chain of IF statement lol.

Anyway for your amusement how NOT to code example

http://cdr.wolfe.googlepages.com/Select_Groups.xaml.cs

:ahem:

Regards Wolfe

_________________
Image


24 Jul 2008, 00:12
Profile
Chief Software Engineer
Chief Software Engineer
User avatar

Joined: 11 Aug 2005, 01:00
Posts: 2688
Sweet God in Heaven, please fix that file 8O :lol:

_________________
Lead Developer of Star Trek: Supremacy
253,658 lines of code and counting...


24 Jul 2008, 17:05
Profile WWW
Combat Engineer
Combat Engineer
User avatar

Joined: 18 Jul 2005, 01:00
Posts: 1001
Heheheheh,...

The great Tribble hunt begins.. :D

Regards Wolfe

_________________
Image


24 Jul 2008, 17:33
Profile
Chief Software Engineer
Chief Software Engineer
User avatar

Joined: 11 Aug 2005, 01:00
Posts: 2688
If you send me your project, I can probably point out several ways you can reduce your code bloat.

_________________
Lead Developer of Star Trek: Supremacy
253,658 lines of code and counting...


24 Jul 2008, 22:31
Profile WWW
Combat Engineer
Combat Engineer
User avatar

Joined: 18 Jul 2005, 01:00
Posts: 1001
Well at the moment it is split into two :), the WPF side which is crap but then i knew it would be as i was going to redo it, and the engine bit which though probably has some fundemental problems and isn't very optimized i would hope is better.

The kick in the teeth is the hope that i can combine the two together by being able to run the engine in WPF, which can be done though would also mean i would have to hack out all my event receiving code as from what i have read WPF control takes over and Irrlicht gets overrided. I have to change everything to use previewMouseClick etc...

Engine Code
http://www.megaupload.com/?d=TUMHH9R4

WPF Code
http://www.megaupload.com/?d=Z38VDIWW

Demo Assets
http://www.megaupload.com/?d=F31NIVV8
(Does not contain your new Irrlicht.NET.dll i'am afraid)

It will take an hour for the assets to be uploaded, sorry for using megaupload (*watches out for MOE)

I appreciate you taking the time to look MStrobel, don't feel the need to spend to long on it or anything though.

Regards Wolfe

_________________
Image


24 Jul 2008, 23:08
Profile
Evil Romulan Overlord of Evil - Now 100% Faster!
Evil Romulan Overlord of Evil - Now 100% Faster!
User avatar

Joined: 02 Dec 2004, 01:00
Posts: 7392
Location: Returned to the previous place.
Im not a programmer so dont need to download it. You're safe...for now... :twisted:

_________________
"Anyone without a sense of humour is truly at the mercy of the rest of us."

Image
Image


25 Jul 2008, 11:03
Profile WWW
Chief Software Engineer
Chief Software Engineer
User avatar

Joined: 11 Aug 2005, 01:00
Posts: 2688
Cool, I'll download your projects tomorrow and look them over. I'll be taking next week off of work, so I'll have plenty of time.

_________________
Lead Developer of Star Trek: Supremacy
253,658 lines of code and counting...


25 Jul 2008, 15:42
Profile WWW
Combat Engineer
Combat Engineer
User avatar

Joined: 18 Jul 2005, 01:00
Posts: 1001
Thanks MStrobel,

I think Megaupload has a max of 2 or more downloads in a consecutive time or maybe every 24hrs, also size may have an impact, just some fair warning.

Regards Wolfe

_________________
Image


25 Jul 2008, 17:07
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 403 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 14  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by STSoftware.