-
Notifications
You must be signed in to change notification settings - Fork 513
Expand file tree
/
Copy pathbehavioral-patterns.html
More file actions
66 lines (63 loc) · 3.34 KB
/
behavioral-patterns.html
File metadata and controls
66 lines (63 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>Behavioral Patterns · Game Programming Patterns</title>
<!-- Tell mobile browsers we're optimized for them and they don't need to crop
the viewport. -->
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" type="text/css" href="style.css" />
<link href="https://fonts.googleapis.com/css?family=Merriweather:400,400italic,700,700italic|Source+Code+Pro|Source+Sans+Pro:200,300,400,600,400italic,600italic|Rock+Salt" rel="stylesheet" type="text/css">
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-42804721-1', 'gameprogrammingpatterns.com');
ga('send', 'pageview');
</script>
<script src="jquery-3.6.0.min.js"></script>
<script src="script.js"></script>
</head>
<body id="top">
<div class="page sidebar">
<span class="theme-toggler" title="dark theme" onclick="toggleTheme()"></span>
<div class="content">
<nav class="top">
<span class="prev">← <a href="update-method.html">Previous Chapter</a></span>
<span class="next"><a href="bytecode.html">Next Chapter</a> →</span>
<span class="toc">≡ <a href="/">The Book</a></span>
</nav>
<h1>Behavioral Patterns</h1>
<h1 class="book"><a href="/">Game Programming Patterns</a></h1>
<p>Once you’ve built your game’s set and festooned it with actors and props, all
that remains is to start the scene. For this, you need behavior — the
screenplay that tells each entity in your game what to do.</p>
<p>Of course all code is “behavior”, and all software is defining behavior, but
what’s different about games is often the <em>breadth</em> of it that you have to
implement. While your word processor may have a long list of features, it pales
in comparison with the number of inhabitants, items, and quests in your average
role-playing game.</p>
<p>The patterns in this chapter help to quickly define and refine a large quantity of
maintainable behavior. <a href="type-object.html">Type Objects</a> create
categories of behavior without the rigidity of defining an actual class. A
<a href="subclass-sandbox.html">Subclass Sandbox</a> gives you a safe set of primitives
you can use to define a variety of behaviors. The most advanced option is
<a href="bytecode.html">Bytecode</a>, which moves behavior out of code entirely and into
data.</p>
<h2><a href="#the-patterns" name="the-patterns">The Patterns</a></h2>
<ul>
<li><a href="bytecode.html">Bytecode</a></li>
<li><a href="subclass-sandbox.html">Subclass Sandbox</a></li>
<li><a href="type-object.html">Type Object</a></li>
</ul>
<nav>
<span class="prev">← <a href="update-method.html">Previous Chapter</a></span>
<span class="next"><a href="bytecode.html">Next Chapter</a> →</span>
<span class="toc">≡ <a href="/">The Book</a></span>
</nav>
</div>
</div>
<footer>© 2009-2021 Robert Nystrom</footer>
</body>
</html>