Jump to content

  • Log In with Google      Sign In   
  • Create Account

Josh Petrie

Member Since 11 Jun 2003
Offline Last Active Today, 12:51 PM

#5270708 Game Engine Modules/Projects

Posted by Josh Petrie on 12 January 2016 - 10:34 AM

To have an engine that i can use to make basic games in and use as a test platform for learning new things (more specifically, low level aspects). It also means i can easily modify the engine while working on games.


This does not really have much to do with your stated organization of DLL/EXE/EXE though. Which means you're likely overcomplicating your approach for no reason. You have not stated a compelling reason why your project needs to use that approach, so you shouldn't (since it is a more complicated approach).
A static library will be significantly simpler to start out with, and can be easily adapted to a DLL if needed later. However starting out with a DLL, unless you're familiar enough with their production (and I don't think you are since you had to ask the question in the first place) will introduce a lot of boilerplate code, such as the necessity to expose a C-style ABI for your engine and do the appropriate marshaling and/or data hiding that gets in the way of accomplishing your actual goal of making something.

#5270282 Question about data and resources protection

Posted by Josh Petrie on 09 January 2016 - 12:06 PM

1) What do developers do to prevent the users from modifying the data/resources?




2) Which type of data is really important to prevent the users from modifying it? Is it bad to store information about the player progression in a campaign in xml files?



None of it. It's not bad to store data in XML files.

3) What should I do with my resources (.png .bmp .ttf .wav) before relasing? Write them to binary files?



If you want, but do it because you have a need to make things faster or smaller, not because you want to "protect" it.
Here's the thing. Anything you put on the users computer, at any point, including anything you display on the screen or play as audio, et cetera. Any of that can be intercepted and modified by the user on that computer. The user has far more control over what goes on on his or her machine than you do, so generally trying to worry about "protecting" your data like this on a single-player game is a waste of your time. The best cost/benefit assessment is usually to trivially obfuscate your data by stuffing it in a package format (like a renamed .zip even) and leaving it at that. It will deter a reasonable amount of modders who have basically no experience. It won't stop anybody who really cares, but then again you can't do anyway, and it's pretty easy for you to implement. Anything that involves sinking hours of your time into "encryption" or more involved obfuscation is almost always not worth the payoff in terms of the number of users it will actually prevent from tampering with your data.
And who cares? If the game is single-player, the ability to mod and tweak the game is almost always a benefit as it extends the longevity of the game and helps you build an organic community around it. It's almost always a plus.
If the game is multiplayer, well, store anything sensitive or important on your servers, because that's the only real way to be sure.

#5270215 Python for 1st language?

Posted by Josh Petrie on 08 January 2016 - 10:31 PM

What I am looking for is the most efficient way of reaching that ultimate goal of ability to program a PC game.



If I knew what this was I certainly wouldn't be willing to tell you for free, and neither would anybody else. :)


Your plan to start with Python is good; as Bregma said, you're plan to avoid C++ first is also good.


Find some introductory material for Python you can follow -- the Python website used to have tons of "getting started" and whatnot guides aimed at programmers and non-programmers alike, and probably still does -- and start with it. Build the exercises they suggest. Build exercises you set for yourself, like a simple "guess the number" game, or Blackjack, or Hangman. All of these can be done fairly simply without having to worry about the complexities of windowing and graphics APIs and are good ways to grow as a beginning programmer.


Once you feel comfortable, post those games somewhere here or elsewhere on the interest and ask for feedback with your code. Keep making simple text IO based games until you feel like you are ready to tackle learning a windowing and graphics API, and then pick one up and go for it.

#5270103 Criticism of C++

Posted by Josh Petrie on 08 January 2016 - 11:40 AM

This is your friendly moderator remind to be nice. Posts containing personal insults or attacks against other users are not appropriate here and will be dealt with accordingly.

#5267240 I have no experience AT ALL

Posted by Josh Petrie on 20 December 2015 - 05:28 PM

bisjac, I think you have misunderstood to some extent the "point" of this forum. In particular, you say:


but when someone tells me to learn something I don't want to learn, instead of giving helpful information, it kind of defeats the purpose of this forum.




The point of this forum is for inexperienced developers to ask questions and get responses from the more experienced developers. It is not to tell you what you want to hear, and consequently sometimes the answers from the more-experienced developers might not be what you want to hear. You don't have to take that advice, but if you're going to ignore it you must do so respectfully.


You are expected to respect the time and effort those developers put into responding to you in the first place and not insult or abuse them, as they are expected to respect you and not insult you (et cetera) for disregarding their advice. This is a community and it is one built on mutual respect. That also means you have to be open to hearing the responses from others, as well, and it seems that you've made it clear you don't want to do that here, so I'm closing the thread before things get further out of hand.


You are welcome to create subsequent threads if/when you have further questions about your journey to becoming a programmer, but I expect you to keep what I've said above in mind.

#5267239 I have no experience AT ALL

Posted by Josh Petrie on 20 December 2015 - 05:22 PM

I've cleaned up this thread somewhat, and issued warnings to the appropriate parties, for what it's worth.

#5266976 what is most in-demand programmer discipline in industry?

Posted by Josh Petrie on 18 December 2015 - 08:47 PM

