Jump to content

  • Log In with Google      Sign In   
  • Create Account


Norman Barrows

Member Since 04 Apr 2012
Offline Last Active Yesterday, 09:50 AM

#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(a)

     runstate(a)

 

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.

 

setstate:

if they're resting, continue resting.

else if they're fatigued, rest.

else

     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.

 

 

 

 

runstate:

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.




#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.

 

bestwpn=none

bestvalue=0

for a = 0 to maxwpns

    if wpnvalue of wpn a > bestvalue

        bestwpn=a

        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.




#5171173 How video game level architecture fundamentally differs from reality

Posted by Norman Barrows on 02 August 2014 - 02:46 PM


I want instead to take the chance and discuss these design decisions in the context of immersion. Eventually this might help us creating more immersive themes and levels for video games.

 

for me, level boundaries and level linearity give me a "rat in a maze feeling" which breaks immersion. almost all shooters seem to have this feel to them.

 

performance oriented level architecture is only an issue when the resulting level design seems "out of place" in the context of the game.   IE the level design limitations required for high performance have a noticeable effect on gameplay, look and feel, and/or believability.  A number of studios have successfully designed a game around a given performance oriented level design methodology - IE they start with the performance method and then figure out what type of game it can be used for with a high degree of believe-ability.   "out of place" levels most likely occur when the engine is attempting to render some environment other than that for which it is designed - or must render some less believe-able scene in lieu of what ought to be shown, due to engine performance related level design limitations.

 

"within walking distance".     oblivion and skyrim both suffer from this to some extent. very full worlds, but not very large. not too much of an immersion breaker. your "where's the windmill" example is a definite immersion breaker.   i've had to deal with this issue in Caveman 3.0 as well: is the frequency distribution of everything (resources, encounters, etc) correct?  in some cases i can extrapolate from real world data (location and frequency of caves and rockshelters). In other cases i must "guess-timate".

 

a related issue that's somewhat of an immersion breaker for me is "towns" with a population of about half a dozen NPCs, or "cities" with <100 population. IE unrealistically low numbers of npc's for the supposed size of a settlement. its is usually caused by limitations of the graphics engine (cant draw too many NPCs onscreen at once) or lack of content (it would take us too long to create the content for a skyrim city with 1000 NPC's, so we'll just do 50 or so).

 

this trend can also be seen in things like two dozen trees in close proximity representing a forest. by contrast, in Caveman 3.0, the minimum size forest is 5 miles across and contains 1,415,700 tree models.  needless to say, outdoor scenes in Caveman 3.0 are not level based.




#5171164 How video game level architecture fundamentally differs from reality

Posted by Norman Barrows on 02 August 2014 - 01:41 PM


At the moment the following design stereotypes come to mind:

 

 

 

some of these are the result of using a level based game design paradigm.  

 

level based is not the only way to build a game or simulation, it just happens to be the way ID software started building them, and a whole lot of people simply copied them.  it was adequate for their needs.

 

some of these are influenced by the use of level based design ( IE Non-homotopic level of detail ), but can occur in non-level based design.

 

some, such a level linearity, are simply common practices in level based design, but can occur in non-level based design.

 

lack of interactivity is really lack of simulation depth, or the difference between actual game objects, and "chrome".   at the one end, you have games with many graphics objects and detailed environments, but little interactivity. at the other end you have "if its there, you can use it".  no game can take this to its extreme conclusion in any type of complex environment - its tantamount to holodeck programming with no libraires to work with.  generalized physics and damage modeling would be the way to go. it would let you try to chop down anything with anything.




#5171126 How video game level architecture fundamentally differs from reality

Posted by Norman Barrows on 02 August 2014 - 10:37 AM


Indeed the more you know about game development, design and business the harder it is to relax and sink in to a game world while you are distracted by various things that peak your professional interest.

 

precisely

 

i can no longer simply sit down and watch a movie.  i spend all my time analyzing the special effects, camera angles, lighting etc.  i must watch it a second time to simply enjoy it.   of course, by then, i've already seen it once, and therefore don't enjoy it as much.    




#5171116 Camer Shake Effect when big scary monster comes charging

Posted by Norman Barrows on 02 August 2014 - 09:53 AM


so if the player is pinned against the wall and the camera shake happens - then there could be issues, right?

 

yes, that could lead to clipping issues and graphic artifacts (IE camera behind wall for a moment).  but it would seem to me that a wall would get backface culled when the camera popped behind it for a moment, so it would probably still look ok.

 

either type of jitter (position or rotation) ought to work ok, with only minor differences in camera behavior (how it shakes).

 

excessive and cumulative jitter is what caused your initial problems.

 


In some games I was able to go pass the physics collider of a wall or something with enough running and jumping at the wall

 

their stepped movement interval is too large, or they're not using stepped movement at all, or their collision detection range is out of sync with their movement step size.

 

when jittering, you only move the camera, not the player.  in fact, i often implement it not as a continuous realtime effect during gameplay, but as a quick canned animation, draw about half a second's worth of frames with jitter, then continue. works great for things like taking hits with your shields down.  an example of continuous would be the gravcar "float" in Combat Racer, a simple:  

 

 
current_y = base_y + sin(turn_counter)
 

 

before you draw each frame.  it makes the gravcars float up and down over time.




#5171107 Action points in turn based strategy games

Posted by Norman Barrows on 02 August 2014 - 09:16 AM

in general, action points in turn based games are a way of modeling time.  

 

actions take time.  

 

this time is measured in action points.  

 

there's only so much time in a game turn.  

 

so each unit can only do so much per game turn (move some distance, attack some number of times, load/unload, some combo thereof, etc).  

 

thus, each unit get assigned "action points" to model how much they can do in one turn.  

 

while pooling action points may result in interesting new gameplay, it also sort of undermines the original purpose of action point modeling - thus leading to a less realistic simulation.






PARTNERS