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

Josh Petrie

Member Since 11 Jun 2003
Offline Last Active Private
-----

#4968426 To DirectInput or Not to DirectInput

Posted by Josh Petrie on 11 August 2012 - 09:37 AM

Through C++/CX for the .NET side of things. I'm entirely sure it's all possible yet, but I'm working on that side of it ATM and it seems to be going fairly smoothly... Is that not going to work?

No.

C++/CX is C++ with some extensions to support accessing the new Windows Runtime (WinRT); it is primarily syntactic sugar for COM support. C++/CX produces native code as WinRT is a native code framework. You cannot mix managed and native code in a C++/CX project, so you cannot even combine it with C++/CLI. Using C++/CX -- like using C++ -- gives you a 100% native binary.

C++/CLI looks the same as C++/CX because Microsoft basically lifted the syntax. C++/CLI would let you produce managed code, but it isn't C++ -- it's a managed language, so at that point you may as well just be using C#. There is no point to ever using C++/CLI unless you are writing an interop library to expose a native API to managed code or the other way around.

I might not be using the proper term here and may actually be referring to WInRT. But it all looks very similar to .NET to me... I wouldn't want to use a wrapper here either, I would want to interface directly with the library where at all possible for the clearest picture of what's going on.

Yeah, you're not. WinRT isn't .NET, it's not related to the CLR or managed code at all. Furthermore, you can't even use DirectInput for Metro apps in WinRT.

It sounds like all of your plans are based around an assumption of compatibility, when in fact the technologies you're all talking about are quite incompatible at varying levels. You should probably revisit your plan by determining what platform you want to target or what language you want to use and then doing some research into what is possible with that platform -- MSDN is an excellent resource, you should start there.


#4968220 Best language to make 2d games

Posted by Josh Petrie on 10 August 2012 - 04:22 PM

Well this got off-topic fast, didn't it?

I have stripped the topic of the irrelevant and off-course discussion concerning cx_freeze and Python, etc etc. Take it to some other forum, please.


#4967879 To DirectInput or Not to DirectInput

Posted by Josh Petrie on 09 August 2012 - 01:24 PM

So creating a game I hope to be able to compile and run as both Win32 and .Net 4.5,

To use Win32, you need C or C++ (or other native language). To use .NET 4.5 you need C#. How exactly do you expect to do this?

I'm considering using DirectInput to handle all user input as it'll basically be unchanged across both.

The code will have to change rather drastically in fact as the C or C++ interface to DirectInput (via COM) is superficially very different from the available managed wrappers that support DirectInput (SlimDX and SharpDX). The code won't directly compile at all.

I have a feeling you don't quite understand the distinction between Win32 and .NET. Win32 is a native C API, .NET is an implementation of the CLR. They are not equivalent technologies.

Could anyone elucidate why this might be the recommendation?

DirectInput is deprecated and just sits on top of Win32 messages or RawInput, depending. So it's generally better just to use Win32 messages or RawInput. The only thing you'd really need DirectInput for is joystick support.


#4967037 is C# an alternative to C++?

Posted by Josh Petrie on 07 August 2012 - 09:16 AM

This does not appear to be constructive at all.


#4956007 HELP!

Posted by Josh Petrie on 05 July 2012 - 09:31 AM

Please don't go so overboard tagging your post (for example, there is no need to tag your post with variations of your own username or variations of the word "programming" that are spelled incorrectly or different capitalizations of various APIs).

I have removed most of the tags.


#4950998 Looking to start programming, where to start?

Posted by Josh Petrie on 20 June 2012 - 09:35 AM

I would recommend you start with C# or Python. Learn the basics of the language with simple, text-based programs. You can graduate to simple text-based games (tic-tac-toe or hangman or the like) relatively quickly and keep working on those until you feel accomplished and comfortable enough with the environment to move on to something larger. Practice is key.

Isnt C# a subsidiary of C/C++?

No. C# is an entirely distinct language, although it has some syntactical similarities to other C-like languages.

