Jump to content

  • Log In with Google      Sign In   
  • Create Account

Norman Barrows

Member Since 04 Apr 2012
Offline Last Active Oct 23 2014 02:18 PM

#5179618 Where do I go beyond Graphics Programming?

Posted by Norman Barrows on 11 September 2014 - 09:33 AM

first, decide what game you want to make.


this will determine the tools, engines, libraries, skills, etc required to get the job done fastest.

#5179455 Native DirectX engine or Unity 3D

Posted by Norman Barrows on 10 September 2014 - 06:12 PM

The Car Simulator software is currently based on Directx9.0c. 
My requirement is to update the software and built it up from scratch.The reason for the up gradation is that features like Tyre skid mark, smoke, headlight glare have not been implemented by us in Directx 9.0c


so you have a car sim that uses dx9.0c, and you're thinking of porting it to dx11 or unity just to get decals, alpha blended particles, and lighting and fog? you do realize that 9.0c can do all that, right?  back in the day i did all that in a combat gravcar sim except decals with DX 8.0b fixed function, and it (dx8.0b) supported decals as i recall  (grav cars don't lay skid marks, they just kick up a lot of dust! <g>).


or do you need other things DX9.0c (with shaders) can't do?


weigh the development time cost of each alternative: porting to dx11, porting to unity, or implementing remaining features in dx9, and don't forget to add in the time to learn any new APIs and/or tools!


whatever takes the least time will get you to release sooner.

#5178549 Sorting/structuring renderables and cache locality

Posted by Norman Barrows on 06 September 2014 - 11:05 AM

Should I just not bother thinking about how the cache handles it?


basically, yes. 


smacks of premature optimization. 


for true cache friendly data, you'd need to create actual sorted lists for each pass (using data redundancy to eliminate skipping around while reading data), not just sorted indices to an unorderd list.


and you'd need to make sure they didn't reference other data elsewhere during processing to avoid cache misses - probably easier said than done with graphics calls.

#5178525 Teaching player the controls

Posted by Norman Barrows on 06 September 2014 - 09:02 AM

definitely needs work. i don't use touchscreens, but i understand the concept of click and drag, and i still don't quite understand how it works. you have a touchpad action area in the bottom left corner that is a virtual joystick emulator?

#5176674 [Space Empire] Colonization & Exploration

Posted by Norman Barrows on 28 August 2014 - 08:16 AM

sounds like you have 3 design criteria:


1.  model what a galactic emperor could do with respect to colonization.


2. model independent colonization by private parties.


3. eliminate micromanagement.


an emperor could allocate funds, direct which planets are to be colonized, and award contracts to private sector organizations. they could also send out the military fleet to explore along with come colony ships, colonizing anything they found in the process. they could also direct which sectors of space are to be explored next.


so they set the budget, choose colonization targets, award contracts, can opt to send out the fleet on exploration and colonization missions, and direct where to explore.


i like technogoth's idea of infrastructure points for tracking colony growth. i also like the budget ideas, except perhaps for extra funds going to colony ship construction. to reduce micromanagement, ship construction should probably be on a JIT basis. so the player would say "colonize  Tau-Ceti 7", and the game would automatically build the ship and fly it there and establish the colony (assuming funds were available).


for a "hands off" emperor sim, the player has a few basic commodities to work with: money, time, territory, population, resources, and units/buildings.


and the player can issue high level orders: explore here! colonize there! go to war with those guys!


and then the AI takes over.


i've actually been working on a hands off emperor sim myself, City States, with an ancient greek city state type setting.

#5176662 Making simple floating/drifting animation

Posted by Norman Barrows on 28 August 2014 - 07:42 AM

What about a time-based function which calculates a sinus-waveform?


Woah, sorry I'm lost. I'm not too hot on the maths stuff, is it possible you can explain it in simpler terms?


this is one common way to do it.   in fact, it might qualify as a "game design pattern" ! <g>.


a simple example:


lets say your jellyfish's position is given by x,y,z.


then you have a frame counter, or timer, that increments over time, giving you an elapsed time value et.


to make the jellyfish "float", you calculate the jellyfish's final position as:


x_final = x+sin(et)

y_final = y+sin(et)

z_final = z+sin(et)


