Jump to content

  • Log In with Google      Sign In   
  • Create Account


frob

Member Since 12 Mar 2005
Offline Last Active Yesterday, 10:39 PM
*****

#5079488 std::unordered_map::insert() Return Values

Posted by frob on 21 July 2013 - 10:51 PM

I understand the differences between how the methods work; what I want to know is why the single insertion methods without a hint return a pair with a boolean value indicating success, while the methods accepting hints don't return a boolean value indicating whether or not they failed. From what I can tell, if an element already exists in the container, the insertion fails, and the methods accepting hints are no exception.
 
So, why does one return a bool, and the other does not?

 

There could be a lot of why questions.

 

Why did they provide a hint version?  The documentation from GCC explains it pretty clearly:

 

In the case of <code>std::unordered_set</code> and <code>std::unordered_map</code> you need to look through all bucket's elements for an equivalent one. If there is none the insertion can be achieved, otherwise the insertion fails. As we always need to loop though all bucket's elements, the hint doesn't tell us if the element is already present, and we don't have any constraint on where the new element is to be inserted, the hint won't be of any help and will then be ignored.

 

In the case of <code>std::unordered_multiset</code> and <code>std::unordered_multimap</code> equivalent elements must be linked together so that the <code>equal_range(const key_type&amp;)</code> can return the range of iterators pointing to all equivalent elements. This is where hinting can be used to point to another equivalent element already part of the container and so skip all non equivalent elements of the bucket. So to be useful the hint shall point to an element equivalent to the one being inserted. The new element will be then inserted right after the hint. Note that because of an implementation detail inserting after a node can require to update the bucket of the following node. To check if the next bucket is to be modified we need to compute following node hash code. So if you want your hint to be really efficient it should be followed by another equivalent element, the implementation will detect this equivalence and won't compute next element hash code.

 

Why does the version that accepts the hint not include a flag indicating if the content was already there?

 

If you already have the value for the hint (as the docs mention above) "it won't be of any help and will then be ignored."  So why provide it?  For consistency. There is no penalty for having it, and adding it allows consistency between all eight containers.




#5079426 Implementing board games

Posted by frob on 21 July 2013 - 05:47 PM

Get permission.



That is all there is to it. Get permission or don't do it.



The fact that they did not reply does not grant a legal waiver. For example, if you wrote to Hasbro and asked them if you could clone Risk, their lack of reply does not mean you can go ahead and make a clone. That means they have evidence that you know your actions were likely infringing; in many court cases that means an automatic 3X the maximum damages.

Making an unauthorized direct clone of a board game would be a violation of many forms of IP. Trademark law applies to the names of everything, copyrights apply to visual elements, trade dress laws, unfair competition laws, and a wide varieties of other laws apply to the game. Naming it "<game name> mobile" would also be a trademark violation.



If you intend to clone a specific game, make sure you have proper written permission from the owner. This will almost certainly involve lawyers, contracts, in-person visits, and an exchange of money. Negotiation of permission is something that requires a lawyer to represent you. There are many different things that need to be included in the contract. If something important is forgotten, bad things can happen.



Making a new game in the form of another is possible but be careful. For example, there are many Monopoly clones, but it is a very risky area. You will need to invest in some serious lawyer-time to make sure you don't violate their rights, and then when the inevitable lawsuit or C&D order comes, you will need to discuss the specific claims with your lawyer to make sure you are in the clear. Even then the existing company can take you to court, and win or lose it will be expensive.


If you cannot negotiate permission, make something new and creative of your own.


#5079357 Taxes / Deduct Contract Payouts

Posted by frob on 21 July 2013 - 11:56 AM

Moving to Business & Law forum.

 

Matias has the best answer above.  

 

It depends a great deal on the circumstances. The results are different if you have established a partnership, employment, or contract relationship.  

 

If you never made the relationship formal (perhaps through a collaboration agreement, incorporation documents, or independent contractor agreement) then the law can get extremely nasty.  In fact, without some of those documents it is improper for you to sell the game since neither you nor the artist have all of the rights.

 

 

You are talking about tens of thousands of dollars, plus much more over time.  You are long overdue to commit the small investment of around $200 to properly set up your business.




#5079354 3D Object Manipulation Mobile Game Development Framework

Posted by frob on 21 July 2013 - 11:50 AM

Another Unity vote.

 

You start out saying you are a programmer.  That is fine.

 

Then you describe doing the job of a designer.  That is also fine.

 

Games need both.

 

 

The visual runtime aspect of Unity is there to help designers.  It is not the only view of the game, and it is a view that programmers will use only to test their code.  Programmers using Unity will see all the code they want.

 

Your game will probably also need more models, animations, vfx, audio, and other elements.  You say you have only a single model, but one model and an up/down animation generally does not complete a full 3D game.  Very few 3D games can be implemented with a single 3D model and no animation.  Unity makes it easy to mix all of those components.

 

Either that, or you can write your own engine, decode your own animations, write your own animation control system, implement an audio library and add hookups between animation scripts and code.  And on, and on, and on.  It is much easier to go with an established engine like Unity.




