Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

598 Good

About VizOne

  • Rank
  1. Of course I don't know about your overall design. What's a component, what's a "game object"? Which components would a single projectile use? I'm under the impression that you are trying to create "the ultimate flexible design", which will probably collapse under its own weight. My suggestion: don't overdesign! Keep it simple, make it work first, refactor later. And of course measure/profile to find spots that need attention.
  2. Quote:What do ypou think? First of all I think that a class with an interface containing that many totally unrelated method is clearly violating both the Single Responsibility Principle (SRP) and the Interface Segregation Principle (ISP). You could split this interface into multiple interfaces like IUpdateable, IRenderable, IMouseListener etc. A component then only implements the interfaces it needs. Instead of having one large list of components you let the component register themselves at separate lists: one for IRenderables, one for IUpdateables etc.This will at least fix the ISP problem and the problem that most components do not require all methods (which in fact is strongly related to the ISP problem). As for the SRP problem: instead of having the component implement all interfaces you could split the functionality into separate classes, one that handles the rendering logic, one that deals with state updates etc. This should simplify your classes and improve the design. Regarding the performance "issue": virtual calls are not prohibitively expensive in general. So before you try to optimize those calls away: MEASURE! Regards, Andre
  3. VizOne

    which language I should chosen?

    Hi, I try to take the short route here as long as the thread stays objective: 1. Unless you have many years of experience in game development and project management, several dozens of professional game developers behind you, a multi-million budget to spend and a time frame of several years available, you are probably not going to make anything that resembles WOW any time soon. Developing something similar to WOW is far, far, FAR too difficult for any casual developer. Check out google on this topic. This is why oler1s states that choice of the programming language will not make any difference for the success or failure of the project. 2. The choice of programming language does not matter for practically any game made by a casual developer. Each programming language and environment has its unique performance pitfalls that you need to be aware of. Try to make a simple game (like Tetris) in both languages to see which one you like better. Regards, Andre
  4. VizOne

    World Cup 2010

    Congratulations Spain! The Spanish team played incredibly well, they totally deserved to win. Greetings, Andre (from Germany) P.S.: Being a German studying in the Netherlands, I had sooooo hoped for a final Germany - Netherlands :-(
  5. VizOne

    Dev-C++/DirectX Not compiling

    Two things: First, the error message is not complete as far as I can tell, maybe you can post everything the compiler outputs. Second, and more importantly, Dev-C++ is literally ancient, dating back to 2005. You should really(!) get an up-to-date compiler and IDE. I've only used Visual C++ (the Express Edition is free) and Eclipse for C++ development so far, but I've heard good things about Code::Blocks. Regards, Andre
  6. Hi, You will probably run into I/O problems that fall outside the .NET scope. 50 files, each 20MB in ten seconds, that's 1GB in ten seconds or on average 100MB/s, or 800mbit/s + overhead when transferred over a network. I don't know what the sources are and how you process the data, but a conventional PC will probably not handle this reliably. If the sources are connected via network, this will probably be the bottleneck. If there's harddisk activity involved at the sources or the service, than this will become difficult (especially on writes). But if you only generate data in memory and process it in memory and all happens on the same machine, the bandwidth is not so dramatic anymore (800mbit/s in memory is not much). In this case, processing speed/processor speed will play a role. But before I continue speculating: why don't you build a prototype and see how far it gets you? Regards, Andre
  7. VizOne

    [C#] Localized Ressources

    Hi, There are two problems you are facing: first you want to control where the resource assemblies are saved. Second, you need to tell the application from where to load the resources. The latter is easy to achieve: you can add an app.config file to your project and define in there which paths the .NET runtime should probe in order to find resource assemblies. For example, if you want to move the de-de, en-us etc. folders to a subfolder Content below the application directory, you would add the following configuration in app.config: <?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <probing privatePath="Content"/> <!-- also search Content folder for assemblies --> </assemblyBinding> </runtime> </configuration> You could add a post-build event to your project that moves the assemblies from the default directory (below the app directory) to your desired directory. Paired with the configuration above you'd be done. If you are familiar with MSBuild, the next paragraphs might be interesting for you. Technically, it is possible to control where the resource assemblies are created. I don't know of any switch in the Visual Studio user interface to modify this behavior. However, the .NET SDK itself support the necessary options. So, if you compile everything by hand or if you use the msbuild system (which is preferable) you can achieve what you want without copying files in the post build event. The next paragraphs describe where the necessary setting is buried in the standard msbuild system. The default build process is mainly defined in the .targets file in the framework directory. For C# projects, Microsoft.Common.targets and Microsoft.CSharp.targets are the files of interest. Resource compilation is controlled in Microsoft.Common.targets. Satellite assemblies (that is, localized resource assemblies) are generated by first compiling resx files into .resource files. This is done in the GenerateResource task of the CoreResGen target. The next step is to link the resource files into assemblies. This is done using the AL task in the GenerateSatelliteAssemblies target. The OutputAssembly attribute of the AL task defines where the satellite assemblies should be saved. Its default value is $(IntermediateOutputPath)%(Culture)\$(TargetName).resources.dll.
  8. VizOne

    [.net] C# Template

    The directory is controlled by the BaseIntermediateOutputPath property in your csproj file. Edit the .csproj file with an editor and add something like the following to the proper PropertyGroup (probably the one without the Condition attribute): <BaseIntermediateOutputPath>..\MyObjDir</BaseIntermediateOutputPath> More info on properties you can set: http://msdn.microsoft.com/en-us/library/bb629394.aspx To make this the default, yes, you need to modify the project template. It's not very difficult, though. For VS2010 it works like this: - Locate the project template zip file, for example at Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp\Windows\1033\ClassLibrary.zip - Unpack it somewhere - modify the files as needed, ie. for example change the classlibrary.csproj file to include the property I mentioned above - modify the vstemplate file to give the template a proper ID (<TemplateID>) and name (e.g. <Name>My Custom Project</Name>) - put the files into a new zip file (e.g. MyProject.zip) - add the new zip file to the template folder (see above) - reset visual studio by calling devenv /setup from Microsoft Visual Studio 10.0\Common7\IDE - you should now be able to select your new project type from the File=>New Project window Be sure to make backups etc. before messing with the files. But then again, I never found the obj folder to be a problem. If I really feel the need to clean up the working directory, I use the proper command from my versioning system (e.g. "git clean -xfd" or "git clean -Xfd") which wipes out anything that is not part of the repository. Still it's nice to now the properties, especially if you use msbuild for automated builds. [Edited by - VizOne on May 21, 2010 9:48:27 AM]
  9. Quote:Original post by Lio But as far as i could find it had no way to sort a linkedlist or keep the order of already sorted elements. That's probably because linked lists are not the best data structure to keep sorted. You might want to look into sorted trees, like binary search trees (red-black trees, avl trees, b-trees) or prefix trees aka tries (if the keys resemble strings). In .NET, SortedDictionary is a tree-based key-value data structure (a red-black tree in fact).
  10. VizOne

    [.net] C# - returning a ref?

    Add returns the value that was stored at this. Because E2D_Entity (strange naming btw) happens to be a class, this value is either null or a reference to an object of type E2D_Entity. Add will, however, not return a reference to the slot this itself.
  11. Regarding both of your problems: you should split the visuals from the logic. The rules of the game don't change, no matter if you're playing it as a win forms app or in a console window, right? Clearly, the logic and the visual representation are two concerns. As such, you should split them in your code as well. As a general guideline: split your solution into two projects, let's say Memory.Rules (a DLL) and Memory.UI (a winforms app). Memory.Rules should not have to reference System.Windows.Forms or System.Drawing at all, because those are related to visuals. Memory.UI on the other hand should only contain code related to visuals, that is forms and controls etc. Your Game certainly class goes into Memory.Rules. It could have methods such as void TurnOverCard(int x, int y) or bool IsTurnedOver(int x, int y) and these methods deal with all the rules related to memory as an abstract game concept. You could then add an event to Game such as public event EventHandler StateChanged; that you raise whenever something important changes (time, score, turned over cards etc.) Your win form (which is responsible for drawing the board) can subscribe to this event and react accordingly (redraw the affected parts etc.). This pattern is referred to as Observer Pattern. Of course, other ways of achieving this decoupling are possible, e.g. MVC Likewise, managing the bitmaps belongs to the UI. Maybe you can create a class Card in your Memory.Rules project that holds information about a card (position and e.g. a name such as "Cat", "Dog"). In your UI project, you could create a user control that represents a card/buttom. When you create the form with all the card buttons, pass each card button the Card object that it represents and have it load the bitmap based on the name of the card ("Cat"=> "Cat.jpg" or so). Of course that would cause all bitmaps to be loaded twice. So you could go a step further and create a "BitmapManager" class. You pass it the name of a card and it returns the appropriate bitmap (that it loads once the first time it is requested). This can be as simple as this: public class BitmapManager : IDisposable { private Dictionary<string, Bitmap> images = new Dictionary<string, Bitmap>(); public Bitmap GetBitmap(string name){ Bitmap bitmap; if(!images.TryGetValue(name, out bitmap)){ bitmap = LoadBitmap(name); images.Add(name, bitmap); } return bitmap; } Bitmap LoadBitmap(string name)[ string fileName = Path.Combine("images", string.Format("{0}.jpg", name)); return new Bitmap(fileName); } public void Dispose(){ foreach(var bmp in images.Values){ bmp.Dispose(); } images.Clear(); } } Now the BitmapManager is the owner of the bitmaps. So, in general don't try to combine completely different concerns in the same class. Have a look at the Single Responsibility Principle (and the other OOP principles). Hope that helps :-) Have fun!
  12. The most common way to consume managed code from within a native application is to use COM. You can create a COM callable wrapper for your managed DLLs and invoke that in your native app. See e.g. http://support.microsoft.com/kb/828736 Theoretically, you can host the .NET runtime explicitly in your application, but you probably don't want that: http://msdn.microsoft.com/en-us/library/9x0wh2z3.aspx
  13. Works fine here: if I click on the form, a message box shows up displaying "updatePosition". I used your code, added some fake implementation for the missing classes Shape and Ellipse and used the following code to start the app: using System; using System.Windows.Forms; namespace ClickTestApp { internal static class Program { [STAThread] private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new P3()); } } }
  14. VizOne

    C# pointers/references

    C++/CLI supports managed references (%), so you could do this: array<int> ^ data = {1,2,3,4}; int % intRef = data[2]; intRef = 123; // now, data[2] == 123 In C# you'd have to stick to unsafe+fixed+pointers to get this kind of indirection with value types, I guess, or a method with ref parameter as you showed in your post. But most importantly: you have to measure whether different approaches actually make a difference in practice. I wouldn't want to jump through loops for total 1% performance gain.
  15. It's ok that you're trying to minimize the pressure on the GC, but you won't probably be able to avoid dynamic allocations completely. However, I guess it won't hurt too much if you create your score strings once per frame. The GC is pretty fast for short-lived objects. You can of course just cache the score string as long as the score is the same. Depending on your game this could mean that you only have to allocate the string every few seconds or so. In general, you shouldn't go crazy with premature micro-optimizations like this. Get the thing working in the first place, then measure to find potential areas for optimizations. Have fun!
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!