to mix it up a bit, in some of the formulas you can use cos() instead of sin(), you can multiply et by a constant, and/or multiply sin(et) or cos(et) by a constant.


sin() and cos() will be 1/4 cycle out of phase with each other. multiplying ET by a constant will shift the phase of the wave. multiplying sin(et) or cos(et) by a constant will change the amplitude of the floating action (change how far it moves back and forth).


you'll probably want to multiply sin(et) or cos(et) by the same or similar values, so it floats about the same amount in all directions.


mixing it up a bit you might end up with something like:


x_final = x + c1 * sin(et * c2)

y_final = y + c1 * cos(et * c3)

z_final = z + c1 * sin(et * c4)


where c1 through c4 are constants whose values are determined by experimentation.




#5176503 Abstract away the API?

Posted by Norman Barrows on 27 August 2014 - 02:08 PM

if you want your high level code (your framework) to work with different low level libraries (dx 11 or 12), the typical approach is to define your own generic low level graphics API, and write an abstraction layer that translates generic calls to library specific calls. you want the generic API to be generic enough to work with all libraries of a given type if possible. IE its generic enough that you could add openGL support, etc. then you write your high level code to use the generic API, and the translation layer does the rest.


the wrapper routines in my game development library sort of do this. parts of the generic API date back to the late 80's and remain unchanged to this day, despite the fact that its been implemented in 4 versions of borland pascal, watcom C, MS C++ versions from 4.0 though v2012, directx 8,9, and 11, dos 5, dos 6, and windows XP, 2000 pro, vista, and win7.  while the underlying OS, language, compiler version, and graphics library may change, the game library's API stays pretty much the same. getmouse(&x,&y,&b) gets the mouse position and button state, whether its using dos interrupts (as it originally did), or windows messages (as it does now) is irrelevant to the game code calling it.   

#5176407 Strange Visual Studio Release Mode Behavior

Posted by Norman Barrows on 27 August 2014 - 07:21 AM

Get in the habit of compiling with the highest warning level and with all warnings treated as errors


i actually use second highest warning level, so i don't get 5 billion "yo dude! i'm in-lining this!" warnings. inline is the only warning i get at level 5, so i just kicked it back down to level 4. really i ought to suppress the inline warning and kick it back up to level 5.


i don't treat warnings as errors. that way you can have unused variables in a routine you're writing and still see if it compiles. but in general, the code is written so it generates no warnings (except inline warnings).


and finally, i develop in release mode only. if it works in release mode, it'll work in the final version, which is all that really matters. i've experienced and heard of too many cases like this where incorrect code works in debug but not release mode. so long ago i said to heck with debug mode all together.


for debugging, i use trace variables i can assign values to and then display.  for optimization, i use hi-rez timers and the trace variables to time sections of code and display the results.


no debug mode, no debugger, no profiler.  its not the usual way of doing things, but it avoids debug vs release mode bugs. its been years since i had a bug complex enough that it even tempted me to use a debugger. and i can hook up a timer to a section of code faster than the profiler can even load! but of all the things i do, clean simple straightforward code is the #1 weapon vs bugs. 

#5173637 Is it worth learning another language/tool for game dev if I already know Unity?

Posted by Norman Barrows on 14 August 2014 - 10:52 AM

as of now i've just been doing hobbyist projects, but I plan on trying to makes some actual money soon. I have a mobile game i'm working on, which I think is very promising, and i'm eventually going to try to sell it on FGL. So my question is, is it worth learning some other method to make games anytime soon, or should I just stick to Unity and improve my skills



begin with the end in mind.



the project determines the tools and skills required.


when the next project requires new skills or tools, its time to do some independent study.


right now, the mobile game sounds like your current project.


follow that project to its logical conclusion (IE publish or scrap).


then determine what your next project ought to be. if it calls for new tools or skills, learn them.


you might want to think ahead, and determine the next project while you finish the mobile game, and start learning any new skills or tools in your spare time. OTOH, such time might be better spent on completing the mobile game.