#5078456 [Requesting Feedback] Portfolio

Posted by frob on 17 July 2013 - 09:19 AM

A simple search finds many good sites.
 
Good list of projects, includes images of everything, short description, plus source and executable for most.  Very well done.
 
Images, descriptions, and details.  Lacks the source code and executable, but well done.
 
Images, descriptions, and either videos or playable demos.  I don't like the visual style, but well done.




#5078452 XNA to C++

Posted by frob on 17 July 2013 - 09:05 AM

XNA is dead, in that there won't be any changes to it.  But why is that?

 

XNA is based on D3D9.  XNA serves as a bridge to Xbox 360 hobby development.  Neither D3D9 nor X360 libraries are going to change.  So there is no need to modify XNA.

 

 

That does not mean XNA or D3D9 or X360 projects will suddenly cease to work.  They will continue to work.

 

If you want to use XNA, then do so.  It is not going anywhere.




#5078109 New to development, which engine should I use?

Posted by frob on 16 July 2013 - 05:22 AM


My main problems relate to the cost and the impending(?) release of udk 4. (dev duration may be over a couple of years)

First, the cost.

 

While you are developing and earning no money, the cost is $0.  

When you release, there is a single $99 charge.

After you release, until you don't cross the $50,000 threshold the cost is $0.

After you release and after you have made your first $50,000, you need to start paying money.

 

Think HARD about this.  Will your hobby project will realistically cross that $50,000 threshold?  (Hint: no.)  

 

Assuming you are the exceptional rare breakaway talent, then you are correct that 25% is a bitter pill. Odds are that you will never be that successful, and in the extremely unlikely event that you become that successful, remember that you still get 75%.  After taxes, that is somewhere closer to 40% of the gross, but that is still money you would not have had if you didn't develop anything.  Given the choice between 0% and 40% net, I'd choose the latter.

 

 

 

Second, you are concerned about a future release.  

 

When they release a new version, the old versions will not become invalidated.  They will continue to work in their present form, and they will continue to work indefinitely.

 

After they release a new version, you have the option of moving over to the new version.  It is one of many options, you do not need to take it.

 

 

 

UDK is certainly a powerful tool, and many people use it.  If you believe it will be the best fit for you, then those two concerns become quite minor. 




#5077994 Emo framework for mobile games?

Posted by frob on 15 July 2013 - 05:21 PM

Pruning your post a little bit:

 

Hello! I've been trying to figure out what's right for me in the Mobile Game Development world, and here are my results so far:

 

LibGDX - Got to the point where nothing made sense

Cocos2d - Too hard to use

Standard Android SDK - Said to be really slow and hard to use

Kivy - Can't seem to find a good way of learning it

 

Have you got any suggestions for a mobile game engine, other then ones that use C++, Objective C or C and ones that are NOT game makers. I don't understand why people don't want to do 100% of the code anymore. It saddens me :|

 

Anyway, if you've used the Emo engine, would you recommend it? What would you recommend over it and why(as long as the engine meets the criteria above)?

 

Thanks! Any replies are appreciated!

 

You are learning many things right now.

 

* Mindset of programming

* New programming language

* Mobile device programming

* Game programming

* Graphics programming

 

If GDX and Cocos2d are both hard for you, then you simply are not ready to add mobile devices to your skill set right now.

 

Start out by learning how to develop programs on the PC.  Wait until you have mastered that before you start cross-compiling and remote debugging on mobile devices.  

 

After you are comfortable with programming on the PC you will find the transition to mobile development to be less difficult.




#5077955 2D Graphics on Android. Should I use OpenGL ES?

Posted by frob on 15 July 2013 - 02:21 PM

Depends on the usage, depends on the device.

 

New devices and new OS versions (Jelly Bean) support hardware acceleration on Canvas drawing. Older systems (60% of devices in the wild) a will keep everything on the main processor.

 

So for 60% of devices the images will be manipulated uncompressed, will not use video memory, and get no special treatment. Performance will be approximately linear based on the number of items drawn.  

 

If you have 50 or 100 blits to the Canvas, you should be able to reach a reasonable framerate even on old devices.  More blits = more memory requirements for each image you are drawing and more CPU time to do the work.

 

 

If that is sufficient for your game, then go for it.

 

Of course you can get much higher performance with OpenGL ES and take advantage of batch operations, compressed textures, asynchronous specialized hardware and memory, and all the other goodies it gives you. But if your game doesn't require it, there is no need to force you down that path.




#5077945 C++ trenches, hpp prototype

Posted by frob on 15 July 2013 - 02:00 PM

Reading that over, it looks like your question is about how namespaces work.

 

>> Why on earth can't i say: class engine::Bitmap?

 

Because that is what the standard requires. Declarations must be within a namespace body.  You can declare it with this line, if you want:

 

namespace engine { class Bitmap; }

 

Or with this set of lines:

 

namespace engine {

 class Bitmap;

 class foo;

 class bar;

}

 

There is no shortcut that uses namespace::class format.

 

>> What do you guys usually do about this?

 

When you need to migrate code that involves wrapping code in namespaces, usually it enough to wrap the implementation within the namespace and then lean on the compiler and linker to find issues.

 

