Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 12 Mar 2005
Offline Last Active Today, 03:08 PM

#5244557 Octrees with multiple-sized objects

Posted by frob on Today, 03:10 PM

The only time you'll run into problems with this model is when you need to move the planet. Moving a small object means only testing a small number of objects; moving the very large object means you need to test against all the smaller objects, which based on your description could potentially be a problem.  If your planet moves you've got to check everything nearby, and at planet scale that could in theory be an enormous number of objects. 



Asteroid moving = few checks. smile.png


Planet moving = lots of checks. sad.png

#5244430 Multitouch

Posted by frob on Yesterday, 08:55 PM

The index order is not guaranteed.  That order can change, and sometimes individual items can be missing altogether.


The id value is guaranteed to be the same for the duration of the touch.   That's why in the code I posted, it loops through all the items in the event (their index), and then turn them into id with getPointerId:

  for( int p=0; p<pointerCount; p++ ) {
    int pointerId = getPointerId(p);

Then you can use the pointer id, not the index within the event, to track that motion.

#5244423 Multitouch

Posted by frob on Yesterday, 07:14 PM

Probably the reason it is frustrating is you are treating all ups, downs, and moves as though they are the input.


You cannot do that on touch devices.


You must always remember that there are an arbitrary number of fingers touching the screen. Maybe they've got big hands, are hitting it with more than one finger, are touching the side of their device as they grip it, are resting their hand on the screen, or a friend is pointing and gesturing "look at that".


Re-iterating:  There are potentially many simultaneous sources of events. 


Every time you get a motion event, you must find the correct pointer ID that matches.


This code entered directly into the browser rather than being tested in a project, but hopefully correct enough to give the idea of the basic framework:

ArrayList<int> pointersThatMatterToMe; // Something that you build and manage in your class somewhere
static final int MAX_POINTERS_TO_HANDLE = 2; // Your magic number, no idea why you choose 2, but you did.


void myHandler(MotionEvent ev) {
  int pointerCount = ev.getPointerCount();
  for( int p=0; p<pointerCount; p++ ) {
    int pointerId = getPointerId(p);
    switch(ev.getActionMasked() ) {
      case MotionEvent.ACTION_DOWN:
      case MotionEvent.ACTION_POINTER_DOWN:
         int pointersInBuffer = pointersThatMatterToMe.size();
         if(pointersInBuffer < MAX_POINTERS_TO_HANDLE) { // I have room to care about this one.
             processNewPointer(pointerId, ev.getX(p), ev.getY(p)...);  // whatever processing you need.
     case MotionEvent.ACTION_MOVE:
       if(pointersThatMatterToMe.indexOf(pointerId) >= 0) { // found it in the pointers I care about.
         processUpdatedPointer( pointerId, ev.getX(p), ev.getY(p)...); // whatever processing you need.
     case MotionEvent.ACTION_UP:
     case MotionEvent.ACTION_POINTER_UP:
       if(pointersThatMatterToMe.indexOf(pointerId) >= 0) { // found it in the pointers I care about.
         processLiftedPointer( pointerId, ev.getX(p), ev.getY(p)...); // whatever processing you need.
         pointersThatMatterToMe.remove(pointerId); // No longer care about this one.
    ... other events you care about here ...

That code is all ad hoc, but hopefully that puts you back on the right direction.

#5244370 Security for your Mobile Games

Posted by frob on Yesterday, 02:23 PM

Welcome to the site.


Since you may have missed it, and since yours is borderline commercial, there are many areas on the site to posts. If you are looking for people, those go in the Classifieds system. If you're talking about a game-making products or tools for sale, those go in The Marketplace. If you're looking for discussion about your product, read the sticky post in the Your Announcements forum to see where it should go.


For the discussion topics about security in general, those are appropriate for this sub-forum.


help protect game apps from 2 things: (1) decompiling/reverse-engineering which leads to piracy, IP theft, modification/tampering/repackaging, and (2) runtime memory hacking which leads to imbalanced gameplay (e.g., free gold, unlimited hitpoints, etc.)

Two good things needing protection, for some games. 


The first one is commonly addressed through subscription models of SaaS.  The client is free, but features are paid. Anybody can download the clients for online games, it is the account credentials that give you access to your features.  Of course, if your game is entirely offline, there is only so much you can do before you are annoying your paying customers and getting nothing in return. 


The second one normally only makes sense in multiplayer games; in a local-only game they can modify their own values all they want without impairing anyone. The solution to that is well-known to network play developers: Only give the client enough data for them to display public information to the player, and validate everything they send back.


(a) Have you thought about protecting your games?  

(b) What are your biggest concerns?  

© Have you looked into different solutions to protect your games?  

(d) What has been your largest barrier to adopting a security solution?

For my history: 

(a) We have tried various things. The most solid we've found is the SaaS model, make the client free to download. On mobile, the next best is to use the various Store libraries to verify that they've got a receipt or authorization for the product. Anything else is an escalating battle, it needs to protect the product from piracy until the costs are recovered and some profit is made, usually 2-3 weeks. Very few protections are able to survive that long.

(b) From telemetry, the biggest concern for the products I've worked on has been hacking and attacks from Eastern Europe (Romania, Poland, Ukraine, Czech Republic, etc). When we are not sold in the region or localized to any of their major languages, they are still appear high up the telemetry list. When we do sell in the region, the highest I've ever seen was a 2% registered rate for non-SaaS products. The only reliable way to get money from consumers in that region is a SaaS model, and even then, those accounts are frequently stolen cards. Some regions have no respect for paying content creators nor any morals when it comes to theft and fraud.

© Many, over the years. You've probably seen quite a lot of the hate EA has received for assorted DRM techniques. It is not the dev teams who adds the restrictions. Even with protections, many of the popular games quickly drop to above 90% piracy rate globally. 

(d) Remember that the game publisher does not own the computer. Any security system you adopt can be overcome, any data you transmit can be intercepted and used by the client. The only way to prevent someone from using data is to never give it to them in the first place. That is why so many major games have moved to SaaS, always-online models.

#5244312 Constructor Initializer List and Heap Allocation

Posted by frob on Yesterday, 10:32 AM

It can be a good practice, and it mostly depends on the object lifetimes and behavior.


In QT's case, the pointer is back to the parent, containing object. The UI object should always have a shorter life than its parents, and it needs a pointer to send messages back up stream. 


Think about those carefully. The object lifetimes of the owner will always exceed the lifetime of the child, and the child needs a way to communicate back to the parent. When both are true, the design works well.


If there were some way the parent or owner could have a shorter lifetime than the child then the design would be problematic. In that case the UI object would be holding a dead pointer which is a very bad thing; instead it should go through a handle or similar protected indirection that would consume messages to the now-missing endpoint. But since that isn't the design and object lifetimes work out, keeping a pointer to the parent works well.


Edit: Ah- misunderstood your concern. Looks like Josh Petrie handled that detail.  

#5244308 Multitouch

Posted by frob on Yesterday, 09:58 AM

getPointerCount() == 2

You may have more than 2. 


The Android documentation on MotionEvent shows how to iterate over all off them, no matter how many there are. There may be one.  There may be two.  There may be five. There may be any number, all you know for an event is there are always at least one. 


Since there are always at least one, you should always iterate over all motion events and handle them appropriately.

#5244199 Source-engine

Posted by frob on 02 August 2015 - 03:16 PM

Moving to For Beginners.

You could probably leverage either game engine to make a game. I've no idea which would be a more natural fit for your game, since the short description of "a game with rocket jumping" is hardly a comprehensive design document, but with a bit of effort I'm sure you could generate an excellent game with either system.

#5244173 Which registrar should I use?

Posted by frob on 02 August 2015 - 12:01 PM

Depends on your needs.

If you don't know what you are doing, it can be easiest if you have a hosting provider that also handles your DNS services. They know what records need to be created and where to point them.

If you know what you're doing, if you know how to point your records to various places that handle your actual services, you can shop around to an enormous number of providers. I like Google Domains, they're relatively inexpensive and offer a long list of services.

#5243942 Beginner Projects ?

Posted by frob on 31 July 2015 - 09:30 PM

good starter projects that will familiarize myself with C# ?

Good projects depend on your skill level.


Like the others, I recommend not starting with graphics.  They're flashy and all, but they require significant work.



Assuming you've never programmed before and want to learn to program in C#:

  1. The first few programs traditionally are writing something similar to "Hello, World!" to the console.
  2. After you are comfortable with that, a simple 'guess the number' game is often a good goal.  This gives you some flow control, loops, I/O, number generators.
  3. After that, perhaps something a bit bigger like tic tac toe on a human-versus-human board.  
  4. After that, write an AI for your tic tac toe game.
  5. Text-based card games or text adventures frequently follow those.
  6. Once you're comfortable with a few things, pong is an ambitious first-graphics program.
  7. Then build your pong up until you are comfortable with it, with features including menus, sound, and the rest.
  8. Then with that as a base, a breakout game, then expand it to an arkanoid style game. 
  9. Now you're comfortable. Time to move up to an existing engine, or decide you want to keep going on your own from scratch.

Although lots of beginners gravitate to them, MMOs are out of the question until you've got a decade or so of experience or a few hundred million dollars to invest.

#5243913 cmake & glew on linux & windows

Posted by frob on 31 July 2015 - 05:09 PM

I don't want glew to be part of my project... I want GLEW to be installed automatically if needed.


You are right that you shouldn't make it part of your own project.  GLEW has some confusing ownership issues, with portions released under four different licenses and sparse documentation about which is which. Some are BSD-like, some are MIT-like.  Critically, some are GNU GPL, so if any of that stuff gets incorporated you are automatically pulled into that license if you aren't already.  Be VERY careful about pulling in other products.


As for automatic installs, that's not how it is normally done for source code releases.


It is a bad idea to auto-install software on any machine you don't own, especially a development machine. The other people may not agree to the license, they may have other editions on their machine and you're introducing conflicts, they may have other software configurations on their machine that you are ruining.  Don't do it.


Typically you provide a link in your build system to the module, as you seemingly did with ${CMAKE_BINARY_DIR}.  Document that CMAKE_BINARY_DIR must be configured to point to somewhere, and you tell them the web page for GLEW so they can download it themselves.


Within your own group you may want to have scripts that install a previously-downloaded release GLEW, likely running their installer with the correct options or just copying directories from a network location you have configured.  Otherwise, within your group you download and install it yourself.

#5243669 Is flash still relevant for mobile platforms?

Posted by frob on 30 July 2015 - 04:30 PM

So is there any point in making a flash game for iOS/Android?

If you want.  


While new tools are unlikely, the existing tools did not suddenly break, nor did they vanish.  


They will likely continue to work just fine for several more years.  I would not start a new multi-year project using the tools, but neither would I abandon an existing project because of that reason alone.


Also if you did use flash for say Android, how would you use C++ with it?

You can write your own code that interfaces between the two.  It takes effort and work, but can be done if you are comfortable with systems integration.


If you are new to the platform, new to Flash, new to Android, new to systems integration, new to C++ on Android and new to remote debugging, that is an awful learning curve.  I wouldn't want to climb them all at once.


There are tools like Scaleform you could leverage. Note that neither C++ nor ActionScript are the preferred languages for the device. It will be work. Unless integrating the system gives you a big advantage, such as you already have a near-complete game written in Flash, or you've got an existing group of AS developers you are trying to support, that is a big investment that would likely be better spent implementing it in other ways.

#5243497 Maya and Unity

Posted by frob on 30 July 2015 - 01:21 AM

Sounds like two communications problems. One between you and your boss, the other between the two pieces of software.

For the software, there are error messages. They mean things. Read the exact error messages and try to correct them. If you don't understand them, copy the exact error messages and we can help decypher them.

For the human communications, you need to both understand what you are trying to accomplish, and make sure you both understand your roles. It may be that your boss expects more than you are currently able, or that you expect more of your boss than he is currently able; it may be that your boss lacks the skill to communicate with you, it may be you lack the skill to communicate with your boss. Unfortunately that one cannot be resolved by copy and pasting error messages.

#5243308 A* heuristic problem

Posted by frob on 28 July 2015 - 07:25 PM

A neat thing about the A* heuristic function is that if you leave it out, or if you return a constant, the algorithm matches Dijksra's algorithm, the one used before A*.

So even though your code can benefit from a good value because it helps find solutions faster, the algorithm will still (eventually) work just fine if you pass in a simple constant like 1.

#5243278 TOO SLOW; TOO ERRONEOUS - HELP with Building a Procedural Road System Using t...

Posted by frob on 28 July 2015 - 04:45 PM

Some questions about it being "slow".


First, if possible, please give link to the actual source code.



How many items do you have in each of your lists?

How many times are you going through your lists?


For your description, you've got "Loop through, and for each, and if it hasn't been created, take an action"  Beware of that kind of statement if you're looking for performance.


That looks like you've got a triple nested loop over the collections.  If you also have a large number of items in that loop, it will be very slow.  In computer science, a triple-nested loop like that would be called an O(n3) operation; the number of actions is the cube of the number of items. Consider if there were 10 items, that's a thousand actions.  If there were 100 items, that's a million actions.  If there were 1000 items, that's a billion actions.


Another concern is that making new objects is potentially a slow action, especially if your collection of items must grow many times.



These could be reviewed if you post a link to your actual code.

#5243277 Defining a struct in a header so that I can use my varaible anywhere

Posted by frob on 28 July 2015 - 04:36 PM

Ninja'd by your response.
the line in your header file:
int myMemberVariable = 357;
will not work in VS2010. That's what Josh Petrie wrote requires a 2011 or later compiler.