Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 12 Mar 2005
Offline Last Active Yesterday, 09:55 PM

#5288141 How do I keep track of nearby objects?

Posted by frob on 22 April 2016 - 09:07 AM

Generally games rely on a spatial tree of some kind.


For terms you can research: spatial hash, BSP trees, quadtrees, loose quadtrees, octrees, loose octrees.  Each is progressively bigger in implementation but generally more powerful.  



* A spatial hash is typically a manual subdivision based on what you provide. You manually specify how many divisions are used.

* BSP trees are generally better for linear data or where you need arbitrary slices. These can be manual or automatic.

* Quadtrees and their variants usually operate along axis-aligned boxes in 2D, automatically subdividing as needed based on rules you provide. This works well in many games when you can use ground coordinates.

* Octrees and their variants are like Quadtrees, except in 3D. Usually overkill for games unless you're working on games with true six degrees of freedom.

#5288083 How to deal with this unexpected counter-offer?

Posted by frob on 21 April 2016 - 11:06 PM

Be careful in your soul-searching, and strongly consider rejecting it.


Once you give notice companies routinely make counter offers to get you to stay --- but only until they can find and train your replacement.  


I've looked up stats before and it's late so I'm not bothering to look up links, but numbers are easy enough to find and verify:  About 5% - 10% of those who accept counter offers are still employed at the job a year later. The other 90%-95% who accepted a counter offer either left anyway or had employment terminated.



Looking backwards, it is better to identify all the reasons you want to move on and discuss them with your boss BEFORE looking for another job.  


Looking forwards, when you start to feel the itch to move to another company do a soul-searching evaluation of every reason you want to leave the company, every annoyance, every bothersome aspect, everything you would change. Make a comprehensive list. Then discuss the list with your boss. 


You might be lucky and be the 5% - 10% who remains happily employed.  All the reasons you wanted to leave your job might be resolved, and the company might change their mind and not consider you a 'flight risk'.  But statistically, if you accept the counter offer the odds of it working out are not in your favor.





As for my own experiences, I've twice left jobs where counter offers were discussed, both times it was after discussing what I would like multiple times with my direct boss.


The first one I do not regret leaving, we talked it over and there was no way I could get what I wanted.  My boss knew exactly what I wanted but was not interested in giving it to me. When I turned in my notice, the head of the 50-person company invited me to his office and offered a counter-offer. I discussed what I wanted, he agreed they couldn't do it, and I moved on.


The second one I left strong security and boredom at a big company for less security and opportunity at a small company and I still feel mixed emotions about it, moving up the pyramid at a large established company is a glacially slow process but the benefits they offer are a huge non-salary valuable consideration that small companies cannot match. I needed three specific things to change because I felt myself stagnating, one of those was moving up in the corporate ladder. There were another five or so things I would have liked, but those three were essential. My boss and his boss apparently discussed it many times but issues of seniority meant they felt it would be unfair.  When I gave notice and the bosses of several teams heard about it, they contacted other bosses and said that they would open up a new position for me -- title only -- and hopefully give me the responsibilities when they arrived. I did not want to leave and I probably could have been moderately content there, but stagnation was everywhere and getting a title-only promotion did not end the stagnation. The job offered at the new company offered those three things, but in a more difficult startup environment.  I suspect if I stayed I would have been as a rock growing moss, and maybe if I was in my 50s I would have happily spent my days waiting for retirement, but ultimately I moved on.  


I sometimes wonder what would have happened if I accepted that second counter-offer, I suspect I would be less happy but more secure.

#5288062 KitKat 4.4 writing to external SD etc.

Posted by frob on 21 April 2016 - 06:09 PM

Ah, I think you are talking about this.

Yeah, there is that, but if your app is subject to that there isn't anything you can do. Don't worry about it.

#5288036 KitKat 4.4 writing to external SD etc.

Posted by frob on 21 April 2016 - 01:55 PM

Onne woman has problems with phone i saw that ahe has android 4.4 builtin file explor


That didn't answer the question, what have YOU tried?


Have you actually attempted to open a file after verifying you have WRITE_EXTERNAL_STORAGE permissions?   Did it not work? 


If you have the permission you should be able to open the files on external storage, read them, and write them. 

#5287893 Windows in Unity

Posted by frob on 20 April 2016 - 09:41 PM

My question is if anyone knows of a way to do this in Unity. As far as I can tell, even if I manage to draw a new window, it would draw for 'i' times, so what could I use in this case?

Yes, don't use that system.


The old UI system was somewhat confusing to use and difficult to use well. It was designed with a different mindset from what most people thought about in a UI. It assumed the people using the UI system had a background in using lightweight self-processed UI elements rather than the event-driven model so many people prefer. It had many potentially-confusing quirks such as updating at least every video frame rather than updating every simulator update (those are generally different rates), and updating multiple times based on events being triggered (such as many mouse movements detected during a single graphics frame).  Trying to explain to someone why their UI code was called a seemingly random number of times over a different duration was often done poorly. Couple that with people not writing code that worked well with the UI system's design, treating it like an update and event-driven system and less like a self-processed probe, and the end result was that very few people used their old UI system well and they decided to rewrite it.