I wanted to start out using Visual Basic, but read its outdated, would C# or Python be good starting languages?

C# or Python are both probably better choices. However, a newer version of Visual Basic (VB .Net) would be suitable as well, it's just sort of an ugly language with (in general) poor toolchain support for games. A lot of libraries and APIs that work in Visual Basic do so primarily because VB .Net is a managed CLR language like C#, so things "work" but they don't quite end up feeling right.

If I can learn to program one language, are most of them basically the same? (I know theyre all different, but theyre all programming languages so they have similarities right)?

Learning any language of one paradigm (imperative, functional, et cetera) would make learning other languages of that paradigm easier, and to some extent even make learning new programming paradigms easier, yes.


#4947146 Creating graphics for a full screen game? What dimensions?

Posted by Josh Petrie on 07 June 2012 - 01:27 PM

You don't own this thread and have no authority to attempt to dictate it's course. This is a discussion forum. The only people who have that authority are the moderators, and I am the moderator of this forum. Do not attempt to play rules-lawyer with me.

Now then.

I think that was pretty harsh, and quite frankly unnecessary. A game design doc can be one of the most helpful things when making a game if it's done right, and I don't know why you would accuse someone of making mistakes outright like that.

Yes, it was harsh. But I did not say that a game design document is a bad thing, I said that trying to do all the design work up front is bullshit, and quoted the term GDD to express some skepticism at the idea of specific pixel sizes being relevant to the design of the game. It's an implementation detail, and potentially one that belongs more in a technical specification if anything. As for mistakes? Anybody who believes they've never made any is a fool, or as Ravyne suggests, has never developed anything particular complex. All software has bugs in it, all designs have errors or omissions or exploits or loopholes. We make mistakes, probably more often than we made things correctly, and that's good because we learn from them. That's why we iterate.


The pre-development phase is free since I'm the one doing it.


The more important details I can include in the GDD that I give out to the team later the smoother and faster development will be = cost less money.


So It's just much smarter if I already know what sizes the images should be and even have them ready = saves lots of time because the programmer can just puzzle the pieces together instead of discussing and planning with me = cost more money.


Opportunity cost is relevant and needs to be considered. Especially if you going to hand off your design to a third party to actually get it implemented, you cannot expect to actually get anything produced without any kind of back and forth dialog and iteration. It is just impractical, it doesn't work that way. You will invariably have forgotten something that your developer will need to ask you about. You're only human.

Worrying about specific image resolutions isn't something you need in the GDD. What you want to call out is, as Ravyne suggested, that you want scalable resolution support. Your developer will be able to translate that into the technical details he needs to produce the implementation you desire.


#4947083 Knowing where to arrive

Posted by Josh Petrie on 07 June 2012 - 10:17 AM

I would suggest you start with a language other than C++, but you already knew that and don't really want to hear it, so why I should I waste my time dispensing more advice that you might have arbitrarily predetermined you don't want to hear because you think you know better?


#4947082 Creating graphics for a full screen game? What dimensions?

Posted by Josh Petrie on 07 June 2012 - 10:15 AM

My GDD is getting near completion so it's time to make it even more detailed...

I would venture to suggest that your next step should be to actually start making your game, instead of trying to do all this design and "GDD" bullshit up front. You're putting the cart before the horse, and if you spend too much time going too far in-depth with your design and pre-producing your art assets and all that you run the risk of having to throw away a ton of that time when it becomes apparent during iteration that something isn't going to work.

You've already made mistakes in your design and content production, so start iterating on something practical so you can expose those mistakes and correct them sooner rather than later.


#4947077 Need C++ Roguelike Tutorial

Posted by Josh Petrie on 07 June 2012 - 10:07 AM

There's RogueBasin, which evolved from Dungeondweller (which I mention for posterity only, as most of its information is likely extremely outmoded these days). You may also want to check out Amaranth.


#4932510 Need Help : error: syntax error before `*' token

Posted by Josh Petrie on 18 April 2012 - 10:38 AM

