Jump to content

  • Log In with Google      Sign In   
  • Create Account

Josh Petrie

Member Since 11 Jun 2003
Offline Last Active Private

#5307275 My College Dilemma

Posted by on 22 August 2016 - 03:45 PM

Is there anything else you're interested in studying?


I normally would not advise a "game design" degree, because in general I think those programs aren't worth the money; generally the programs seem extremely shallow or overly topical (that is, focusing on trends).


 A computer science degree is a good course of action for aspiring game programmers. It's not necessarily a good idea for somebody who isn't interested in computer science (which is not "programming"). Consequently if you're looking at the degree because you think it might be "better" for your career but aren't actually interested in the actual subject matter... I would recommend against it, and instead suggest you take the game design degree program or some other course of study related to things you are actually interested in studying.

#5307210 C++ Librarys - When to use .lib vs including .h/.cpp

Posted by on 22 August 2016 - 09:44 AM

Distributing reusable code as a library is usually advantageous because


  • it is fewer files for the consumer to wrangle (just one library file and one header at the minimum)
  • it is faster to compile, because it's already compiled, so the consumer's compiler does not need to recompile it ever
  • it means you are not exposing your source code directly, which is advantageous if you don't want consumers to have direct access to the code for whatever reason

Naturally you can eliminate these advantages if you handle the building and distribution of the library poorly (such as not collapsing your public headers to as few files as possible), and some of these advantages may not matter to you (maybe your project is open source, so keeping the code private is not a concern). Yes, consumers do need to configure library and header search paths, but that's generally assumed to be a basic cost-of-doing-business and isn't really that much harder than adding multiple external source files to a project.



Just distributing the source directly means you don't have to deal with all the various build configurations needed to ship the appropriate variants of the library for all supported platforms, so that's more advantageous to you. However you are sometimes taking that savings at the expense of advantages for the user (or at least, at the cost of creating potential disadvantages). For example, if your code doesn't compile cleanly on a client's machine because they used a stricter warning level, that's now something they have to manage or work around themselves.


Generally I find source-only distribution to be worthwhile if you have a single-header or maybe a single-header/single-source pair. But generally if there's more than one file involved, or any source files, I'd prefer a library and will usually build such source-only projects into a library myself before linking them with any of my projects.

#5307038 How to use Swift(Xcode) to write the slither.io?

Posted by on 21 August 2016 - 11:14 AM

That seems, as I said in your StackExchange post, reasonable, although I wouldn't worry about implementing the Tiled map and importing it until you get the basics of the gameplay down in a simple, hard-coded box level or something. You may want to look into Apple's SpriteKit library, which can help you with the basics of getting sprites up and running and all that.

#5306908 Engine design v0.3, classes and systems. thoughts?

Posted by on 20 August 2016 - 01:27 PM

Play nice, please. And stay on-topic.

#5306839 Some problems with ECS design

Posted by on 19 August 2016 - 09:53 PM

What if someone want to remove component inside for_each? How to fix this bug?



Accumulate any objects that should be destroyed in a separate list. Once you've done the primary loop over the objects, delete everything in the list and discard it (essentially, defer actual deletion until the end of the frame). 

#5306261 Engine design v0.3, classes and systems. thoughts?

Posted by on 16 August 2016 - 06:20 PM

It's a pretty picture, but at the level-of-detail you've shown it looks basically like any other generic engine high-level architecture.

#5306079 Is it pathetic to never get actually helpful answers here?

Posted by on 15 August 2016 - 10:00 PM

So if I decide to leave the forum, how can I do it?



Nothing special, just stop coming to the website. 

#5305498 List of Smart Pointers to Objects

Posted by on 12 August 2016 - 10:38 AM

So it would be bad if the state wants to delete itself?


Depends. If you're talking about "delete this;" than that is almost certainly a bad idea. If you're talking about knowing that the state has completed its work and should become inactive permanently, that's another thing altogether. You already have a system by which a state can make itself active or not; this sets a flag which the owner of the state queries when doing updates. If you want to support "permanent deactivation," you can simply create a similar flag and have the owner collect all states that marked themselves as permanently deactivated during an update and delete them itself.


Personally it seems like a weird thing for a state to do, but maybe it makes more sense in the context of your specific implementations. 



For example, the state has its own key-events. Now, a key has been pressed that will create a new state. The old state is now pointless.



This makes a little more sense; this is just transitioning to a new state, which you can also communicate via some flags or calls to the owner. You may not actually want to destroy the original state here (what if the user wants to come back to it and see everything in the same spot?) though.

#5305490 List of Smart Pointers to Objects

Posted by on 12 August 2016 - 09:58 AM

So it is completely legit to have this authoritative owner which controls lifetime?


Yes, and it's usually good. Having clear rules and conventions about who owns what leads to fewer bugs, generally speaking, and easier-to-reason-about interfaces.

#5305486 List of Smart Pointers to Objects

Posted by on 12 August 2016 - 09:37 AM

There are many kinds of "smart" pointer, all of which do very different things and have very different semantics and implications regarding ownership (which seems to be the crux of your issue here). So what kind of smart pointer are you thinking about here?


A std::unique_ptr would probably be a reasonable choice, as it sounds like the component is the authoritative owner of the states and controls their lifetime. In that case you just reset() the pointer to release the underlying object.

#5304294 Cast your vote now!

Posted by on 05 August 2016 - 08:33 PM

#5304097 Linker Error - Can't Find The Cause.

Posted by on 04 August 2016 - 07:35 PM

So how do SDK's work then, if you only have to add the '.h' files?


You don't. You also have to link the appropriate library files (unless the SDK in question is contained entirely in headers). In some cases this is hidden from you somewhat, through various means, but it still has to happen. 

#5304000 A Lightweight 2D Game Framework Doesn't Seem To Exist

Posted by on 04 August 2016 - 09:43 AM

I've been thinking of rolling my own which would do the following:


That will make yours basically "by literally just one guy and super-duper immature," a critique you leveled at one of the possible choices on your list. If that's really a problem writing you own is maybe not the best solution.


I'd say if you need some functional aspect that you're not getting with other options, go ahead and write it. I wouldn't so much worry about whether or not other people want it, because "it" right now is so hand-wavy and abstract that lots of people are likely to say "sure, I want it!" but not have anything remotely near what you have in mind in their heads. And it can be very bad to be beholden to too many stakeholders with too many widely-varying desires too early in a project.

#5303852 Statically Link Sdl

Posted by on 03 August 2016 - 02:38 PM

but get sdl errors




What errors? We cannot read your mind, and so unless you provide the actual error text (actual error text, copy-and-pasted, don't re-write it from memory) there's not a whole lot anybody can do but guess. 

#5303716 Use Of Static Variables

Posted by on 02 August 2016 - 03:11 PM

Yes. You don't want to swing all the way in the opposite direction and blindly never use static.