Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

dilyan_rusev

Member Since 24 Nov 2006
Offline Last Active Today, 02:11 PM
-----

#5051180 xna dead. now what?

Posted by dilyan_rusev on 08 April 2013 - 07:10 AM

We use XNA for our game, and it works quite well on all supported platforms. We've got problems with other things, not XNA. We aren't going to switch to anything else in the foreseeable future... there's just way too much code to port, and so long as our clients are happy, we don't care if there aren't gonna be updates for the XNA runtime. Which is even better, cause we'll then have to figure out an update strategy for clients with poor internet access.

Anyway - go and use XNA. When Monogame is ready (and by ready I mean they've got fully functional content pipeline), it might be sensible to do the switch. If you're just starting out - it doesn't really matter. Also, please do consider engines and not frameworks.

 

EDIT:

Don't do C++ if you are a lone dev, apart from purely academic interest. In C++, you've got nothing (in terms of standard libraries). Take for example validation/activation logic. You have to look for REST/JSON/HTTP client/encryption libraries. True, you can code all the shit in sockets, but you'll waste weeks doing meaningless boilerplate instead of getting ahead of your competition. And don't forget the debugging bliss of stepping through assembly for every serious problem that you've got istead of the friendly .NET stack trace. C++ is an option only if you've got the experience AND existing code base you can take advantage of. Plus, you need bigger teams with C++ (which are more expensive in case you're hiring).




#5047783 How to update a lot of random tiles in a 2D array?

Posted by dilyan_rusev on 28 March 2013 - 03:54 PM

In C++, pointer is the same as reference, with some enforced-by-compiler restrictions. In C#/Java, references are pointeres again, with the added caveat that the VM can rearrange the memory (i.e. move your pointer to another location). The difference shouldn't matter for most programs. And you can use raw pointers in C#, and you can pin them so that the VM can't move them, but it's not recommended unless you're doing some interop. Hope that clarification was helpful :)

 




#5047595 How to update a lot of random tiles in a 2D array?

Posted by dilyan_rusev on 28 March 2013 - 05:02 AM

Computers are quite good at doing repetitive tasks :) In our game, we use a component system, and we can have a lot of components in a scene - updating usually takes negligible time, as long as you avoid doing stupid thigs (and do profile the code when you see it's slow). For compute-intesive tasks (like texture generation), parallelizing the code can dramataically speed it up.

 

What I'm saying is that you can simply go and update everything. Let every component know when it should and when it shouldn't update (either determining it interally, or by sending a message when it goes out of scope - e.g. Enabled/Visible properties). Alternatively, you can maintain a list of components that need to be updated. Don't worry - in C# references are more or less just pointers, so having lists of components that live in memory anyway won't take all that much memory... you'll end with lists of pointers, not duplicated objects.

You will have to have a list of components.. I'd rather use some sort of composition (component on top of component whose job is to randomly update its child component), as it is more flexible... and in time can allow you to do complex things with very little code.




#5047193 Is it bad to use an IDE when you're just starting out with programming in...

Posted by dilyan_rusev on 27 March 2013 - 05:30 AM

I don't really understand people recommending not using an IDE. And I don't get what's complicated about Eclipse at all... I mean, really? We are doing such complicated software, and you find Eclipse difficult? That's beyond me. You don't really need that much out of it - plus it's the only Java IDE I know of that properly implements incremental build, which is a time-saver on non-trivial projects.

 

Java is one of the easiest languages, with very good books, very strong footing in academia, excellent IDEs and descent libraries. What you need is create new project -> edit -> run. It can't be simpler, honestly.

 

And writing Java code without IDE? For one of the most verbose languages? Seriously? That's probably the worst advice I've heard in a while...




#5044487 VC++ 2010 crashes on ShowWindow(..)

Posted by dilyan_rusev on 19 March 2013 - 12:29 AM

A general advice from my experience as a programmer: every time I think the compiler/the framework is wrong, it always turns out *I* did something wrong.

 

In C++ Win32/COM programming, you have to understand the error model, which is quite different from the easy-peasy world of .NET/Java. As others said before, CreateWindow/CreateWindowEx can fail for many reasons - most probably because of incorrect arguments or WinProc. In the first case, GetLastError() and Google would help you, and in the case of WinProc - a few well-placed breakpoints at key messages would pin-point the problem. You should also absolutely always check return codes... this isn't Java/.NET where something crashes with a nice exception - return codes and/or GetLastError() are the way.




#5040103 Is a static builder incompatible with inheritance?

Posted by dilyan_rusev on 06 March 2013 - 01:46 PM

In Java, inner classes contain an implicit reference to the enclosing class (and this is why they are instantiated via this, or an instance). Static inner classes, on the other hand, behave exactly as inner classes in most other languages, and they do not contain an implict reference to the enclosing class. Thus, they are created just by their name (either new Builder() inside Mesh, or Mesh.Builder(), which is the only way to access the Builder class, as it is inner to Mesh. You could say that a class behaves like a package for its static content, including static inner classes). Note that I'm not talking about anonymous inner classes.

 

Let's go back to your case. If you want to inherit Mesh, you should change your constructor to be protected, so that it can be accessed via the inheritor.

 

And about the Builder pattern. Like any design pattern, it should be understood and applied. This means that patterns are a means to an end, and are not religion to be followed blindly. I'd take the Mesh builder class and make it a regular class, not an inner static class, and I'd call it MeshBuilder. Then I'd have MeshTerrainBuilder, which would inherit from MeshBuilder. Thus you'd have clear inheritance path, and would be able to override the builder behaviour.

 

I hope this is clear enough. I think that Effective Java is one of the best programming books I've read... but don't accept everything on faith just because Bloch is saying it.




#5037419 Can Directx do 2D graphics?

Posted by dilyan_rusev on 27 February 2013 - 07:29 PM

I've done a number of projects in SDL, and it is one of the simplest APIs I've used.

 

Now, I second @GuardianX  that DirectX contains a number of APIs, two of which are perfect for 2D games - Direct2Dand DirectWrite. There is another native Windows component that you'd use in games - WIC(for loading/converting images, etc). They are available on Vista+ (in their first incarnations).

 

I've been evaluating D2D & Co for a future product, and... the API is C++ and COM, plus it requires a bit more knowledge about how computers work (compared to SDL). Which means that if you don't yet know C++, you'll have trouble with COM. Should you go that route, know that it has some getting used to (D2D is somewhat different than other 2D APIs I've used). Also, when you search for stuff online, you might not really find that much help. Both D2D and SharpDX(.NET binding) are quite newer than SDL, and the latter is an established technology.

As always, MSDN is your friend; besides the reference pages, you've got tutorials and how-tos; don't forget to take a look at Hilo, as well. For SDL, I'd recommend LazyFoo's tutorials.




#5028138 Basic Win32 window with C++

Posted by dilyan_rusev on 02 February 2013 - 11:44 AM

If you are working on an editor, I recommend that you use C# and WPF (or WinForms for a bit more straight-forward integration). It is easier, faster to develop, the tools are much better, and integrating C++ and .NET is relatively easy (if all you have to do is read/write files + some sort of in-game viewer).




#5023456 Which platform should I use to write a game engine for multi platforms

Posted by dilyan_rusev on 20 January 2013 - 05:02 AM

Again, why Java? The only language that both iOS, Windows Phone and Android support is C. I am not sure about C++ on iOS, I've heard about Objective C++, but it's not pure C++ AFAIK. I think that niether WP, nor iOS support the Java runtime, so you'll be able to only make your engine work in Android, unless you have a Java implementation in C that compiles on all platforms (and include it in your code base). This is possible with .NET (Mono), and that is why engines and frameworks allow you to "script" in c#/boo.

 

Edit: Start with the platform where you have a physical device. When you do phone apps, nothing compares when you can actially play with your creation on a real phone. If you've got multiple phones, start with the one you like the best smile.png




#4973514 Properly shutting down C++ DLL from C# via C interface,

Posted by dilyan_rusev on 26 August 2012 - 11:41 AM

.NET doesn't do anything special when it comes PInvoke. You should still get DLL_PROCESS_ATTACH and DLL_PROCESS_DETACH in your DllMain. I guess you can perform clean up using that mechanism.

Other than that, yes, .NET uses the IDisposable interface when dealing with native resources, especially in conjunction with "using". Using is the C# equivalent of C++ destructors - it will call Dispose even if an exceptions is thrown in the using block. The cleanest way is to have something like InitEngine(...) and ShutDownEngine(..) in your C interface, and just wrap those in a disposable object (call Init in constructor and ShutDown in Dispose), creating the object in using. It is really quite similar as to what you'd do in C++ to wrap a C interface. Also, avoid finalizers in C#. Basically, every time you'd need to apply RAII in C#, do it via using + IDisposable. This is usually when you deal with native resources, but it is rarely required in pure .NET code.


#4971858 Good online source to learn MODERN C++

Posted by dilyan_rusev on 21 August 2012 - 09:29 AM

I find these quite helpful:
www2.research.att.com/~bs/C++0xFAQ.html (not working at the moment) - a good collection of general stuff about c++11
EDIT: it has been moved to http://www.stroustrup.com/C++11FAQ.html

http://herbsutter.co...modern-c-style/ - Summary of the new features

http://herbsutter.com/gotw/ - A few articles to make you hate C++ even more ;)


#4968227 WndProc and WinMain

Posted by dilyan_rusev on 10 August 2012 - 04:46 PM

I do not remember any mention in the documentation, but they've always been executed in the same. Most apis in win32 assume to be running on the same thread, and mention explicitpy if they launch,a new one. I guess it depends on,whether DispatchMessage is manually ran on a new thread.


#4968115 "Must-Learn" Languages

Posted by dilyan_rusev on 10 August 2012 - 10:03 AM

From what I remember, Python isn't weakly typed at all - it will scream to the heavens if you mix types without explicitly converting (exceptions shall rule them all). Actually dying early and loudly is part of the Python motto :) Perhaps you guys meant dynamic? Javascript is weakly typed, but also insanely powerful for scripting. The original Basic is also weakly typed, which made it so great for COM/OLE. IIRC, JavaScript in IE is still implemented via OLE scripting - that is why you used to initialize Ajax requests that way. I think newer versions of IE support the standard XMLHttpRequest.

Like kuramayoko10 said, Prolog is the most different language. Functional programming isn't that different to imperative programming for me (you still think the same way, just use functions for everything), but Prolog almost made me cry until I got it. The total lack of imperative programming concepts such as "if" and "for" is going to teach you a lot about recursion. Some things in Prolog are so much simpler and logical that they would be in an imperative language, that you'd wonder why there isn't a hype over it - like around Haskell, for example.

For DSL-s, I'd recommend to try and learn some build-automation tool, like (n)Ant and MS-Build - it will help you immensely. And since so few people know these tools well, you will stand out at your job :) Also, knowing how to work with documentation is helpful (Javadoc/Qt/doxygen-style commenting + the associated tools vs .net style commenting + MAML) - again, you might be the only one in your team that knows how to build professional documentation in an automated way. Kind of cool :)


#4966475 Macs vs PCs?

Posted by dilyan_rusev on 05 August 2012 - 04:08 PM

This is a very sensitive subject :D I like Windows primarily because I am used to it. I do appreciate the workmanship of Macs, but I wouldn't change my typing habits. People use Macs because they are very well built, they are very beautiful, and they have grown to be a kind of lifestyle. More technical people that don't really care that much about aesthetics (like me) would pick whatever makes sense at the time of purchase, regardless of brand.

I met a gal that used to work at Ubisoft, and if I remember correctly, they use Windows. I can't imagine that this is for everybody there.

I worked at a medium-sized company that didn't do games. There are a few reasons why Windows was chosen:
1) it is fairly easy to become a golden partner (just need to have a lot of people with certificates), which gives you a special MSDN license. That license more or less gives you all Microsoft software for free.
2) the sys admins were more familiar with Windows. It is fairly easy to manage. Microsoft does everything, and even if it is not the best, it does integrate in a nice, manageable way.
3) huge part of the business was extending Microsoft software and frameworks