If the definitions (the implementation files) are wrapped inside the namespace then anything relying on it will not compile and link correctly unless it references the namespace.  Wrap the definitions, build the code, watch it fail, fix all the broken lines, repeat.  With 21K lines it should take only an hour or so.




#5074557 Dealing with corrupted files in Linux

Posted by frob on 01 July 2013 - 03:10 PM

Well it are only a few statistics (its a vehicle, stuff like hours and distance are stored), so that might be a bit of overkill. And if the files do get corrupted, it's not the end of the world. At least not if the program just keeps working and can store files again. But thanks nevertheless for the hint!

 

markr has the correct solution above.  

 

You should always follow this pattern. It doesn't matter if you are writing to disk or making an assignment operator in code. It does not matter if the code is insignificant temporary code that will probably go away.  It doesn't matter if the pattern feels like overkill. The pattern applies to copies of everything, not just files on disk. It is the pattern to follow.

 

Get into the habit of whenever you are replacing something, first make a temporary object that has all the properties you need, and after it is successfully created swap the temporary for the old one.




#5074327 Android game development?

Posted by frob on 30 June 2013 - 08:33 PM

If you want to make a game for any of the mobile platforms you will need to use tools for that platform.

There are a few cross-platform tools available (in the Forum FAQ) but you will notice that Lua is not one of them. Some of the free tools support Lua script, but they require additional work.




Much of the rest of your post deals with doing business as a youth.


The answers to 2, 3, 4, and 5 are "No, not without an adult."


At age 13, you cannot publish your programs by yourself. Some of the SDKs and development tools also have agreements that cannot be entered into by a minor.

It may not feel like it, but posting apps and games for sale online is doing business. Taxes are involved, contracts (express or implied) are involved, financial regulations are involved, and so on.

At age 13 you will not legally be allowed make the agreements with Apple or Google or Amazon or any of the other major game distributors. You will need a parent/guardian to agree to the forms, to provide bank account information, and to provide tax information. There are ways for it to be done, but in order to do it legally your parents need to be active participants.

Also it costs money for the publishers to provide the service. The fees they charge is actually very small for the business world. When you become an adult you will discover that the fees (and taxes) of the real world cost much, much more. Get your parents involved if you really want to enter the business world.


#5073701 Rotating an image to face a point

Posted by frob on 28 June 2013 - 04:13 PM

An asside, if event.y=0 you have a divide by zero.

 

When you say "continues to rotate", I assume that is because you don't have anything that turns the rotation off.  You simply call postRotate every time, so the thing gets rotated every time. Is that intended?

 

Also, you don't give much context but I think you may want a turret that slowly rotates toward a touch.  You might be better off adjusting the angle by first taking the arrcos of the dot product between the normalized current direction and the normalized touch's direction, clamping that value to a maximum (so it moves slowly), and then using it for the rotation.




#5073672 Is it Important to have a Concept for a Game?(Small/Medium/Large)

Posted by frob on 28 June 2013 - 02:36 PM

1) "Is it really important to have a game concept for a game?" I mean ask yourselfs, if you still wanna change and things in a finshed or almost finished game you would have to recreate or modify the concept. Or what if you would have a medium or small project? Would you still need a concept or not?

2) And to concept what kinda phases are there? Would there really be only 4 Phases or more? Is it like changeable like the HERMES Concept for IT project or is it something fix you just have to follow to have a successfull game?

 

Thank You For Your Feedback

 

 

EDIT: Rewriting for the For Beginners forum.  Sorry about that.

 

1) You need to know what kind of game you are making.  You cannot suddenly decide "We're almost done with this shooter, let's turn it in to a side scroller!" Or perhaps say "My driving game is almost done, i'm going to change it to a 2D puzzle game".  

 

For medium to large games there is much more involved.  There are game design documents that evolve over the life of the process.  There is a lot of work involved to come up with a very clear purpose of the game. Usually this is best expressed as a single statement or slogan, every other design can be approved or denied based on that single statement.

 

For a hobby game, do what you want.

 

 

2) There are no required stages.

 

For medium to large games, this is just one piece of the business operations plan. It is common (but not essential) to have a concept phase where the concepts are reviewed and the details worked out, a prototyping phase where the idea is vetted for actually being fun, and lots of ideas are experimented with and discarded.  Then you have another phase, perhaps called pre-production, where core components are implemented.  This again gets tested and vetted to ensure it is fun.  Then another phase, production, where the game actually gets made. This can include main development, feature complete, alpha, beta, pre-final, and final stages. Then there is post production where everything gets packaged up, distributed, sold, sold back and returned, players are supported, and more.

 

For a hobby game, do what you want since you will likely never sell it.  If you intend to commercially release it, you better develop a solid business plan before developing the game.




#5073643 a = b = new c?

Posted by frob on 28 June 2013 - 11:23 AM

What would be the point of such code??? One pointer is enough imo...

 

Depends on the algorithm.  

 

There are many that require two pointers, one that will always be there and another that gets modified.  In this case they are initializing both pointers at once. 






PARTNERS