A good programmer.



Why does this matter to you?

#5266555 Are macros like 'FORCEINLINE' worth it?

Posted by Josh Petrie on 15 December 2015 - 03:39 PM

Unless you know you need what __forceinline does (overrides the compilers own cost/benefit analysis), you probably shouldn't use it. If you know you need what it does (likely due to extensive profiling and analysis), you should apply it as surgically as is necessary after determining it's the best solution (as opposed to more algorithmic or higher level optimizations or reorganizations available to you). And after determining it will actually inline the code (as the compiler may still ignore you) and improve what you're trying to approve.

#5266070 C# Color Wheel

Posted by Josh Petrie on 12 December 2015 - 04:50 PM

I'm sorry, but I'm really not comfortable divulging the purpose of it.  I understand that in some cases it could make it easier to understand the best way to do it, but in this case I've told you all that is necessary.  I really want nothing more than a color picker that can restrict the range of colors that a user can pick.  What more clarification do I need?  The reason is not important, but if anyone has a way to accomplish this, I'm all ears.


Sorry, that is not how this works. If you're not willing to provide the information that others feel is necessary for them to answer, you should not expect them to waste their time grasping at straws.
If you can assert that you've provided all the information necessary to answer the problem, you must know the answer already. So I'll close this thread.
If you'd like to participate constructively, you're welcome to ask this question again and provide the information we've asked of you; specifically the UI technologies you're already using or capable of using to implement the rest of your UI.

#5265899 C# Color Wheel

Posted by Josh Petrie on 11 December 2015 - 11:37 AM

Specifically, it would be really good to know what you're using for the rest of the UI, as you'll want something that fits it.

#5265794 Cross Platforming: Switching to Java?

Posted by Josh Petrie on 10 December 2015 - 05:22 PM

Java is not going to magically make everything work flawlessly on multiple platforms. You still need to pay attention to what you're doing, choose libraries that are available one way or another on all platforms (just because the library is written in Java does not mean it does not use some interop to a platform-specific feature). So you'll still have to test it; if you can't test it on a Mac now, you can't test it on a Mac with Java, and so you should not support the Mac.


I wouldn't bother. You have project in a language you know that mostly works and that you're comfortable with. The effort you expend solving your outstanding cross-platform issues with that code may very well be the same as (or less) than the effort in starting over in a unfamiliar language with very little.


Stick with what you have and finish it.

#5265593 Vector Push Back?

Posted by Josh Petrie on 09 December 2015 - 10:13 AM

A new element is added to the vector, initialized as a copy of the push_back parameter.


Since you have no explicitly declared copy constructor in DataBlock, you'll get the implicitly-declared copy constructor from the compiler. That copy constructor will be trivial, since your type meets the requirements for that constructor to be so. That means the copy will be performed bitwise, the same as if you used memcpy or memmove.


Further reading:

#5264935 SDL - Confused with class pointers

Posted by Josh Petrie on 04 December 2015 - 04:15 PM

SDL_CreateWindow is a function, not a class. It returns a SDL_Window*.

#5264801 Alternatives to dynamic_cast

Posted by Josh Petrie on 03 December 2015 - 03:58 PM

The more important question is why?


In this case, you should examine why you need to access two very different sets of data depending on the specific type of Person you're interacting with. Whatever that operation is should make sense for Person in general (and thus be a virtual member function of Person). If it does not make sense for Person, but only makes sense for the individual subtypes, then your object model is probably incorrect.


For example, a (potentially) acceptable operation would be "print the vital statistics of this person." This is a bit contrived, but also simple to demonstrate, so I'll use it. You'd then have a virtual void PrintVitals (std::ostream & stream); method. When implemented for Student, it would do something like stream << m_studentId << m_gpa << "\n". But for employee it might instead print the employee number and job title.


You would not want to make GetStudentID() a virtual member function of Person, because that creates an interface that is not actually valid for all people; not all people have student IDs. 


Correctly designing OO interfaces is not about mimicking the real world exactly. It's about doing so where it makes sense, to ease and/or simplify the interface. In this case it very much sounds like (my first contrived example aside) you probably don't want to actually have a Person base class. You may want to check out the SOLID principles.


An alternative approach is to keep the Person base class, but dispose of the subclasses. Instead of inheritance, use composition. A person might have some common attributes like name and age, but student and employee data can be factored out and associated separately with the Person object.

#5264744 Mac os x game programming advice?

Posted by Josh Petrie on 03 December 2015 - 10:28 AM

If you want to use C++ (or Objective C or Swift), use Xcode.

If you want to use C#, use Xamarin Studio. 


If you use Xcode for C++ you'll still need to learn yourself a little bit of Objective C or Swift just to get the bootstrapping of your application squared away. It shouldn't require your understanding much more than the default generated code that come with the project templates though. Alternatively, find a library that handles the bootstrapping for you.


If you use Xamarin Studio for C#, you want to be using the MonoMac projects, probably. Xamarin Studio is freely available but contains a handful of hooks that try to get you to buy in to their developer programs. You don't need to do this if you don't want to, but you'll want to watch out for the dialogs (which to get you to "upgrade to Xamarin.Mac for this project" and the like) and choose the appropriate "no thanks" options.