The rewritten UI system (linked in the post above) is in my view less elegant and more bloated internally, but externally it is easier for people to use in their more familiar model.  It takes more internal processing work, but most developers don't seem to mind in favor of more friendly development.

#5287888 Negative ping? Or how do I sync time with client and server?

Posted by frob on 20 April 2016 - 09:10 PM

Clocks still drift, my clock can go at a slightly different speed than the server's clock for many reasons.


This is one reason the header mentioned by hplus above is such a good practice.  Every message that is received includes both a step-counter and an elapsed-time-counter. The drift between machines is constantly being corrected and accounted for in the simulation.

#5287876 Negative ping? Or how do I sync time with client and server?

Posted by frob on 20 April 2016 - 07:09 PM

In reference to the time aspect rather than the networking aspect...


Computers change their clocks ALL THE TIME.



Computer clock time does not necessarily match wall clock time.

Computer clocks can move faster than the wall clock time.

Computer clocks can move slower than the wall clock time.

Computer clocks can move backward in time.

Computer clocks can run backwards multiple times in a row.

A day may have more than 24 hours.

A day may have less than 24 hours.

You can experience the same time more than once.

You can skip over blocks of time.

An hour may not contain 60 minutes.

A minute may not contain 60 seconds.
A second may not contain 1000 milliseconds.
The clocks on any two computers are almost certainly set to different times.
And another fun one:
The clock may be adjusted from one time to any other time behind your back without notice, at any time.
To help combat some of these real life difficulties with time, most operating systems provide a way to get elapsed time from an arbitrary event, such as elapsed time from the start of your program or since the last restart. 
Be very careful when it comes to looking at real life clocks.  Elapsed time since an arbitrary timestamp is a more reliable timekeeping system, although it can also suffer from drift and other problems.

#5287817 How to randomize a string variable

Posted by frob on 20 April 2016 - 01:21 PM

C# has a built-in random number generator, many games end up with something a little more custom. 


In general you create a new random number generator somewhere in your code.


Random generator = new Random();


You use the generator wherever you need a source of random numbers. In this case you can use Next() which has several signatures.  Next(x) returns an integer between 0 and (x-1), so Next(100) would return a random value in the range 0-99.  Another, Next(x,y) returns an integer between x and y-1, so Next(50,100) returns a value in the range 50-99.


Since you're looking for an index in your list:



int randomIndex = generator.Next(mystrings.Count());

return mystrings[randomIndex];


#5287805 [2D Platformer] Horizontal Loop

Posted by frob on 20 April 2016 - 11:54 AM

Portal-based motion (which have been called that long before the game named Portal) frequently operate as individual triggers with a response.  For your example, one trigger is on the left side of the board, and the trigger's response is to place the character on the right side.  The other trigger is on the right side and the trigger's response is to place the character on the left side.


One could just as easily have the triggers place the character in a different location.  Maybe three triggers that all put the character in a central location, or maybe several triggers where each is pointing to the next, so a player could enter them each sequentially to jump around the board from place to place.


The triggers could also be leveraged for something else, tied to an event like starting a scene, moving to a new level, entering a store, spawning a monster, triggering a trap, or both locking the door and spawning a boss, to name a few.

#5287785 Best engine for card-based game?

Posted by frob on 20 April 2016 - 09:25 AM

There are several good CCG engines out there, what engines have you considered so far?


If you haven't considered any, a google search for "CCG engine" pulls up several.

#5287784 What's My Outlook for a Video Game Job Given My Situation?

Posted by frob on 20 April 2016 - 09:14 AM

A little background: I graduated college 3 years now, and I to be quite honest, that school wasted my time/money. While they taught the basics, that's all they taught. Topics such as multi threading/generics/design patterns were not given the time they deserve.


A degree program is not job training. It is not supposed to be. It should teach you how to learn and study.  You are supposed to study far beyond the assignments given, the school's role is to introduce you to all the topics, including those you would likely not study on your own.  Unless you are engaging in some type of research specialty, the school likely won't go deeper than that.


 If an employer were to ask "Why should I hire you, when I could hire a university student with a degree?" I've got no good answer for that, and I don't believe there is one.


It is YOU who need to make yourself valuable to the employer. No school or training will do that.  Even if a person has been valuable in the past they can suddenly decide they will no longer make themselves valuable.  Other people who have never been valuable to others in their lives suddenly decide to become productive, supportive individuals.


I've decided to make an honest effort, and build my own text adventure game in Java.


Excellent start. 


Right now, I'm trying to find a job so that gap on my resume doesn't get any bigger, and in my spare time develop my game.


Good idea.  


As you are likely around age 23-25 or so, a short work history is not suspicious.  