Designers tend to like Macs. I guess this might have something historical, as Macs were marketed as the meeting point of liberal arts and technology. With products like iPod, iPhone and iPad, Apple built a kind of culture. Technology to their fans is more than gadgets, they really *like* them - like an emotional connection.

Another thing to consider is price. Apples computers are expensive. With PC manufacturers like Lenovo, you usually strike a deal that covers not only the hardware, but also support and some liability in case of hardware failure. I do not know if Apple offer wholesale discounts outside of academia, but in any case, their computers are more expensive. Also, up until very recently, OS X updates cost a lot of money, while service packs for Microsoft products are free, and, in case you are not a gold partner, you can have MSDN subscription, which greatly reduces the price of Microsoft software for big companies.


#4966467 Java or C# career and future of programming

Posted by dilyan_rusev on 05 August 2012 - 03:34 PM

For UI, and desktop integration, .NET is the go, no argument there.

However, there are a few projects in the Java world that I'd look at with great interest. First, there is XML-based SWT, being developed for eclipse. It is called XWT. The other thing is JavaFX, but it's quite new and I don't know if anybody uses it. Right now, C# offers the best experience for writing Windows Desktop applications, as it integrates nicely with COM and can invoke native code.

Now, since most people here probably haven't worked on bigger projects with both VS and Eclipse, their opinion will be mostly based on what they've used on a daily basis. Simply put, comparing VS against any other IDE that I've used (I haven't X-Code), VS simply pwns in the debugging department, so far as .NET is concerned. There simply isn't any basis for comparison. VS debugging in C/C++ is inferior, but it has greatly improved in the last version (2010).