You forgoet a ";" from first line of code.

This is correct. Your first bit of code is:

//music
Mix_Music *music = NULL
You're missing the semicolon after the NULL.

Sometimes, when you see an error from a compiler and it points to a line that looks okay -- in this case, it's probably indicating the line
Mix_Chunk *muks = NULL;
which looks fine, you should take a look at the line (or the code) above the error. The C++ compiler processes code from the top down and certain errors confuse the parse enough that it cannot pinpoint the source of the error with complete accuracy.


#4907533 Slimdx Xinput - Exception Error - A short Code Provided

Posted by Josh Petrie on 29 January 2012 - 11:13 PM

None of those calls block, and there is no loop keeping the program alive. It's doing exactly what you wrote: determines if the controller is connected, prints one line, and exits immediately.


#4905341 Have i choosed the right path for beginners?

Posted by Josh Petrie on 22 January 2012 - 11:21 PM

Do less reading, and more actual practice. No amount of reading books -- especially on C++ (a poor choice for a first language, I would have recommend Python or C#) will teach you everything you need to know. Much of programming is problem solving and to train that skill you need to try to work on actual problems. Write actual programs, even simple ones.

I wouldn't bother with the DarkGDK thing either.


#4903323 is it posible

Posted by Josh Petrie on 16 January 2012 - 01:09 PM


Is it possible?  Yes.  Would I recomend it?  Nope.

I would suggest starting with C#, learn it, and then if you wish move on C++.

  and whichis better c++ or C#

They are different tools and neither is objectively better in general. However, as a first language C# is a better choice because C++ is rife with the cultural assumption that the programmer is always correct -- as a beginner this will rarely be the case.

Making console games is a difficult task for a beginner. C# (with XNA) is the most viable approach. With any other language or technology you will only be able to use homebrew libraries, which are often poorly documented and not the most user-friendly. You are not able to make games for any consoles that you can distribute (or play on non-modified consoles) without XNA, because you will not be able to obtain a license and development hardware for those consoles.

Focus on learning to program above all else; languages, tools and platforms are largely incidental.


#4902886 Can someone explain the problem with this compilation error!

Posted by Josh Petrie on 15 January 2012 - 12:37 AM

The problem is that piece.h and board.h depend on each other (by including each other). Such a dependency can never be corrected resolved, so you must change your code.

Remember that #include is just textual substitution by the preprocessor, and that the compiler builds each translation unit in isolation. A translation unit is originated from a source file (.cpp) -- header files are typically never explicitly compiled, their code is first preprocessed into a source file which is then compiled. In your build output, you should be able to see the actual .c or .cpp file the compiler is trying to build when it reports this error.

That source file probably includes piece.h, directly or indirectly. It probably does so before including board.h, directly or indirectly. This means that the preprocessor would have first evaluated the #include for piece.h, and then during the evaluation of piece.h, evaluated board.h. During evaluation of board.h, piece.h would be evaluated but because of the include guards in piece.h, no text was added to the translation unit.

Thus, the file preprocessed file (as seen by the compiler) probably looks like this:

    namespace Foo {
    class Piece;

    class Board{
        //ERROR OCCURS HERE
        bool isOccupied(int x, int y,const detail::PieceEnums::PieceID pid)const;
    };
    }

    namespace Foo {
    namespace detail{
        struct PieceEnums{
            enum PieceID{ ID1, ID2 };
        };
    }

    class Board;

    class Piece{
    public:
        void foo(Board& b)const;
    };
    }
    #endif
    

You can see, then, why the compiler complains that "detail" is unknown -- it hasn't been seen yet at the point the error occurs.

You need to break the dependency between the files to fix the problem. From the code you've provided, board.h doesn't need anything from piece.h except the enum, which you could pull out into its own header, for example. A forward declaration of Piece (or Board) would allow you to use Piece (or Board) as pointers or references or in other ways incomplete types are permissible as well, without requiring the #include.




PARTNERS