i keep a file with ideas for about 50 games, and usually have three in some stage of development, know what my next two or three releases will be, and what tools and skills i'll need to learn to complete them.  for me, it looks like high performance shader based DX12 skinned mesh animation graphics are the next thing i'll need to learn.  unless i can find an engine that can do 100 characters onscreen at once in a FPS/RPG type game (yes - i'm thinking about the pirates game!).


i try to work on my primary project (Caveman 3.0 at the moment). when i get burnt out on working on Caveman, but still have energy to work, i switch to one of the other games like SIMSpace or AIRSHIPS!, or i might do some research on some topic of potential use, such as component entity systems, multi-threading, etc.


and when i need a break from development, i do product evaluations of titles of interest. for example: Caveman is a paleoworld simulator that combines the open world FPS/RPG play found in Skyrim, with the actions and basic needs found in The SIMs, and is driven by random encounters as found in table top dungeons and dragons. so i spend time checking out skyrim and the sims. 


and when i've had enough of product evaluations, i play games. stuff like skyrim, the sims, simcity, silent hunter, and total war.  unfortunately, evaluating a game uses it up, so i can't really play for fun it if it doesn't have a lot of re-playabaility. for example, the world in skyrim is hard coded. so after playing one of every type of character to test all the questlines, i've used it up and can't just play it for fun.


and when i've pretty much used up all the games i have at the time, i watch stuff on hulu.com, with Faith, Iron Empress, Star Trek, UFO, and Green Acres as favorites. but even then Star Trek is more about "getting back into the swing of things" for working on SIMSpace.  SIMSpace (formerly SIMTrek) was my first hit. it was the first star trek starship flight simulator ever made (my 15 minutes of fame <g>).

#5173604 How to make a AI choose?

Posted by Norman Barrows on 14 August 2014 - 08:55 AM

this is psuedo code of the AI for a friendly NPC in Caveman. i've posted it as pseudo code for clarity, and omitted irrelevant stuff like "are they active?", "are they alive?", "are they an avian and use their own special AI?", etc:


at the very top level it loops through the units and calls the AI routines for each unit:


for a=0 to maxunits




setstate figures out whats going on, and what the unit should do, similar to the top level attack, heal, or retreat AI in the previous example.

runstate does the work of what needs doing.



if they're resting, continue resting.

else if they're fatigued, rest.


     select best weapon

     if taking fire

          select target

          if they have a target 

               if half dead, flee. else attack.

          else (no target) flock

     else if cornered, respond to being cornered.

     else if in collision recovery, continue collision recovery.

     select target

     if has target, attack.

     else graze (wander, flock, or stand, at random).


this results in one of the following states as output:

rest, flee, attack, cornered, collision recovery, wander, flock, or stand.






if in collision recovery, do collision recovery AI.

else if stand, do nothing (just recover some fatigue from not moving).

else if wander, steer unit in wander direction and run.

else if flee, steer away from target and run.

else if flock, steer unit towards leader and run.

else if cornered, do cornered AI.

else if attack: 

     if half dead, steer unit away from target, else steer unit towards target.

     move towards/away from target (speed based on range when moving towards target).

     attack when in range and target is in arc of fire.

else if rest, decrease fatigue.




collision recovery AI:

simple "bang and turn" behavior. the unit has collided with something. recovery consists of turning back to the left or right at random, and moving off for a short distance before resuming normal movement.


cornered AI:

the unit is cornered between hostile units and terrain obstacles. select closest target and attack. note that surrender might be another option you could add to your game if the unit is cornered. In Caveman, you can attack to subdue, causing the hostile to flee, but you can't capture prisoners. And hostiles never surrender, they always try to flee. 


setstate is the top layer

runstate is the second layer

things like select target, steer unit, move unit, and select weapon are the third layer

any subroutines called by select target, steer unit, move unit, select weapon, etc would be a fourth layer of AI.


the best search algo is used for select target and select weapon. its also used to automatically calculate best armor. 


the end result is a layered hierarchy of expert systems.


this is just one of over a dozen types of AI in Caveman, each with its own setstate routine.

runstate is used by all the different types of AI, and actually supports 17 different states, out of which seven are used by the NPC AI.

#5173587 How to make a AI choose?

Posted by Norman Barrows on 14 August 2014 - 07:34 AM

So It should be similar to a card battle game phases?


not too familiar with those, but i get the idea, similar to multi-phase combat turns in tabletop wargames.


phases or layers, whatever you want to call it, its a MULTI-STEP process.


you basically follow the line of logic you yourself would use in combat if you had the luxury of time to contemplate your move.


first, you'd see what condition you were in, whether you had to heal or not.

if you don't have to heal, you might then check for insurmountable odds, calling for a retreat.

if you don't have to heal or retreat, then attack.


the result of this first "layer" or "phase" of decision making results in one of three outputs:  heal, retreat, or attack.


you then call the appropriate specialty AI subroutine: heal, retreat, or attack. these would be your second layer or phase of AI.


lets say you called the attack subroutine as an example.


the attack subroutine would select a target and a weapon, steer and move the unit, and trigger the attack action at the appropriate moment.


the attack subroutine might in turn call a lower level AI subroutines:  one for select target, one for select weapon, one for steering, one for movement, and one for triggering the attack. these would be your third  layer of AI. some of these types of routines, such as select weapon, might use the best search algo.


the same idea would hold for the healing AI. it would have a lower level "select healing item" subroutine, the same way the attack AI has a "select weapon" subroutine.


so the top later would be the "what should i do?" AI: attack, heal, or retreat.


the second layer would be the attack, heal, and retreat subroutines.


the third layer would be the low level routines like select weapon, target, healing item, etc.


a more concrete example might help. i'll post something from Caveman.

#5173457 How to make a AI choose?

Posted by Norman Barrows on 13 August 2014 - 05:56 PM

This does seam a lot simpler and I guess for healing items mixed in I could check -1*dmg.


are you selecting items to use, or buy?


for use, you first want to check your state:

1. i need to retreat and heal, or

2. i'm still ok, press on with the attack.


in case 1, you select the best healing item.

in case 2 you select the best weapon.


but you want a layered approach:

1. decide what in general you need to do  ( attack vs heal).

2. decide the particulars of how to do it  ( use best search algo to select best wpn or best healing item).


so your AI might first decide on attack vs heal, then invoke one of two sub-AI's: one that specializes in attack, the other in healing.


divide and conquer.

#5173456 'Forfeiting' design decision for flexibility?

Posted by Norman Barrows on 13 August 2014 - 05:49 PM

the problem lies in is pre-defining attack and defense types. as you say, some unit created in the future may have a new predefined attack type, but existing units will have no pre-defined defense rating for that attack type.


abandon pre-defined types in favor of a more generic damage system - or perhaps introduce some default defense rating against as-yet-to-be-defined attack types (such as the dreaded bubble-icous attack <g>)


this is a common design trade off.   look at the sims 3,   all that stuff, all those objects in all those expansion packs, they all work off of just 6 pre-defined stats (food, sleep, etc).


i think maxis has even played around with what the stats are in the different versions of the game (sims 1 had 8 stats as i recall).  but each of those huge game systems (sims 1 though 4) are built around the pre-defined stats.

#5173449 How to make a AI choose?

Posted by Norman Barrows on 13 August 2014 - 05:22 PM

you want the AI to select the weapon with the best value, where value = dmg/cost.


small and med swords: value = 1.


lg sword: value=1 and 1/3.


select the long sword!


just like a search for closest target, where you loop through the targets calculating distance and storing the best distance and best target and then return the best target,

but you loop through the weapons, calculating the values, and storing best value and best weapon, and return best weapon as the result.




for a = 0 to maxwpns

    if wpnvalue of wpn a > bestvalue


        bestvalue=wpnvalue of wpn a

return bestwpn



this generic "best search" algo is a _TRUE_  game design pattern.


 its used in a billion places, in a billion ways, in a billion games (so to speak).

#5171176 How video game level architecture fundamentally differs from reality

Posted by Norman Barrows on 02 August 2014 - 03:11 PM

i don't see user created content as the solution to the content creation bottleneck.


whats required is a turn key integrated solution that encompasses integrated graphics (including animation), audio, physics, damage, and behavior modeling. such a system would include libraries of stock graphics, animations, and audio, and would support multiple physics, damage, and behavior models. content could be customized and shared. the system would also be customizable and extensible to add custom behaviors, etc.


then we could get away from building objects and get on with building worlds.  or at least spend less time on objects and more on worlds.