Code completion and template-completion without plugins is somewhat on par with eclipse. I don't know anybody that works professionally on .NET without plugins like ReSharper, JustCode or CodeRush. Anyhow, vanilla code-completion in eclipse for Java vs in VS for .NET is on par.

Coding experience is eclipse for java is superior (without plugins). You've got all sorts of navigation (VS only got ctrl+, in 2010), and the shortcuts for equivalent navigations are more convenient in eclipse than in VS. Compare alt + left arrow and alt + right arrow for navigating to the previous editing point, vs ctrl + - and ctrl + shift + - (if you've got multiple keyboard layouts, this might conflict with the layout switching shortcut). Most of the default keyboard shortcuts in VS (no plugins) suck (who the fuck thought to make Ctrl + e, Ctrl + C commenting in c# profile? vs ctrl + / in eclipse). Sure, you can reconfigure everything, but the default sucks. And why isn't GhostDocpart of the built-in VS functionality?

Now, VS + plugins for .NET is unparallelled. Extensions provide easier navigation, smarter templates, and tons of refactoring. The thing you are most likely to use the most in a big codebase are the navigation features. There are some clunky attempts for free extensions that provide basic navigation in VS, but they are nothing compared to the commercial offerings. Most of what these plugins offer in VS can be found in Eclipse for Java with the default installation, but the features are clunky and half-finished. Take navigation, for example: you can navigate to resources (understand: files/projects), but you have to put every letter in the right order (implemented as string.startsWith). You can search with all caps (i.e. for abbreviations - if you want to go to MyBigCaseClass, you can type MBCC), but guess what: you can only enter them in order.

So far as refactoring goes, you've got everything in eclipse, but they've managed to make the menus overcrowded and confusing. For the time that you'll spend finding what you need in the menus, you'll refactor the code by hand. Both IDE-s have "quick-fix-on-the-spot" functionality (in VS something like alt-shift-f10 IIRC, and in eclipse ctrl+1), which is nice.

For graphical designers - I haven't used one in eclipse. There is supposed to be one built-in for Swing and SWT, but it doesn't launch automatically or in any way obvious, so I've never tried it. In VS, the WinForms designer is legendary. It works. The XAML designer is very fragile, and I haven't seen production code that doesn't break it. Sure, you don't need a designer for XAML as it is very easy, but still. Now computers are more powerful and you won't notice it, but the XAML designer is terribly inefficient, and it used to bog down dev machines at work. The ASP.NET designer is slow, and might as well work, but I've almost never used it, as I worked on stuff that can't be handled by it. But my scenario was quite rare (unless you do a CMS or something bigger, and probably not even then).

For the types of work - I've only worked professionally with .NET. My experience with Java is mostly doing my MSc dissertation - an IDE based on Eclipse for an in-house language. In .NET most of the jobs are about building trivial web sites or supporting some internal network. For Java - my friends work at Cisco, banks, SAP Labs, etc - big corporations, where you mainly support Indian code and gems (no offense meant). Sure, you can do apps for Android, but those tend to be start-ups and small firms. It can be risky, as the competition is fierce and there is no guarantee your app/game will sell in the sea that is Android Market.

If, by some chance you want to go the academic route, Java is perhaps your only choice besides C++. At least here in the UK there seems to be some irrational dislike of Microsoft, bordering on hatred. As if there isn't any greater pleasure in life than bashing Microsoft. You will hardly find any academic paper that uses anything other than Java, unless performance is important (c++), or, in some rare conditions in AI, prolog (although they rewrite it in Java/C++ for performance). Some papers might touch Ada, but those are usually around reports for failure in NASA and other US-government-financed (since they are in public domain), very old, projects.




PARTNERS