For job hunting advice generally, work your social network more than online sources.  Based on assorted research I'm not bothering to hunt up and link to, your social network is about 10x more productive than 'traditional' job hunting methods. (Although through most of history social connections were the traditional form, but whatever.)  Every hour talking to friends, family, and friends-of-friends, looking for a job using your skills is with about 10 hours of researching local companies and sending in a resume.


As you are unlikely to find a junior game programmer position this time of year -- all the schools are finishing off and recent grads are clamoring for the rare entry-level jobs -- now is a bad time to be picky about a specific industry.  Contact all the local companies that you know need programmers, and check in to all the local companies that you don't immediately think need programmers. Just about every white-collar company with 20+ people have a programmer on staff these days for their custom software tasks. 


It may not be in games, but getting a job in any industry as a programmer will improve your skills.  Hold a programming job for a year or so, work your hobby projects in the side, and the transition in to games should not be too difficult.  You'll need to likely move to wherever game studios are, but with a year or two of productive programming experience the lack of a degree becomes a little less relevant.

#5287716 Native WinAPI Sortable (Button) List Functionality

Posted by frob on 19 April 2016 - 09:47 PM

The magic you see there is a combination of many heavy technologies. HTML DOM objects floating freely, moving by script inside a JIT script runner inside a browser, the task of dragging and sliding requires a relatively powerful computer to make it look smooth.


The smooth UI of moving large boxes around like that is relatively recent with modern processing power. Back in the Win95 and Win98 days a company I was at was trying to build similar custom controls, and the animations would typically peg the CPU as small boxes were moving. We recommended at least a 600MHz Pentium 3 as a minimum spec for smooth display. 


There is nothing built in to Windows that looks similar.  The tech built in to the API is extremely lightweight, mostly about forwarding events and data packets that your program can respond to, the core of the Windows API stuff was built for processors from the 1980s and 1990s.




For implementation, options include creating your own owner-drawn component with movable boxes inside it, creating small boxes that respond to events and push themselves up and down, or otherwise doing much of it yourself.


Drag and drop could work, but it is normally less visible than you describe. For Windows drag and drop typically only the mouse cursor changes when you are dragging, and the application may do some extra paint calls to perhaps drop a marker where the drop will take place. Whatever drawing you do is also custom work. It would not look like what you see in jQueryUI.  If you are using any of the tools like WinForms to build your UI it may be a little easier since it is visually on screen as you edit, but still will require some work.


Another option is to embed some HTML viewer in your program.  A very heavyweight solution, but it can be done.


Another option is to buy a controls library, like those sold by DevExpress, which was the way things were often done before the modern web browsers and web apps.  Most of these controls cost several hundred dollars. It may be a lot for a hobby developer, but for a business that is cheaper than paying a worker for the weeks it would take to develop, refine, debug, and generalize the solutions.


Whatever you end up going with, good luck on it.

#5287709 Should you load assets/resources at runtime or compiletime?

Posted by frob on 19 April 2016 - 07:39 PM

I can swear I've worked on some project where they had a DLL filled with nothing but assets, but I don't remember what it was.

Go back about 20-25 years, quite a few windows games (such as they were) would do this quite often.


Starting with Windows 3.0's introduction of virtual memory meant far less hassle for developers.  No more futzing about with tools like VROOM or extended memory management swapping your application in and out.  


It meant your application could easily exceed 640KB without using overlays, and you could dump all you wanted into a giant DLL with one or two megabytes of data -- enormous at the time -- and not have to worry much about memory management.  Magic happened.


While it may not seem like much today, imagine how many thousand 8-bit color sprites you can fit into that. The magic of virtual memory simplified things for the programmers, and although some things were slower development was faster and cheaper, and therefore it was often leveraged for cost.


Memory management is necessary when your assets are all custom data loaded from files. But if all your assets can be put into OS-friendly objects that can be referenced, loaded, unloaded, and otherwise handled by the OS when you only use a resource ID, it is a hard argument to not to use it when it fits your game, and even when it doesn't exactly fit your game.

#5287468 Face Explosion Effects

Posted by frob on 18 April 2016 - 08:45 AM

If you go for Blender then the process is a bit hard. (I don't have experience with it myself) But I think you'll have to use the Explode Modifier.


I think that is the wisest course here.  Specifically build the model and animation for it.  


There are more options.  


You could write the code to explode the mesh, build a bunch of sub-meshes dynamically, throw physics at them.  This will be more effort but enable any new mesh to be exploded, if you are planning on doing this with many arbitrary meshes this could be useful and save time in the long run.


The AfterEffects is the movie version, render a movie instead of rendering polygons. If concerned about hardware limitations of an explosion this may work well.

#5287466 How did you learn making games?

Posted by frob on 18 April 2016 - 08:39 AM

They were popular in much of the US as well in the peak time frame, from 1990-1995, hitting a sudden drop-off with the invention and popularization of the World Wide Web.


For many of us (including me) the BBS was my preferred way to access Usenet groups, since paid access to a BBS that processed subjects I was interested in was far cheaper than access to the school's SLIP services as a non-student.