100% found this document useful (6 votes)
20 views

Learning C# programming with Unity 3D Alex Okita pdf download

The document is a promotional text for the book 'Learning C# Programming with Unity 3D' by Alex Okita, which is designed to teach programming through game development using Unity 3D. It includes links to various related resources and other books on C# and Unity. The book covers foundational programming concepts, Unity installation, and practical game development techniques.

Uploaded by

voortgmadonj1
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (6 votes)
20 views

Learning C# programming with Unity 3D Alex Okita pdf download

The document is a promotional text for the book 'Learning C# Programming with Unity 3D' by Alex Okita, which is designed to teach programming through game development using Unity 3D. It includes links to various related resources and other books on C# and Unity. The book covers foundational programming concepts, Unity installation, and practical game development techniques.

Uploaded by

voortgmadonj1
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 56

Learning C# programming with Unity 3D Alex Okita

download

https://textbookfull.com/product/learning-c-programming-with-
unity-3d-alex-okita/

Download more ebook from https://textbookfull.com


We believe these products will be a great fit for you. Click
the link to download now, or visit textbookfull.com
to discover even more!

C# Game Programming Cookbook for Unity 3D 2nd Edition


Jeff W. Murray

https://textbookfull.com/product/c-game-programming-cookbook-for-
unity-3d-2nd-edition-jeff-w-murray/

Learning C 7 By Developing Games with Unity 2017 Learn


C Programming by building fun and interactive games
with Unity Third Edition Micael Dagraca

https://textbookfull.com/product/learning-c-7-by-developing-
games-with-unity-2017-learn-c-programming-by-building-fun-and-
interactive-games-with-unity-third-edition-micael-dagraca/

Learning C by developing games with Unity 2020 An


enjoyable and intuitive approach to getting started
with C programming and Unity Fifth Edition Harrison
Ferrone
https://textbookfull.com/product/learning-c-by-developing-games-
with-unity-2020-an-enjoyable-and-intuitive-approach-to-getting-
started-with-c-programming-and-unity-fifth-edition-harrison-
ferrone/

Beginning Game AI with Unity: Programming Artificial


Intelligence with C# Sebastiano M. Cossu

https://textbookfull.com/product/beginning-game-ai-with-unity-
programming-artificial-intelligence-with-c-sebastiano-m-cossu/
Developing 2D Games with Unity: Independent Game
Programming with C# 1st Edition Jared Halpern

https://textbookfull.com/product/developing-2d-games-with-unity-
independent-game-programming-with-c-1st-edition-jared-halpern/

Developing 2D Games with Unity: Independent Game


Programming with C# 1st Edition Jared Halpern

https://textbookfull.com/product/developing-2d-games-with-unity-
independent-game-programming-with-c-1st-edition-jared-halpern-2/

Game Programming in C Creating 3D Games Creating 3D


Games Sanjay Madhav

https://textbookfull.com/product/game-programming-in-c-
creating-3d-games-creating-3d-games-sanjay-madhav/

Getting Started with Unity 2018 A Beginner s Guide to


2D and 3D Game Development with Unity 3rd Edition
Edward Lavieri

https://textbookfull.com/product/getting-started-with-
unity-2018-a-beginner-s-guide-to-2d-and-3d-game-development-with-
unity-3rd-edition-edward-lavieri/

Deep Reinforcement Learning in Unity: With Unity ML


Toolkit 1st Edition Abhilash Majumder

https://textbookfull.com/product/deep-reinforcement-learning-in-
unity-with-unity-ml-toolkit-1st-edition-abhilash-majumder/
Learning C# Programming
with Unity 3D
Learning C# Programming
with Unity 3D
Second Edition

Alex Okita
CRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742

© 2020 by Taylor & Francis Group, LLC


CRC Press is an imprint of Taylor & Francis Group, an Informa business

No claim to original U.S. Government works

Printed on acid-free paper

International Standard Book Number-13: 978-1-138-33681-0 (paperback)


978-1-138-33682-7 (hardback)

This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been made
to publish reliable data and information, but the author and publisher cannot assume responsibility for the validity of all
materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all
material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been
obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any future
reprint.

Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized
in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying,
microfilming, and recording, or in any information storage or retrieval system, without written permission from the
publishers.

For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://www.
copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400.
CCC is a not-for-profit organization that provides licenses and registration for a variety of users. For organizations that have been
granted a photocopy license by the CCC, a separate system of payment has been arranged.

Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for
identification and explanation without intent to infringe.

Library of Congress Cataloging‑in‑Publication Data

Names: Okita, Alex, author.


Title: Learning C# programming with Unity 3D / Alex Okita.
Description: Second edition. | Boca Raton, FL : CRC Press/Taylor & Francis
Group, 2019.
Identifiers: LCCN 2019010020 | ISBN 9781138336810 (pbk. : acid-free paper) |
ISBN 9781138336827 (hardback : acid-free paper)
Subjects: LCSH: Computer games--Programming. | C# (Computer program language)
| Unity (Electronic resource) | Three-dimensional display systems.
Classification: LCC QA76.76.C672 O43 2019 | DDC 794.8/1526--dc23
LC record available at https://lccn.loc.gov/2019010020

Visit the Taylor & Francis Web site at


http://www.taylorandfrancis.com

and the CRC Press Web site at


http://www.crcpress.com
Contents

1. Introduction: What This Book Is About ........................................................................................ 1


1.1 Why Read a Book: Why This Book May or May Not Be for You ......................................... 1
1.1.1 Do I Need to Know Math? ........................................................................................ 2
1.1.2 Programming as a Form of Expression .................................................................... 2
1.1.3 Games as a Stage with Lights ................................................................................... 2
1.2 Personal Information .............................................................................................................. 2
1.3 A Brief History of Computer Programming: How Programming Came to Be ..................... 3
1.3.1 Mechanical Computers ............................................................................................. 3
1.3.2 Logic ......................................................................................................................... 3
1.3.3 Computer Science ..................................................................................................... 3
1.3.4 The Origin of Software ............................................................................................. 4
1.3.5 Modern Computer Language .................................................................................... 4
1.3.6 The Future of Computer Languages ......................................................................... 4
1.4 C#: A Flexible Programming Language ................................................................................ 4
1.4.1 C# Paradigm ............................................................................................................. 5
1.4.2 Unity 3D: A Brief History of Game Engines ........................................................... 5
1.4.3 Why Use Unity 3D to Learn? ................................................................................... 6
1.4.4 How Does Unity 3D Use C#? ................................................................................... 6
1.4.4.1 How to Tell Unity 3D What to Do............................................................ 7
1.5 What Is Programming? ........................................................................................................... 7
1.5.1 What Does C# Look Like? ....................................................................................... 8
1.5.2 Learning to Copy and Paste ...................................................................................... 9
1.5.3 Iteration ..................................................................................................................... 9
1.6 Compiling: Turning Words into Computer Instruction .......................................................... 9
1.7 What We’ve Learned ............................................................................................................ 10
1.8 Leveling Up: The Path Ahead .............................................................................................. 10

2. Before You Begin .............................................................................................................................11


2.1 What Will Be Covered in This Chapter ................................................................................11
2.2 Unity 3D Installation ............................................................................................................ 13
2.2.1 Visual Studio Installation ....................................................................................... 15
2.2.2 Unity Version Numbering ........................................................................................16
2.3 Git SCM Installation ..............................................................................................................17
2.3.1 Git-SCM.com Git Software (Optional) ....................................................................17
2.3.2 GitHub.com Sign Up! (Also Optional) ....................................................................18
2.3.3 Git: The Basics ........................................................................................................ 20
2.3.4 Your First Repo ....................................................................................................... 22
2.3.5 Before Moving On .................................................................................................. 25
2.4 Unity General Overview ....................................................................................................... 26
2.4.1 The Main Window .................................................................................................. 27
2.4.1.1 Toolbar .................................................................................................... 27
2.4.1.2 Scene, Game View, and Asset Store....................................................... 28
2.4.1.3 Hierarchy Panel ...................................................................................... 28

v
vi Contents

2.4.1.4 Inspector Panel ....................................................................................... 29


2.4.1.5 Project and Console Panel ...................................................................... 29
2.4.1.6 Assets Directory ......................................................................................31
2.4.1.7 Project Settings Directory ...................................................................... 32
2.4.1.8 Packages Directory ................................................................................. 32
2.4.2 Git Ignore ................................................................................................................ 32
2.4.3 What We’ve Learned .............................................................................................. 32
2.5 Sample Code ......................................................................................................................... 33
2.5.1 Code Fragments ...................................................................................................... 33
2.5.2 Are Errors Bad? ...................................................................................................... 34
2.5.2.1 Compile-Time and Run-Time Errors...................................................... 34
2.5.3 How to Follow Along .............................................................................................. 35
2.5.4 Comments: A First Look ........................................................................................ 36
2.5.5 What We’ve Learned .............................................................................................. 37
2.6 Working with C#: Game Engines ......................................................................................... 37
2.6.1 Creating and Assigning a New C# File: Now It’s Your Turn ................................. 40
2.6.2 Naming Your New File ........................................................................................... 42
2.6.3 Using Your New File............................................................................................... 43
2.6.4 Additional Unity 3D Tools ...................................................................................... 48
2.6.5 Working in a Live Scene ......................................................................................... 50
2.6.6 Saving a Scene ........................................................................................................ 50
2.6.7 Opening a Scene ..................................................................................................... 50
2.6.8 What We’ve Learned ...............................................................................................51
2.7 Leveling Up: The Journey Has Just Begun............................................................................51

3. First Steps: Just Getting Started .................................................................................................. 53


3.1 What Will Be Covered in This Chapter ............................................................................... 53
3.2 Review................................................................................................................................... 54
3.2.1 Submitting Changes to Git ...................................................................................... 54
3.3 Let’s Build a Game—Part 1 ................................................................................................. 56
3.3.1 Movement Experiments .......................................................................................... 57
3.3.2 Reading Programmer Documentation .................................................................... 58
3.4 Tokens ....................................................................................................................................61
3.4.1 Writing C#............................................................................................................... 62
3.4.2 Comments a First Look........................................................................................... 63
3.4.3 Separator Tokens ..................................................................................................... 64
3.4.4 Operator Tokens ...................................................................................................... 65
3.4.5 Literals .................................................................................................................... 66
3.4.6 Transitive and Non-Transitive Operations .............................................................. 67
3.4.7 Putting It All Together ............................................................................................ 67
3.4.8 What We’ve Learned .............................................................................................. 69
3.5 Statements and Expressions .................................................................................................. 69
3.5.1 Expressions ............................................................................................................. 70
3.5.2 How Unity 3D Executes Your Code ....................................................................... 70
3.5.3 Thinking in Algorithms .......................................................................................... 70
3.5.3.1 Wash, Rinse, Repeat ............................................................................... 73
3.5.4 What We’ve Learned .............................................................................................. 73
3.6 Keywords .............................................................................................................................. 73
3.6.1 The Class Keyword ................................................................................................. 74
3.6.2 What We’ve Learned .............................................................................................. 76
3.7 White Space .......................................................................................................................... 76
3.7.1 Code Style ............................................................................................................... 78
3.7.2 What We’ve Learned .............................................................................................. 79
Contents vii

3.8 Code Blocks ........................................................................................................................ 79


3.8.1 What We’ve Learned .......................................................................................... 81
3.9 Classes: A First Look.......................................................................................................... 81
3.9.1 Objects ................................................................................................................ 82
3.9.2 What We’ve Learned .......................................................................................... 86
3.10 Variables ............................................................................................................................. 86
3.10.1 Identifiers ............................................................................................................ 87
3.10.2 Data ..................................................................................................................... 88
3.10.3 Variable Manipulation ........................................................................................ 89
3.10.3.1 Declaration Placement Examples ..................................................... 90
3.10.4 Dynamic Initialization ........................................................................................ 90
3.10.5 What We’ve Learned .......................................................................................... 91
3.11 Variable Names ................................................................................................................... 91
3.11.1 Useful Variables in Unity 3D .............................................................................. 94
3.11.2 Variable Assignment ........................................................................................... 96
3.11.3 Putting It Together: Using the Variables............................................................. 98
3.11.4 What We’ve Learned ........................................................................................ 100
3.12 Types: A First Look .......................................................................................................... 100
3.12.1 Value and Reference Types ............................................................................... 100
3.12.2 What We’ve Learned .........................................................................................101
3.13 Strong Typing.................................................................................................................... 102
3.13.1 Dynamic Typing ............................................................................................... 102
3.13.2 What We’ve Learned ........................................................................................ 103
3.14 Type Casting, Numbers .................................................................................................... 103
3.14.1 Explicit versus Implicit Casting ........................................................................ 104
3.14.1.1 A Basic Example ............................................................................. 105
3.14.2 What We’ve Learned ........................................................................................ 107
3.15 Comments ......................................................................................................................... 108
3.15.1 Line Numbers.....................................................................................................111
3.15.2 Code Folding ......................................................................................................111
3.15.3 Summary Comments .........................................................................................113
3.15.4 Navigating in Code ............................................................................................114
3.15.5 What We’ve Learned .........................................................................................115
3.16 Leveling Up: Moving on to Basics ....................................................................................115
3.16.1 Git Revision History ..........................................................................................115

4. Basics: The Building Blocks of Code ...........................................................................................117


4.1 What Will Be Covered in This Chapter ............................................................................117
4.2 Review ...............................................................................................................................117
4.3 Building a Game—Part 1 ..................................................................................................118
4.3.1 Mouse Point .......................................................................................................119
4.3.2 Move to Point .................................................................................................... 120
4.3.3 What We’ve Learned .........................................................................................121
4.4 Class Construction .............................................................................................................121
4.4.1 Class Declaration .............................................................................................. 123
4.4.1.1 A Basic Example ............................................................................. 123
4.4.1.2 Value and Reference Types ............................................................. 124
4.4.2 Adding Data Fields ........................................................................................... 125
4.4.3 Access Modifiers and the Dot Operator ........................................................... 125
4.4.4 Class Scope ....................................................................................................... 127
4.4.5 Class Members .................................................................................................. 128
4.4.6 What We’ve Learned ........................................................................................ 128
viii Contents

4.5 Directives .......................................................................................................................... 129


4.5.1 Libraries.......................................................................................................... 130
4.5.2 Ambiguous NameSpaces .................................................................................133
4.5.3 What We’ve Learned ...................................................................................... 134
4.6 Functions........................................................................................................................... 134
4.6.1 What Are Functions? .......................................................................................135
4.6.2 Unity 3D Entry Points .................................................................................... 136
4.6.3 Writing a Function .......................................................................................... 137
4.6.4 More on White Space and Tabs ...................................................................... 139
4.6.5 What We’ve Learned ...................................................................................... 140
4.7 Order of Operation: What Is Calculated and When ......................................................... 140
4.7.1 Evaluating Numbers ........................................................................................141
4.7.1.1 Math ...............................................................................................141
4.7.1.2 Operator Evaluation...................................................................... 144
4.7.2 What We’ve Learned .......................................................................................145
4.8 Scope: A First Look .......................................................................................................... 146
4.8.1 Class Scope ..................................................................................................... 146
4.8.2 Function Scope ................................................................................................149
4.8.3 Blank Scope .....................................................................................................151
4.8.4 What We’ve Learned .......................................................................................152
4.9 This ....................................................................................................................................152
4.9.1 A Basic Example .............................................................................................152
4.9.2 When This Is Necessary..................................................................................153
4.9.3 What We’ve Learned ...................................................................................... 154
4.10 Building a Game—Part 2 ..................................................................................................155
4.10.1 Additional Components ...................................................................................155
4.10.2 The Projectile ................................................................................................. 158
4.10.3 The Target ....................................................................................................... 160
4.10.4 What We’ve Learned .......................................................................................161
4.11 Logic and Operators ..........................................................................................................162
4.11.1 Booleans ..........................................................................................................162
4.11.2 Equality Operators ..........................................................................................163
4.11.3 Logical Not! .....................................................................................................165
4.11.4 Greater and Less than Operators .................................................................... 166
4.11.5 Logical And and Or Operators ........................................................................168
4.11.6 If and Branching ..............................................................................................169
4.11.7 What We’ve Learned .......................................................................................173
4.12 Loops .................................................................................................................................173
4.12.1 Unary Operators ..............................................................................................173
4.12.2 While ...............................................................................................................174
4.12.3 For ....................................................................................................................175
4.12.4 Do-While .........................................................................................................177
4.12.5 Postfix and Prefix Notation..............................................................................178
4.12.6 Using Loops .....................................................................................................179
4.12.7 Loops within Loops.........................................................................................182
4.12.8 Runaway Loops ...............................................................................................183
4.12.9 Breakpoints: A First Look ...............................................................................185
4.12.10 What We’ve Learned .......................................................................................186
4.13 ScopeAgain ........................................................................................................................187
4.13.1 Visibility or Accessibility ................................................................................187
4.13.1.1 A Basic Example ...........................................................................187
4.13.2 Global Scope....................................................................................................188
4.13.3 What We’ve Learned ...................................................................................... 190
Contents ix

4.14 Warnings versus Errors .................................................................................................... 190


4.14.1 Warnings ........................................................................................................... 190
4.14.2 Errors .................................................................................................................191
4.14.3 Understanding the Debugger ............................................................................ 192
4.14.4 What We’ve Learned ........................................................................................ 194
4.15 Leveling Up: Fundamentals .............................................................................................. 194
4.15.1 Style Guides ...................................................................................................... 194

5. Fundamentals: Building a Foundation ...................................................................................... 195


5.1 What Will Be Covered in This Chapter ........................................................................... 195
5.2 Review .............................................................................................................................. 196
5.2.1 Modular Code ................................................................................................... 199
5.3 Inheritance: A First Look ................................................................................................. 202
5.3.1 Class Members .................................................................................................. 204
5.3.1.1 Inheriting Members .......................................................................... 205
5.3.1.2 Is-A and Has-A ................................................................................. 206
5.3.2 Instancing .......................................................................................................... 206
5.3.3 Parent Child ...................................................................................................... 208
5.3.4 Object ................................................................................................................ 209
5.3.4.1 A Type Is Not an Object ....................................................................212
5.3.5 != null ................................................................................................................213
5.3.6 What We’ve Learned .........................................................................................214
5.4 Instancing...........................................................................................................................214
5.4.1 Class Initialization .............................................................................................215
5.4.2 New ....................................................................................................................215
5.4.3 Constructors .......................................................................................................216
5.4.4 What We’ve Learned .........................................................................................219
5.5 Static ................................................................................................................................. 220
5.5.1 A Basic Example ............................................................................................... 220
5.5.2 Static Variables ................................................................................................. 222
5.5.2.1 A Basic Example............................................................................... 222
5.5.3 Static Functions ................................................................................................. 224
5.5.4 Putting It All Together ...................................................................................... 225
5.5.5 What We’ve Learned ........................................................................................ 228
5.6 Building A Game—Part 3 ................................................................................................ 228
5.6.1 The Player ......................................................................................................... 228
5.6.2 The Mover ......................................................................................................... 229
5.6.3 The Shooter ....................................................................................................... 230
5.6.4 Physics Settings................................................................................................. 232
5.6.5 What We’ve Learned ........................................................................................ 233
5.7 Jump Statements and Return ............................................................................................ 233
5.7.1 Return................................................................................................................ 234
5.7.1.1 A Basic Example............................................................................... 235
5.7.2 Returning Objects ............................................................................................. 235
5.7.3 A Class Is a Type .............................................................................................. 236
5.7.4 Tuples ................................................................................................................ 238
5.7.5 Null Is Not Void ................................................................................................ 240
5.7.6 What We’ve Learned ........................................................................................ 240
5.8 Arrays: A First Look......................................................................................................... 241
5.8.1 Fixed-Sized Arrays ........................................................................................... 241
5.8.1.1 A Basic Example............................................................................... 241
5.8.2 Foreach .............................................................................................................. 246
5.8.2.1 A Basic Example............................................................................... 246
x Contents

5.8.3 Dynamic Initialization ...................................................................................... 246


5.8.4 Using the While Loop with Arrays................................................................... 247
5.8.4.1 Setting Array Values ....................................................................... 247
5.8.4.2 Getting Array Values ...................................................................... 248
5.8.5 What We’ve Learned ........................................................................................ 248
5.9 Jump Statements: Break and Continue ............................................................................. 248
5.9.1 A Basic Example ............................................................................................... 249
5.9.1.1 Continue .......................................................................................... 249
5.9.2 ZombieData ....................................................................................................... 249
5.9.3 Foreach Again ....................................................................................................251
5.9.4 What We’ve Learned ........................................................................................ 252
5.10 Multidimensional Arrays .................................................................................................. 252
5.10.1 Columns and Rows ........................................................................................... 253
5.10.1.1 A Basic Example ............................................................................. 254
5.10.2 A Puzzle Board ................................................................................................. 255
5.10.3 Camera and Screen Setup ................................................................................. 257
5.10.4 Checking Range ................................................................................................ 259
5.10.5 What We’ve Learned .........................................................................................261
5.11 Array List .......................................................................................................................... 262
5.11.1 A Basic Example ............................................................................................... 263
5.11.2 ArrayList.Contains() ............................................................................. 265
5.11.3 Remove.............................................................................................................. 266
5.11.4 Sort and Reverse ............................................................................................... 267
5.11.5 What We’ve Learned ........................................................................................ 268
5.12 Strings ............................................................................................................................... 268
5.12.1 Declaring a String ............................................................................................. 268
5.12.1.1 A Basic Example ............................................................................. 269
5.12.2 Escape Sequences ............................................................................................. 270
5.12.3 Verbatim Strings: @.......................................................................................... 271
5.12.4 What We’ve Learned ........................................................................................ 272
5.13 Combining What We’ve Learned ..................................................................................... 272
5.13.1 Timers ............................................................................................................... 273
5.13.2 What We’ve Learned ........................................................................................ 278
5.14 Leveling Up: On to the Cool Stuff.................................................................................... 278

6. Intermediate: The Tricks of the Trade ...................................................................................... 281


6.1 What Will Be Covered in This Chapter ........................................................................... 281
6.2 Review .............................................................................................................................. 281
6.2.1 Class Members .................................................................................................. 282
6.2.1.1 A Basic Example ............................................................................. 282
6.2.1.2 Thinking Like a Programmer ......................................................... 283
6.2.2 Return................................................................................................................ 286
6.2.2.1 A Basic Example ............................................................................. 286
6.2.3 Arguments aka “Args” (Not Related to Pirates) ............................................... 287
6.2.3.1 The Basic Example ......................................................................... 287
6.2.3.2 Multiple Args .................................................................................. 288
6.2.3.3 Using Args ...................................................................................... 290
6.2.4 Assignment Operators....................................................................................... 292
6.2.4.1 A Basic Example ............................................................................. 292
6.2.5 What We’ve Learned ........................................................................................ 294
Contents xi

6.3 Building a Game—Part 4 ................................................................................................. 294


6.3.1 ChaseCamera .................................................................................................... 294
6.3.2 Tile Floor Generator ......................................................................................... 295
6.3.3 What We’ve Learned ........................................................................................ 297
6.4 Class Constructors ............................................................................................................ 298
6.4.1 A Basic Example ............................................................................................... 299
6.4.2 What We’ve Learned ........................................................................................ 301
6.5 Arrays Revisited ............................................................................................................... 302
6.5.1 Using Arrays in Unity 3D ................................................................................. 302
6.5.1.1 Starting with 0 .................................................................................. 304
6.5.1.2 Mathf................................................................................................. 306
6.5.1.3 Time .................................................................................................. 307
6.5.2 Instancing with AddComponent(); .............................................................. 307
6.5.3 Type Casting Unity 3D Objects ........................................................................ 309
6.5.4 What We’ve Learned .........................................................................................311
6.6 Enums ................................................................................................................................311
6.6.1 Using Enums ......................................................................................................312
6.6.2 Combining What We’ve Learned ......................................................................315
6.6.3 What We’ve Learned .........................................................................................317
6.7 Switch ................................................................................................................................317
6.7.1 A Basic Example ................................................................................................318
6.7.2 Default ................................................................................................................319
6.7.3 More On Cases .................................................................................................. 322
6.7.4 Fall Through ..................................................................................................... 326
6.7.5 goto Case ........................................................................................................... 327
6.7.6 Finite State Machine ......................................................................................... 328
6.7.7 What We’ve Learned ........................................................................................ 330
6.8 Structs ............................................................................................................................... 330
6.8.1 Building a Struct ................................................................................................331
6.8.2 Struct versus Class .............................................................................................332
6.8.3 Without Structs ................................................................................................. 334
6.8.4 Handling Structs ................................................................................................335
6.8.5 Accessing Structs .............................................................................................. 336
6.8.6 Global Access ................................................................................................... 337
6.8.7 What We’ve Learned ........................................................................................ 337
6.9 Class Data ......................................................................................................................... 338
6.9.1 Character Base Class ........................................................................................ 339
6.9.2 Const ................................................................................................................. 340
6.9.3 Readonly ............................................................................................................341
6.9.4 What We’ve Learned ........................................................................................ 342
6.10 Namespaces ...................................................................................................................... 342
6.10.1 A Basic Example ............................................................................................... 342
6.10.2 Directives in Namespaces ................................................................................. 344
6.10.3 Ambiguous References ..................................................................................... 345
6.10.4 Alias Directives................................................................................................. 345
6.10.5 What We’ve Learned ........................................................................................ 346
6.11 Functions Again ................................................................................................................ 346
6.11.1 Parameter Lists ................................................................................................. 346
6.11.2 Side Effects ....................................................................................................... 347
6.11.3 Multiple Arguments .......................................................................................... 348
xii Contents

6.11.4 Useful Parameters ............................................................................................. 348


6.11.4.1 The Rule of Three ........................................................................... 349
6.11.5 Foreach versus For ............................................................................................ 350
6.11.6 What We’ve Learned .........................................................................................351
6.12 Unity 3D Execution Order .................................................................................................351
6.12.1 A Basic Example ................................................................................................353
6.12.2 Component Execution Order ............................................................................ 356
6.12.3 What We’ve Learned ........................................................................................ 358
6.13 Inheritance Again ............................................................................................................. 358
6.13.1 Function Overrides ........................................................................................... 359
6.13.1.1 A Basic Example ............................................................................. 359
6.13.2 Class Inheritance............................................................................................... 362
6.13.2.1 Sharing Common Attributes ........................................................... 362
6.13.3 Object ................................................................................................................ 364
6.13.4 What We’ve Learned ........................................................................................ 367
6.14 Type Casting Again .......................................................................................................... 368
6.14.1 (<Type>) versus “as” ......................................................................................... 368
6.14.2 User-Defined Type Conversion ......................................................................... 370
6.14.3 Implicit versus Explicit Type Conversion ......................................................... 372
6.14.4 What We’ve Learned ........................................................................................ 373
6.15 Working with Vectors ........................................................................................................374
6.15.1 Vectors Are Objects ...........................................................................................374
6.15.2 Stepping through MonsterGenerator .................................................................375
6.15.3 Gizmos .............................................................................................................. 377
6.15.3.1 A Basic Example ............................................................................. 377
6.15.3.2 DrawRay.......................................................................................... 379
6.15.4 Using Gizmos.................................................................................................... 380
6.15.5 What We’ve Learned .........................................................................................381
6.16 goto Labels .........................................................................................................................381
6.16.1 Skipping Down ................................................................................................. 383
6.16.2 Zombie State Machine ...................................................................................... 383
6.16.3 This as a Reference to Yourself ........................................................................ 386
6.16.4 Just for Zombies ................................................................................................ 386
6.16.5 What We’ve Learned ........................................................................................ 388
6.17 More on Arrays ................................................................................................................. 389
6.17.1 Length and Count.............................................................................................. 389
6.17.1.1 A Basic Example ............................................................................. 389
6.17.2 Foreach: A Reminder ........................................................................................ 390
6.17.3 Discovery .......................................................................................................... 393
6.17.4 Putting It Together ............................................................................................ 394
6.17.4.1 Breakpoint, Observing Inheritance ................................................ 395
6.17.5 What We’ve Learned ........................................................................................ 399
6.18 Out Parameter ................................................................................................................... 399
6.18.1 A Basic Example ............................................................................................... 401
6.18.2 Simple Sort (Bubble Sort) ................................................................................. 403
6.18.3 Simple Sort Proof .............................................................................................. 405
6.18.4 What We’ve Learned ........................................................................................ 406
6.19 Ref Parameter ................................................................................................................... 407
6.19.1 A Basic Example ............................................................................................... 407
6.19.2 Code Portability Side Effects............................................................................ 408
6.19.3 What We’ve Learned .........................................................................................410
Contents xiii

6.20 Type Casting Numbers ......................................................................................................411


6.20.1 Number Types ....................................................................................................413
6.20.2 Integers ...............................................................................................................413
6.20.2.1 Signed Numbers ...............................................................................414
6.20.3 Floating Point .....................................................................................................414
6.20.4 What We’ve Learned .........................................................................................415
6.21 Types and Operators ..........................................................................................................415
6.21.1 GetType() .......................................................................................................416
6.21.2 More Type Casting .............................................................................................417
6.21.3 Type Aliasing .................................................................................................... 420
6.21.4 Boxing and Unboxing ....................................................................................... 420
6.22 Operator Overloading ....................................................................................................... 422
6.22.1 A Basic Example ............................................................................................... 423
6.22.2 Overloading* ..................................................................................................... 424
6.22.3 Overloading < and > ......................................................................................... 426
6.22.4 What We’ve Learned ........................................................................................ 427
6.23 Controlling Inheritance .................................................................................................... 427
6.23.1 Sealed ................................................................................................................ 428
6.23.1.1 A Basic Example ............................................................................. 428
6.23.2 Extension Functions .......................................................................................... 429
6.23.3 Abstract ............................................................................................................. 430
6.23.3.1 A Basic Example ............................................................................. 430
6.23.4 Abstract: Abstract ..............................................................................................432
6.23.5 Putting This to Use ........................................................................................... 434
6.23.6 What We’ve Learned .........................................................................................435
6.24 Building A Game—Part 5 ................................................................................................ 436
6.24.1 Generating Rooms ............................................................................................ 436
6.24.2 What We’ve Learned ........................................................................................ 439
6.25 Leveling Up ...................................................................................................................... 440

7. Advanced ....................................................................................................................................... 441


7.1 What Will Be Covered in This Chapter ........................................................................... 441
7.2 Review .............................................................................................................................. 442
7.2.1 Moving Forward ............................................................................................... 442
7.3 Visual Studio .................................................................................................................... 442
7.3.1 The Debugger.................................................................................................... 443
7.3.2 Mono History .................................................................................................... 443
7.4 Function Overloading ....................................................................................................... 444
7.4.1 A Closer Look at Functions .............................................................................. 444
7.4.1.1 A Basic Example ............................................................................. 445
7.4.2 Function Signature ............................................................................................ 446
7.4.3 Different Signatures .......................................................................................... 447
7.4.4 Putting It Together ............................................................................................ 448
7.4.5 Not Quite Recursion.......................................................................................... 449
7.4.6 DrawWords........................................................................................................ 450
7.4.7 What We’ve Learned .........................................................................................453
7.5 Accessors (or Properties) ...................................................................................................453
7.5.1 Value ................................................................................................................. 454
7.5.1.1 A Basic Example ..............................................................................455
7.5.2 Set Event.............................................................................................................455
7.5.3 Read-Only Accessor ......................................................................................... 457
7.5.4 Simplification .................................................................................................... 458
7.5.5 What We’ve Learned ........................................................................................ 459
xiv Contents

7.6 Base Classes: Another Look ............................................................................................. 459


7.6.1 Generalization—Base Classes .......................................................................... 459
7.6.2 Specialization .................................................................................................... 461
7.6.3 Base ................................................................................................................... 461
7.6.4 Partial ................................................................................................................ 463
7.6.5 Protected, Private, and Public ........................................................................... 466
7.6.6 What We’ve Learned ........................................................................................ 467
7.7 Optional Parameters ......................................................................................................... 467
7.7.1 Using Optionals................................................................................................. 468
7.7.1.1 A Basic Example ............................................................................. 469
7.7.2 Optional Arguments ......................................................................................... 470
7.7.3 Named Parameters .............................................................................................471
7.7.3.1 A Basic Example ............................................................................. 472
7.7.4 Combining What We’ve Learned ..................................................................... 473
7.7.5 What We’ve Learned .........................................................................................474
7.8 Delegate Functions ............................................................................................................474
7.8.1 Delegates ............................................................................................................474
7.8.1.1 A Basic Example ..............................................................................474
7.8.2 Delegate Signatures............................................................................................476
7.8.3 Stacking Delegates .............................................................................................476
7.8.4 Using Delegates................................................................................................. 477
7.8.5 Updating Delegates ............................................................................................478
7.8.6 What We’ve Learned ........................................................................................ 480
7.9 Interface ............................................................................................................................ 480
7.9.1 Early Planning .................................................................................................. 480
7.9.1.1 A Basic Example ............................................................................. 481
7.9.1.2 Using Accessors .............................................................................. 483
7.9.2 Multiple Interfaces ............................................................................................ 486
7.9.3 IComparer ......................................................................................................... 488
7.9.4 Using IComparer ............................................................................................... 490
7.9.5 What We’ve Learned .........................................................................................491
7.10 Class Constructors Revisited .............................................................................................491
7.10.1 A Basic Example ............................................................................................... 492
7.10.2 When to Create a New Class ............................................................................ 495
7.10.3 What We’ve Learned ........................................................................................ 498
7.11 Preprocessor Directives .................................................................................................... 498
7.11.1 A Basic Example ............................................................................................... 499
7.11.2 UNITY_EDITOR ............................................................................................. 500
7.11.3 Mobile Development ......................................................................................... 502
7.11.4 Warning............................................................................................................. 504
7.11.5 Organizing ........................................................................................................ 505
7.11.6 What We’ve Learned ........................................................................................ 506
7.12 Try Catch Finally .............................................................................................................. 506
7.12.1 A Basic Example ............................................................................................... 506
7.12.2 Exception Messages .......................................................................................... 508
7.12.3 Custom Exceptions ............................................................................................510
7.12.4 Finally ................................................................................................................512
7.12.5 Try-Catch and Finally in Use.............................................................................513
7.12.6 What We’ve Learned .........................................................................................513
7.13 IEnumerator .......................................................................................................................514
7.13.1 Enumeration .......................................................................................................515
7.13.1.1 A Basic Example ..............................................................................515
7.13.1.2 What Doesn’t Work ..........................................................................517
Contents xv

7.13.2 Implementing IEnumerator ................................................................................517


7.13.3 What We’ve Learned .........................................................................................521
7.14 Generics .............................................................................................................................521
7.14.1 Generic Functions ............................................................................................. 522
7.14.1.1 A Basic Example ............................................................................. 522
7.14.1.2 Why T? ............................................................................................ 523
7.14.2 Making Use of Generic Functions .................................................................... 523
7.14.3 Generic Types ................................................................................................... 526
7.14.4 Var ..................................................................................................................... 527
7.14.5 Multiple Generic Values ................................................................................... 529
7.14.6 Anonymous Objects .......................................................................................... 530
7.14.7 What We’ve Learned .........................................................................................533
7.15 Events .................................................................................................................................533
7.15.1 A Basic Example ............................................................................................... 534
7.15.2 A Proper Event .................................................................................................. 536
7.15.3 EventArgs ...........................................................................................................537
7.15.4 Generic EventArgs .............................................................................................539
7.15.5 What We’ve Learned ........................................................................................ 540
7.16 Extension Functions .......................................................................................................... 540
7.16.1 Extensions ..........................................................................................................541
7.16.2 A Basic Example ................................................................................................541
7.16.3 Overloading with Extensions ............................................................................ 543
7.16.4 Magic Mirror .................................................................................................... 544
7.16.5 What We’ve Learned ........................................................................................ 546
7.17 Destructors ........................................................................................................................ 546
7.17.1 A Basic Example ............................................................................................... 547
7.17.2 Clearing Events or Delegates ............................................................................ 549
7.17.3 OnDestroy ......................................................................................................... 550
7.17.4 The Ugly Truth...................................................................................................552
7.17.5 What We’ve Learned ........................................................................................ 554
7.18 Concurrency or Co-Routines .............................................................................................555
7.18.1 Yield ...................................................................................................................555
7.18.1.1 A Basic Example ..............................................................................557
7.18.2 Setting Up Timers ..............................................................................................558
7.18.3 Arrays of Delegates ............................................................................................561
7.18.4 Stopping a Co-Routine ...................................................................................... 562
7.18.5 What We’ve Learned ........................................................................................ 565
7.19 Dictionary, Stacks, and Queues ........................................................................................ 565
7.19.1 A Basic Example ............................................................................................... 565
7.19.2 ContainsKey ...................................................................................................... 567
7.19.3 Stacks ................................................................................................................ 568
7.19.3.1 A Basic Example ............................................................................. 568
7.19.4 Movement Stack ................................................................................................ 569
7.19.5 Queues................................................................................................................571
7.19.6 What We’ve Learned ........................................................................................ 573
7.20 Lambda Expressions ......................................................................................................... 573
7.20.1 Anonymous Expressions ....................................................................................574
7.20.1.1 A Basic Example—Action Func and Expression ............................575
7.20.2 Lambda Expressions ......................................................................................... 577
7.20.3 A Queue of Lambdas ........................................................................................ 577
7.20.4 What We’ve Learned ........................................................................................ 578
7.21 Leveling Up ...................................................................................................................... 578
xvi Contents

8. Extended........................................................................................................................................ 579
8.1 What We’ll Be Covering in This Chapter ........................................................................ 579
8.2 Review .............................................................................................................................. 579
8.3 Readability .........................................................................................................................581
8.3.1 ?: Notation ..........................................................................................................581
8.3.2 If ........................................................................................................................ 582
8.3.3 Smell ................................................................................................................. 583
8.3.3.1 Comments ......................................................................................... 583
8.3.3.2 One Responsibility Rule ................................................................... 583
8.3.3.3 Duplicated Code ............................................................................... 584
8.3.3.4 Naming ............................................................................................. 584
8.3.4 What We’ve Learned ........................................................................................ 584
8.4 Git Revisited ..................................................................................................................... 584
8.4.1 Git Branch and Merge ....................................................................................... 585
8.4.2 Merge Conflicts ................................................................................................. 588
8.4.3 What We’ve Learned .........................................................................................591
8.5 Recursion ...........................................................................................................................591
8.5.1 A Basic Example ............................................................................................... 593
8.5.2 Understanding Recursion .................................................................................. 593
8.5.3 In Practice ......................................................................................................... 594
8.5.4 What We’ve Learned ........................................................................................ 601
8.6 LINQ ................................................................................................................................. 601
8.6.1 Lambdas and Arrays ......................................................................................... 601
8.6.1.1 A Basic Example .............................................................................. 601
8.6.2 Var ..................................................................................................................... 602
8.6.3 LINQ From ....................................................................................................... 603
8.6.4 Strange Behaviors in LINQ .............................................................................. 604
8.6.5 LINQ on Lists ................................................................................................... 605
8.6.6 Monsters Linq ................................................................................................... 608
8.6.7 What We’ve Learned .........................................................................................611
8.7 Reflection ...........................................................................................................................613
8.7.1 A Basic Example ................................................................................................615
8.7.2 Reflection MethodInfo .......................................................................................615
8.7.3 What We’ve Learned .........................................................................................618
8.8 Dynamic............................................................................................................................ 620
8.8.1 ExpandoObject ...................................................................................................621
8.8.2 Expando Reader ................................................................................................ 622
8.8.3 What We’ve Learned ........................................................................................ 623
8.9 Bitwise Operators ............................................................................................................. 624
8.9.1 Big Endian and Little Endian ........................................................................... 624
8.9.2 Signed or Unsigned ........................................................................................... 625
8.9.3 Bitwise Or | ....................................................................................................... 627
8.9.4 Enums and Numbers ......................................................................................... 627
8.9.5 Bitwise And & .................................................................................................. 628
8.9.6 Bitwise Exclusive Or ^ (xor) ............................................................................. 629
8.9.7 Setting Bitwise Flags ........................................................................................ 630
8.9.8 Bitwise Shortcuts | = and ^ = .............................................................................631
8.9.9 Bits in Numbers ................................................................................................ 632
8.9.10 Bit Shifting >> and << ..................................................................................... 632
8.9.11 What We’ve Learned ........................................................................................ 634
8.10 Attributes .......................................................................................................................... 635
8.10.1 A Basic Example ............................................................................................... 635
8.10.2 Custom Attributes ............................................................................................. 639
Contents xvii

8.10.3 Custom Attributes for Default Values............................................................... 639


8.10.4 Multiple Attributes ............................................................................................ 641
8.10.5 Putting Attributes to Work ................................................................................ 642
8.10.6 Attribute Flags .................................................................................................. 644
8.10.7 What We’ve Learned ........................................................................................ 645
8.11 Bitwise Math ..................................................................................................................... 646
8.11.1 Two’s Complement Unary Operator ~ .............................................................. 647
8.11.2 Bitwise Addition and Subtraction ..................................................................... 648
8.11.3 Bitwise Multiplication ....................................................................................... 650
8.11.4 Bitwise Tricks ....................................................................................................651
8.11.5 What We’ve Learned ........................................................................................ 652
8.12 Architectures and Organization ....................................................................................... 653
8.12.1 Planning Structure: Namespaces and Directories ............................................ 653
8.12.2 Divide and Conquer .......................................................................................... 654
8.12.3 Refactoring ........................................................................................................ 655
8.12.4 What We’ve Learned ........................................................................................ 656
8.13 Design Patterns ................................................................................................................. 656
8.13.1 Creational Design Patterns ............................................................................... 657
8.13.1.1 Singleton Pattern ............................................................................. 657
8.13.2 Structural Design Patterns ................................................................................ 657
8.13.3 Behavioral Design Patterns............................................................................... 658
8.13.4 What We’ve Learned ........................................................................................ 658
8.14 Continuing on Your Own.................................................................................................. 658

9. Stuff We Couldn’t Cover ..............................................................................................................661


9.1 The Extern Keyword..........................................................................................................661

10. Good Luck..................................................................................................................................... 663

Index ...................................................................................................................................................... 665


1
Introduction: What This Book Is About

This book was written as an answer for anyone to pick up a modern programming language and be pro-
ductive. You will be able to start a simple game in Unity 3D from scratch. By the end of this book, you
will have the basic skills to eventually become a capable unity game programmer, or at least know what
is involved with how to read and write some code.
You should have general computer skills before you get started. Come prepared; you’ll need a modern
Windows or OSX computer capable of running modern software with an internet connection. After this
book, you should be armed with the knowledge required to feel confident in learning more.
Each chapter has example code organized by chapter and section. We’ll try to make a fun project start-
ing with the basic functions of a typical game and we’ll see how the basic game can be expanded upon
and we’ll learn a bit about what’s involved with a larger project.

1.1 Why Read a Book: Why This Book May or May Not Be for You
You could go online and find videos and tutorials to learn; however, there is a disadvantage when it
comes to learning things in order and in one place. Most internet video or tutorial websites may gloss
over or dwell on a subject. You could skip ahead, but then what are you paying for?
Online content is often brief and doesn’t go into much depth on any given topic. It is incomplete or still
a work in progress. You’ll often find yourself waiting weeks for another video or tutorial to come out.
Just so you know, you should find the act of learning exciting. If not, then you’ll have a hard time con-
tinuing through to the end of this book. To learn any new skill, a lot of patience is required.
I remember asking an expert programmer how I’d learn to program. He told me to write a compiler.
At that time, it seemed rather unfair, but now I understand why he said that. It is like telling someone
who wants to learn how to drive Formula 1 cars to go compete in a race. In both cases, the “learning”
part was left out of the process.
It is very difficult to tell someone who wants to learn to write code where to begin. However, it all
really does start with your preparedness to learn. Your motivation must extend beyond the content of
this book.
You may also have some preconceived notions about what programming is. I can’t change that, but
you should be willing to change your thoughts on the topic if you make discoveries contrary to your
knowledge. Keep an open mind.
As a game developer, you should find the act of making a game, or simply learning how to make a
game, is just as fun as playing a game. If your primary goal is only to make that game that you’ve had in
your head for years, then you might have a problem. You may find this book a tedious chore if learning
C# is just something in the way of making your game.
Computer artists often believe that programming is a technical subject that is incompatible with
art. I find the contrary to be true. Programming is an art, much as literature and design are an art.
Programming just has a lot of obscure rules that need to be understood for anything to work.
No, programming is not too hard to learn. Writing a massive multiplayer online role-playing game
is quite hard. Learning how to write a simple behavior isn’t hard; like drawing, you start off with the
basics drawing spheres and cubes. After plenty of practice, you’ll be able to create a real work of art.
This applies to writing code, that is, you start off with basic calculations and then move on to the logic
that drives a complex game.

1
2 Learning C# Programming with Unity 3D

1.1.1 Do I Need to Know Math?


With complex rules in mind, does programming require the knowledge of complex mathematics? Unless
you are writing mathematical software, only a bit of geometry is required. Most of the examples here
use only a tiny bit of math to accomplish their purpose. Mathematics and programming do overlap quite
a lot in their methodology.
Math taught in schools provides a “best” solution. Programming results tend to behave a bit like a
math proof, but the proof isn’t just another bit of math. Rather, the proof of your code means that your
zombies chase after humans. A considerable amount of math required has been done for you by the com-
puter. It is just up to you to know what math to use, and then plug in the right variables.

1.1.2 Programming as a Form of Expression


There is a deeper connection between words and meaning in programming. This connection is more
mechanical, but flexible at the same time. In relation to a programming language, programmers like to
call this “expressiveness.”
When you write words in literature, you infer most if not all of the meaning. When programming
inference isn’t implied, then you’re free to define your own meanings for words and invent words freely.
One common merging of art and code appears within a video game. Anytime characters can react to
each other and react to user interaction conveys a greater experience. An artist, an animator, or an envi-
ronment designer should have some ability to convey a richer experience to the audience. A character
artist can show a monster to his or her audience; but to really experience the creature, the monster should
glare, grunt, and attack in reaction to the audience.

1.1.3 Games as a Stage with Lights


To do this, we’re going to use Unity 3D, a game engine. If you were to write a play, you would not have to
build the auditorium for your performance. Building lights and generating electricity to run them would
distract you from writing your play. Playwrights don’t often build lights and auditoriums from scratch,
and there are plenty of venues you could use as your stage, which is where game engines come in.
Game engines such as Unity 3D, Unreal Engine, Crytek, and even Game Maker, or Godot have a lot
of the basic game and math-related functions built for you. They are ready-built stages that allow you
to focus on making your game. The necessary code for rendering and physics have been done for you.

1.2 Personal Information


I started in the 1990s cleaning up sprites for Atari. Back then the job qualifications were basically having
Photoshop and a Wacom tablet. Oh, how times have changed!
I’ve worked for many different game studios, in both 2D and 3D, as an artist. I was exposed to many dif-
ferent software packages including Strata 3D on the Mac and Alias (PowerAnimator) on the SGI (Silicon
Graphics International), among many others. I loved learning new 3D modeling, rendering, and animation
applications. During my work as an artist, I used Maya, a popular 3D modeling package. While using
Maya, I was introduced to the Maya Embedded Language (MEL) script. Today I use Modo with Python.
After working as a character rigger and technical artist, I learned many programming languages
including MAXScript, MEL, and Python, which helped me to write tools for my fellow artists to use for
speeding up production.
I eventually moved into the job of programmer as my primary job function. I wrote prototypes for
Microsoft in Unreal using UnrealScript, a programming language much like JavaScript. This game studio
was run by John Gaeta and Peter Oberdorfer, who are award-winning movie special effects directors.
I began my career path as an artist, then became a technical artist, and finally a programmer.
This seems to be a common trend among a small variety of 3D artists like myself. I know quite a few
folks who have followed the same career path.
Introduction: What This Book Is About 3

During my transition from artist to programmer, I found that there was very little by way of help, docu-
mentation, web pages, or similar to complete the transition from an artist to a programmer. Many people
assumed that you were either a programmer to begin with, or not interested in making that transition.
After a long discussion, with my then girlfriend—now wife, about what a variable is, I decided it was
time to write a book.

1.3 A Brief History of Computer Programming:


How Programming Came to Be
Basic insight into the inner workings of your computer may help understand why and how some text gets
converted into computer instruction. The words that make up C#, or any other programming language
get converted into what is called byte code.
Skilled programmers tend to know more about the inner workings of their computer. Like any trade
or learned skill, the more you know about how your tools work, the better understanding of the entire
process you’ll have.
To understand why programming tools work as they now do stems from knowing how they used to
work. To understand how the current tools came about means knowing a bit of computer history and how
computers used to work.

1.3.1 Mechanical Computers


The first programmable computer is arguably the Babbage machine built by Charles Babbage in the
1820s. Made of tens of thousands of moving parts and weighing several tons, it was a gigantic mechani-
cal calculator that could display a 31-digit number. It was called the Difference Engine. in 1824 Babbage
won a gold medal from the British Astronomical Society, by using his gigantic calculator, for correcting
a set of tables used to chart the movement of planets through the sky.
In 1833, a countess named Augusta Ada King of Lovelace, commonly known as Ada Lovelace, met
Babbage at a party where she was introduced to the Difference Engine. Several years later, it became
evident that she understood the machine better than Charles himself. Despite being a housewife to the
Earl of Lovelace, she wrote several documents on the operation of the Difference Engine as well as its
upgraded version, the Analytical Engine. She is often considered to be the first computer programmer
for her work with the Difference Engine and its documentation.

1.3.2 Logic
In 1848, George Boole gave us Boolean logic. It would take nearly a century between the Difference
Engine and the first general programmable computer to make its appearance. Thanks to George, today
our computers count in binary (1s and 0s), and our software thinks in terms of true or false.
In 1887, Dorr Eugene Felt built a computing machine with buttons; thanks to him, our computers have
keyboards. In the 1890s, a tabulating machine used paper with holes punched in it representing 1s and 0s
to record the US census. Back then it saved US$2 million and 6 years of work.
There was a moment in time where a trinary computer existed. In 1840, Thomas Fowler created a compet-
ing mechanical computer which worked with −1, 0, and +1. Even as late as 1958 an electronic version was
created in the Soviet Union, but its usefulness lost out to binary which was easier to build and used less power.
In the 1900s, between Nicola Tesla and Alexander Graham Bell, modern computers were imminent
with the invention of the transistor. In 1936, Konrad Zuse made the Z1 computer, another mechanical
computer like that of Babbage, but this time it used a tape with holes punched in it like the tabulating
machine. He’d later move on to make the Z3 in 1941.

1.3.3 Computer Science


In the 1940s, Alan Turing, a British computer scientist, designed and built an encrypted message decoder
called the Bombe that used electromechanical switches for helping the Allied forces during World War II.
4 Learning C# Programming with Unity 3D

Between the 1930s and the 1950s, Turing informed the computer scientists that computers can, in theory,
solve anything calculable, calling this concept Turing completeness. All of these components were lead-
ing toward our modern computer.
In the mid-1940s, John Von Neumann demonstrated, with the help of his theory, that the computer
can be built using simple components. In this way, the software that controls the hardware can add the
complex behavior. Thanks to Tesla and Bell, the Z3 was made completely of electronic parts. It included
the first use of logic while doing calculations, making it the first complete Turing-complete computer.
In 1954, Gordon Teal at Texas Instruments introduced the silicon-based transistor, a key component for
building solid-state electronics that are used today in every computer.

1.3.4 The Origin of Software


The Z3 was programmed using Plankalkül, the first high-level programming language, invented by Zuse
shortly after he finished building the machine. In 1952, Grace Hopper created the first compiler software
that could translate human-readable words into machine operations. For the first time, the programmer
didn’t need to know how the transistors operated in the hardware to build software for the computer to
run. This opened computer programming to a whole new audience.
Between the 1950s and 1970s, computers and computer languages were growing in terms of complex-
ity and capability. In 1958, John McCarthy invented LISP (for LISt Processor) at the Massachusetts
Institute of Technology (MIT). Object-oriented programming appeared in Simula 67 in 1967. Imperative
and procedural programming made its appearance in Pascal in 1970.

1.3.5 Modern Computer Language


Bell Labs, started by Bell in the 1920s, hired Dennis Ritchie in 1967. In 1974, Ritchie published the
C programming language that has become the most popular computer programming language. In 1983,
Bjarne Stroustrup introduced C++ as “C with Classes.”
In 2001, Microsoft released C#, a combination of several programming language paradigms taking the
concepts from C, C++, LISP, Haskell, and others, and incorporating the ideas and concepts into a single
language. Today, C# is in its seventh major revision, whereas C++ is in its seventeenth revision. C# is
an evolving language having new features and concepts. Each revision makes the language more flexible
and most important, more expressive.

1.3.6 The Future of Computer Languages


The International Business Machines Corporation (IBM), a US company founded in the 1920s, is cur-
rently engineering new technology using particle physics discovered nearly a century ago. Modern spin-
tronics derived from the work of German physicists in the late 1920s.
Without particle physics and physicists such as Friedrich Hermann Hund, we wouldn’t understand
quantum tunneling, and the solid-state storage or universal serial bus (USB) thumb drive wouldn’t exist.
After the discovery and confirmation of the Higgs boson, you might ask “Why bother?” This question
might not get a good answer for another hundred years, but it’ll be worth it.
C# is not the last computer language; many others have been introduced just recently. Google has intro-
duced Kotlin specifically for developing apps for Android and Apple has introduced Swift for their iOS
platform. Microsoft, not to be outdone, introduced Q# for the future of quantum computing.
Using Q# for game development isn’t likely, at least for now. Programming languages have advantages
and disadvantages in different disciplines. The purpose of programming languages is to allow human
readable text to be converted into instructions that run on a computer’s CPU.

1.4 C#: A Flexible Programming Language


There are plenty of programming languages and each language was created to fulfill different roles.
Modern programming languages in use today are often described by their paradigms. A paradigm can
be explained as a sort of writing style; each style follows a different set of rules.
Introduction: What This Book Is About 5

1.4.1 C# Paradigm
In poetry, a haiku follows a 5-7-5 syllable tempo. A sonnet follows an iambic pentameter with 10 syl-
lables per line and rhymes in a specific pattern. Not all prose needs to end in rhyme like haiku, but many
do. Rhyming and tempo are paradigms used in poetry.
Modern programming paradigms include object oriented, functional, imperative, and logic program-
ming. Some programming languages use one or more of these paradigms together. For instance, F# is an
imperative, object oriented, and functional language. However, Haskell is purely functional.
C# (pronounced “see sharp”) is a combination of many different paradigms. As the name infers, C#
is a C-style language and primarily expressed using the object-oriented paradigm. How C# expresses its
different paradigms, and how you choose to write with it, is greatly up to you. Due to this flexibility, C#
offers a variety of uses reaching far beyond game development.
You may have heard of C++, another multiparadigm language. It is often used by programmers
who need detailed control over memory management and many other aspects of their final product.
This attention to detail and design is required to produce a refined final product.
C# is an imperative language, that is to say, it carries out operations in order. It is also object oriented,
so each object is allowed to do things on its own. Finally, it is also memory managed, aka garbage col-
lected, so your computer’s memory is organized for you. However, it does provide the flexibility to man-
age memory if you require that level of control. Just as well, C++ has recently added garbage collection
features to match C#.

1.4.2 Unity 3D: A Brief History of Game Engines


A game engine is basically software that provides many of the basic functions that are commonly used
to build a video game. Most game engines allow for rendering either 2D or 3D shapes by importing files
generated in a third-party software such as Blender, or 3D Studio Max or Maya, if you can afford them.
Another function often found in a game engine is the ability to write software for the game engine to run.
Unity 3D allows you to write software to run your game in C#.
3D game engines have a relatively short history in general computing. Their evolution has been hot
and fast. Starting around the 1990s, the 486 processor finally made its way into the general populace as
a processor fast enough to allow for everyone to play 3D games. Or at least pseudo-3D, 2D images drawn
in the shape of three-dimensional geometry. The technology for true 3D polygons would take a few more
years to make it onto the average person’s desktop.
Pseudo-3D was used to describe skewing and scaling flat sprites or 2D images to appear as though they
were in 3D space. True vertex transformation wouldn’t appear in popular video game engines on the PC
with games such as Quake 1 until 1995. This was greatly with the help of faster and enhanced graphics
processors. The modding community took Quake 1 and created many new additions and full conversions.
When powerful graphics processing units (GPUs) were introduced, it opened the floodgates for many
more 3D games to make their appearance. At first, these games functioned only on million-dollar com-
puters, but thanks to 3dfx, nVidia, Maxtrox, and ATi in the late 1990s, the GPU quickly took over being
a requirement for any 3D game. At that time, id Software, run by John Carmack, quickly came to the
forefront of the 3D gaming engine technologies that introduced many concepts such as spline surfaces,
complex shadows, and lighting with Quake 2.
Around 1998, Epic Games’ Unreal Engine and Valve Software’s Source Engine took off with the
launch of Unreal Tournament and Half-Life. More modding and conversions exploded onto the scene.
Many successful game modifications including Counter-Strike would go on to be one of the most played
online multiplayer games Valve Software would publish for years to come.
Before the availability of dedicated GPU and cheap RAM, computers didn’t have enough free resources
to support a game engine with editing tools. Often the game itself required so much of the computer that
there was little room left for any extras, such as particle editors or just-in-time compiling.
The modding community influenced business, making Unreal 2 and Source more modder friendly.
Garry’s Mod and Unreal Editor changed how game engines were made by adding tons of user-friendly
tools. Many users bought games specifically to “mod,” or modify, and create new games.
6 Learning C# Programming with Unity 3D

It’s no surprise that at this time many game engines would show up on the scene to cater to the mod-
ding community and the independent game developer. The large game engines found themselves top
heavy by focusing on large publishers. Companies such as RenderWare and Gamebryo found themselves
poorly positioned to compete against newcomers who focused on the independent developers such as
Unity 3D.
With the independent game developer in mind, many game engines focused on affordability and cross-
platform development. Tools such as Game Maker, Unreal Engine, and of course Unity 3D allowed
for many more people to learn and build games without the multimillion-dollar investment formerly
required for game production.

1.4.3 Why Use Unity 3D to Learn?


Making a game is more fun than making accounting software.
Having fun learning is more important as getting high test scores. After a test, you pretty much forget
the anguish of studying all night and what it was for. So there is no reason to make learning menial work
because studying should not be boring.
Once learning becomes entertainment, the lessons become something you want to remember. As a fun
experience, you remember the experience longer. I’ve found that learning how to write game artificial
intelligence (AI) and behavior is the best way to retain programming experience.
Programming lessons are often taught using stiff diagrams and simple math problems with little or no
immediate or obvious applicable use. How often have you actually needed to know where trains would
meet leaving two different cities at two different speeds? Experience shows that readers lose interest in
any example involving grade-point averages or a train leaving from New York.
Unity 3D offers examples by blowing things up. Calculus and vector examples are usually explained
using grids and lines. These concepts are lost by abstract pictures that lack meaning or application.
In this case, we’ll use math to solve for where a bad guy needs to throw a grenade in order to hit a mov-
ing target.
Finally, we’ll end up with both the knowledge that will help build a game and the skills needed to write
software outside of Unity 3D. With any luck, we’ll also have fun while learning. Some of these examples
may even help with your math classes.
Unity 3D also provides us with a complete set of tools we can use in our code quickly and easily. These
tools are a part of the Unity 3D application programming interface (API). The Unity 3D API is filled
with useful things such as commonly used routines, data structures, and classes. These parts of the API
are often called a library. We’ll learn what all that means in the remaining chapters.

1.4.4 How Does Unity 3D Use C#?


Not that long ago, Unity 3D supported three programming languages. First there was Boo, which
was given an accompaniment with JavaScript followed by C#. As of the latest version of Unity 3D,
C# is considered the primary, or first-class programming language. Both JavaScript and Boo have
been phased out.
In general, C# is gaining more support across many open source projects and has a growing user base.
The Dot Net Foundation which maintains .NET Core, is an open source project supported on multiple
platforms.
You might be surprised to learn that programming languages have version numbers. With each new
version of a language comes new features. As of the writing of this book, Unity 2018 and newer sup-
ports. NET 4.7 which is C# version 7.0. What does that mean? It’s not so simple, actually. Microsoft
created .NET (dot net): a framework or a standardized environment in which code can accomplish
common tasks with fewer commands. Using software without a framework often means reinventing
code that’s been written many times. The framework is also intended to be easily extended. Unity 3D
includes many game-related additions to help make building games easier.
Introduction: What This Book Is About 7

The progression looks something like this table:

January 2002 C# 1.0 .NET 1.0


April 2003 C# 1.2 .NET 1.1
November 2005 C# 2.0 .NET 2.0 Unity 3D 4.1
November 2007 C# 3.0 .NET 3.5
April 2010 C# 4.0 .NET 4.0 Unity 3D 5.6
August 2012 C# 5.0 .NET 4.5
July 2015 C# 6.0 .NET 4.6 Unity 3D 2017.1
March 2017 C# 7.0 .NET 4.7 Unity 3D 2018.1
August 2017 C# 7.1 .NET 4.7.1

As new versions of .NET were introduced, the language that went along with it was also upgraded,
though with different version numbers. Confusing? Yes. Unfortunately, to add to the confusion there’s
also three versions of .NET that include .NET Standard, .NET Framework, and .NET Core. The differ-
ences between these have no effect on what we’ll be learning in this book, so I’ll leave that research up to
you to do on your own. For now, we’re not so concerned with the version of either so long as the features
we learn about the C# language work within the context of Unity.
C# is used by a large community of general application programmers, not just game engineers. Unity
3D is also a cross-platform game engine, and a developer working on either OSX or Windows can both
share and use files for Unity 3D. C# is the same on both Mac and PC as well as Android and iOS for
mobile, so there is no concern over what operating system you’re going to use.

1.4.4.1 How to Tell Unity 3D What to Do


Unity 3D and Microsoft Visual Studio are going to be our integrated development environment (IDE).
IDEs come in many different forms. Many professional Windows programmers use Visual Studio, and
Apple developers usually use Xcode in OSX. Microsoft has also made Visual Studio available for OSX.
An IDE provides many tools that make programming easier by highlighting the lines of code and auto-
matically completing many commonly repeated tasks.
When it comes to learning about the nuts and bolts of programming, you’re basically learning about
how your computer thinks, or in more general terms, how your computer does what it is told. Somewhere
along the way you’ll realize how unintelligent your computer is and how smart good programmers are.
Programming is basically writing detailed instructions on what to do and when. In short, get data then
do something with the data. A big part of programming is figuring out where to get information; we’ll
call this data management. Then you use logic to determine what to do with the data once you have it.
Programming logic is organized into algorithms found in statements organized into functions.
Unity 3D provides tools to move characters and objects with your code. These assets all live in the
project directory as separate files or entities that you can control through code. Unity 3D provides scenes
to give structure to your assets—3D models particle systems for explosions, fire, and other special
effects—and tools to create and edit all these things. It is largely up to you to learn these different sys-
tems on your own, but this book covers the code part of things.
Unity doesn’t provide a set of 3D modeling or 2D image editing tools. For this you’ll want to find
something like Blender 3D which is free or use another 3D modeling and texturing tools set. You’ll also
want to look into Gimp or Dogwaffle to paint 2D images to import into Unity.

1.5 What Is Programming?


It’s all about writing code.
Programming is a process in which we organize data and use logic to do something with the data.
The data is everything a computer can store; they can range from numbers to zombie characters in a
video game. You do this by writing text into many files called source code. Source code written into text
files replaces punch cards used by the computing machines half a century ago.
8 Learning C# Programming with Unity 3D

When data is combined with logic and then written into a single file, it’s called a class. Classes are also
data and, as such, can be managed with more logic. Classes are used to create objects in the computer’s
memory and can be duplicated to have a life of their own.
Classes are used to build objects. Each piece of data within the class becomes a part of that object.
Different chunks of data inside of a class are called class members. Class members can also be chunks
of logic called functions or methods. If that is not clear right now, don’t worry we’ll go into detail on that
in Chapter 2.
Objects created from a class are called instances. In a game with a horde of zombies, each zombie is
duplicated or instanced from a zombie class. Each zombie has unique values for each attribute or data
element in the class. This means hit points and positions are unique for each duplicate zombie object.
Similar to families, objects can inherit properties from one another. The child, sometimes called a
subclass, inherits attributes from its parent. For instance, the child created from a zombie may inherit
the parent’s hunger for brains. To be useful, the child zombie can also add new objects and change the
objects it inherited from its parent class. As a result, now the child zombie might have tentacles that the
parent didn’t have.
Objects talk to each other through events and messages. Shooting at zombies can create an event, or
in programmer terms, it “raises” an event. The bullet impact event tells the zombie class to then take
necessary steps when hit by a bullet. Events command the class to take actions on its data, which is where
functions come in.
Functions, also known as methods, are sections of logic that act on data. They allow your class to cre-
ate additional events and talk to yet more objects. As the player presses the trigger and moves the joystick
around, yet more events can be raised and messages can be sent. Events and messages allow the player
to interact with your world; logic events and objects together build your game.

1.5.1 What Does C# Look Like?


A game in Unity 3D is made up of many different C# files. Each file can be referred to as a “class” and
ends with the .cs file extension (which stands for C Sharp). This isn’t a class like those that are taught. It is
more akin to biology in which classes are categories that define different groups of organisms.
Introduction: What This Book Is About 9

A basic game might have several different classes, each one named according to its purpose. Each one of
these classes contains the text that is your actual C# code. Just so you know, by default Windows will hide
the extensions of your files. As a result, if classes appear as simply Weapon or Monster and there is no exten-
sion.cs, then you should go into the Tools menu, select Folder Options/View, and enable file extensions.
As an exercise, we’ll be building a simple game involving monsters and shooting. We’ll start with a
basic skeleton with simple object classes and simple movement behaviors. From this we’ll build on some
basic events when the player presses keys, moves the mouse, and shoots at targets.

1.5.2 Learning to Copy and Paste


A good artist creates, a great artist steals.
Code examples exist for you to copy and paste into your project. The content for this book and all down-
loadable content are no different. You’ll have to understand what the code does and fit it to your needs.
Every programmer copies code habitually. Whether it is from code written in a previous project, or
code found on the internet. Programmers copy code to learn. Of course, it’s still important to know how
to write new code from scratch; most programming classes in school will prefer that you do this for all
your assignments. With practice, being able to recognize what to copy and where to paste is something
you’ll only know from writing code to begin with.
Programming is a constant learning process. It is a language to command computers. Anytime you
learn a new language, there will be plenty of words which you’ll have to look up. Add to this the fact that
every programmer gets to make up new words, and you’ve got a language that always needs a dictionary.
This is one reason why programmers are usually fast typists. This is also cause for programmers to be
picky about what keyboard they prefer.
In most cases, the projects in this book will be in some state where you can read text that is already
in place. Most of the projects are in a more complete state where you’ll be able to run them and see an
intended result.
As a programmer, I’ve gotten used to searching the internet for example code. Once I’ve discovered
something that looks useful, I copy that code and paste it into a simple test case. After I’ve wrapped my
head around what the code is doing, I rewrite it in a form that is more suited for my specific case.
Even if the code involves some fun trick, I’ll learn from that code. As I learn new tricks, I grow as a
programmer. The only way to learn new tricks is finding the necessity to solve a new problem for which
I haven’t already figured out a solution. Finding solutions to problems is a fundamental part of being a
programmer.

1.5.3 Iteration
Programming is an iterative process. It’s irregular to write an entire class or function without test-
ing it many times. The general flow is to write a part of a function, test it, add a bit more, test again,
and repeat until the function accomplishes its goal. Even then, many functions often work together in
sequence. Often, you’ll write a function, verify that it’s working, write another function, and verify some
more. Then you’ll have them work with one another and test again, all the while you’ll be changing and
re-arranging your code to fix mistakes.
Most of the time you’ll start off with a bunch of placeholders until you get around to finishing your
code. As you’re adding features and finishing code, you’ll have chunks of work that aren’t finished.
This is a part of game development and a part of learning as well.

1.6 Compiling: Turning Words into Computer Instruction


To test and use your code, it is time to compile. Compiling is the process of taking all of your source
files and building bytecode. Unity 3D uses .NET, as it is a compiler to generate the bytecode, but Unity
3D does this automatically. Mono is an open-source compiler that runs on many different processors and
operating systems.
10 Learning C# Programming with Unity 3D

The combination of the central processing unit (CPU) and operating system is often called a platform.
Each platform requires a unique native machine code to execute or run. Building code for each platform
is called a target. Unity 3D converts the bytecode into a native machine code and can target Mac, PC,
Android, and iOS.
Native machine code is the set of instructions that directly talk to the CPU and operating system (think
of the holes punched into a card and fed to a machine). Unity 3D is a simple way to generate the complex
set of instructions for your computer to run. Code that talks directly to the hardware is referred to as
“low-level” programming.
There are layers of software between you and the computer’s hardware. When writing C# for games
using Unity 3D, your code is compiled by .NET. Unity 3D then takes the bytecode from .NET and com-
piles a target platform into a native machine code.
Both Unity 3D and .NET are the layers underneath your code and the computer’s hardware, putting
you on a higher level. This is often referred to as a computer layer abstraction. That is why C# is usually
considered a high-level programming language.
Programming at a lower level requires much more knowledge of memory management and a wide
variety of other APIs that might include graphic cards, physics, sound, and everything else that runs a
game. Writing for a layer involves an in-depth knowledge of both the layers below and above the one
you’re writing for.
The computer hardware, such as CPU, graphics card, memory, and storage, live on the lowest level.
Above them is the basic input/output system (BIOS) and software that starts the hardware when you
press the Power button. Above that is your computer’s operating system and drivers that talk to the hard-
ware. Finally, Unity 3D lives above the operating system and your code lives above Unity 3D.
That is why we’re going to use Unity 3D to write games and not start from scratch in raw C++.
Otherwise, we’ll have to spend a few years learning about physics, rendering, and assembly language or
the instruction set that your CPU uses to operate.

1.7 What We’ve Learned


We should have an idea of what C# is, and what is required of you to learn it. If you haven’t done so
already, download and install the required software.
Unity 3D is free; there are no fees or royalties that need to be paid to the Unity 3D developers so long
as you’re not building any commercial product. Git is also free to use and you’ll need that to follow the
chapters on Git.
You’re even allowed to deploy your projects on anything Unity can target. Until you’re ready for a
commercial launch, the free license is all you’ll need for learning and sharing your game with your peers
on your computer.
Optionally, you may also want to setup an account on the Unity 3D site if you want to download and
use any of the assets from their Asset Store. A Visual Studio Community account and a GitHub account
may also come in useful later.

1.8 Leveling Up: The Path Ahead


The computer systems in place today have evolved from machines with moving parts. Telling these
machines what to do involved setting knobs and switches. Today, we use text organized into statements
and logic.
It is difficult to imagine a time when computers were so slow that simple calculations involved waiting
for clattering switches to finish moving around to produce an answer. Today, computers complete many
billions of calculations in a single second. All too often, we take for granted that computers rely on the
same concepts and systems engineered nearly a century ago.
Understanding how computers work puts into context how we write software. It is possible to write
software without this understanding, but it is harder to appreciate how it works.
Another Random Scribd Document
with Unrelated Content
drudgeries, which are still allotted to the existing slave-castes, but the Koragars, who had
been raised by Habāshika to the highest posts under his government, were stripped and
driven towards the sea-shore, there to be hanged, but, being ashamed of their naked
condition, they gathered the leaves of the nicki bush (Vitex Negundo), which grows
abundantly in waste places, and made small coverings for themselves in front. On this
the executioners took pity on them and let them go, but condemned them to be the
lowest of the low, and wear no other covering but leaves. The Koragas are now the
lowest of the slave divisions, and regarded with such intense loathing and hatred that up
to quite recent times one section of them, called Andē or pot Koragars, continually wore
a pot suspended from their necks, into which they were compelled to spit, being so
utterly unclean as to be prohibited from even spitting on the highway; and to this day
their women continue to show in their leafy aprons a memorial of the abject degradation
to which their whole race was doomed.” It is said that in pre-British days an Andē
Koraga had to take out a licence to come into the towns and villages by day. At night
mere approach thereto was forbidden, as his presence would cause terrible calamity. The
Koragas of those days could cook their food only in broken vessels. The name Vastra, by
which one class of Koragas is called, has reference to their wearing vastra, or clothes,
such as were used to shroud a dead body, and given to them in the shape of charity, the
use of a new cloth being prohibited. According to another account the three divisions of
the Koragas are (1) Kappada, those who wear clothes, (2) Tippi, who wear ornaments
made of the cocoanut shell, and (3) Vanti, who wear a peculiar kind of large ear-ring.
These three clans may eat together, but not intermarry. Each clan is divided into
exogamous septs called balis, and it may be noted that some of the Koraga balis, such as
Haledennaya and Kumērdennaya, are also found among the Māri and Mundala Holeyas.
Koraga.

On the subject of Koraga dress, Mr. Ullal Raghvendra Rao informs us that “while the
males gird a piece of cloth round their loins, the females cover their waist with leaves of
the forest woven together. Various reasons are assigned for this custom. According to a
tradition, at the time when the Koragars had reigned, now far distant, one of these
‘blacklegged’ (this is usually the expression by which they are referred to during the
night) demanded a girl of high birth in marriage. Being enraged at this, the upper class
withheld, after the overthrow of the Koragas, every kind of dress from Koraga women,
who, to protect themselves from disgrace, have since had recourse to the leaves of the
forest, conceiving in the meantime that god had decreed this kind of covering.” Mr.
Walhouse writes189 further that the Koragas wear an “apron of twigs and leaves over the
buttocks. Once this was the only covering allowed them, and a mark of their deep
degradation. But now, when no longer compulsory, and of no use, as it is worn over the
clothes, the women still retain it, believing its disuse would be unlucky.” “The Koragas,”
Mr. H. A. Stuart tells us,190 “cover the lower part of their body with a black cloth and
the upper part with a white one, and their head-dress is a cap made of the areca-nut
spathe, like that worn by the Holeyas. Their ornaments consist of brass ear-rings, an iron
bracelet, and beads of bone strung on a thread and tied around their waist.” The waist-
belt of a Koraga, whom I saw at Udipi, was made of owl bones.

“It may,” Mr. Walhouse states,191 “be noted that, according to the traditional accounts,
when the invading hosts under Habāshika were in their turn overthrown and subjected,
they accepted slavery under certain conditions that preserved to them some shadow of
right. Whilst it was declared that they should be for ever in a state of servitude, and be
allowed a meal daily, but never the means of providing for the next day’s meal. Each
slave was ascripted to his master under the following forms, which have come down to
our days, and were observed in the purchase or transfer of slaves within living memory.
The slave having washed, anointed himself with oil, and put on a new cloth, his future
owner took a metal plate, filled it with water, and dropped in a gold coin, which the slave
appropriated after drinking up the water. The slave then took some earth from his future
master’s estate, and threw it on the spot he chose for his hut, which was given over to
him with all the trees thereon. When land was transferred, the slaves went with it, and
might also be sold separately. Occasionally they were presented to a temple for the
service of the deity. This was done publicly by the master approaching the temple,
putting some earth from before its entrance into the slave’s mouth, and declaring that he
abjured his rights, and transferred them to the deity within. Rules were laid down, with
the Hindoo passion for regulating small matters, not only detailing what work the slaves
should do, but what allowances of food they should receive, and what presents on certain
festival occasions they should obtain from, or make to the master. On marriages among
themselves, they prostrated themselves before the master and obtained his consent,
which was accompanied with a small present of money and rice. The marriage over, they
again came before the master, who gave them betel nuts, and poured some oil on the
bride’s head. On the master’s death, his head slave immediately shaved his hair and
moustache. There was also a list of offences for which masters might punish slaves,
amongst which the employment of witchcraft, or sending out evil spirits against others,
expressly figures; and the punishments with which each offence might be visited are
specified, the worst of which are branding and flogging with switches. There was no
power of life and death, and in cases of withholding the usual allowance, or of
punishments severer than prescribed, slaves might complain to the authorities.”

On the subject of Koraga slavery, Mr. Ullal Raghvendra Rao writes that “although these
slaves are in a degraded condition, yet they by no means appear to be dejected or
unhappy. A male slave gets three hanis of paddy (unhusked rice) or a hani and a half of
rice daily, besides a small quantity of salt. The female slave gets two hanis of paddy, and,
if they be man and wife, they can easily sell a portion of the rice to procure other
necessaries of life. They are also allowed one cloth each every year, and, besides, when
transferred from one master to another, they get a cocoanut, a jack tree (Artocarpus
integrifolia), and a piece of land where they can sow ten or twenty seers of rice. The
greater number of slaves belong to the Alia Santānam castes (inheritance in the female
line), and among these people a male slave is sold for three pagodas (fourteen rupees)
and a female slave for five pagoda; whereas the few slaves who belong to the Makkala
Santānam castes (inheritance in the male line) fetch five pagodas for the man slave, and
three pagodas for the female. This is because the children of the latter go to the
husband’s master, while those of the former go to the mother’s master, who has the
benefit of the husband’s services also. He has, however, to pay the expenses of their
marriage, which amount to a pagoda and a half; and, in like manner, the master of the
Makkala Santāna slave pays two pagodas for his marriage, and gets possession of the
female slave and her children. The master has the power of hiring out his slave, for
whose services he receives annually about a mura of rice, or forty seers. They are also
mortgaged for three or four pagodas.”

For the marriages of the Koragas, Mr. Walhouse informs us that “Sunday is an
auspicious day, though Monday is for the other slave castes. The bridegroom and bride,
after bathing in cold water, sit on a mat in the former’s house, with a handful of rice
placed before them. An old man presides, takes a few grains of rice and sprinkles on
their heads, as do the others present, first the males and then the females. The
bridegroom then presents two silver coins to his wife, and must afterwards give six
feasts to the community.” At these feasts every Koraga is said to vie with his neighbour
in eating and drinking. “Though amongst the other slave castes divorce is allowed by
consent of the community, often simply on grounds of disagreement, and the women
may marry again, with the Koragars marriage is indissoluble, but a widow is entitled to
re-marriage, and a man may have a second, and even third wife, all living with him.”

Concerning the ceremonies observed on the birth of a child, Mr. Ullal Raghvendra Rao
writes that “after a child is born, the mother (as among Hindoos) is unholy, and cannot
be touched or approached. The inmates take leave of the koppu for five nights, and
depend on the hospitality of their friends, placing the mother under the sole charge of a
nurse or midwife. On the sixth night the master of the koppu calls his neighbours, who
can hardly refuse to oblige him with their presence. The mother and the child are then
given a tepid bath, and this makes them holy. Members of each house bring with them a
seer of rice, half a seer of cocoanut oil, and a cocoanut. The woman with the baby is
seated on a mat—her neighbour’s presents before her in a flat basket. The oldest man
present consults with his comrades as to what name will best suit the child. A black
string is then tied round the waist of the baby. The rice, which comes in heaps from the
neighbours, is used for dinner on the occasion, and the cocoanuts are split into two
pieces, the lower half being given to the mother of the child, and the upper half the
owner. This is the custom followed when the baby is a male one; in case of a female
child, the owner receives the upper half, leaving the lower half for the mother. Koragars
were originally worshippers of the sun, and they are still called after the names of the
days of the week—as Aita (a corruption of Aditya, or the sun); Toma (Sōma, or the
moon); Angara (Mangala); Gurva (Jupiter); Tanya (Shani, or Saturn); Tukra (Shukra, or
Venus). They have no separate temples for their God, but a place beneath a kāsaracana
tree (Strychnos Nux-vomica) is consecrated for the worship of the deity which is
exclusively their own, and is called Kata. Worship in honour of this deity is usually
performed in the months of May, July, or October. Two plantain leaves are placed on the
spot, with a heap of boiled rice mixed with turmeric. As is usual in every ceremony
observed by a Koragar, the senior in age takes the lead, and prays to the deity to accept
the offering and be satisfied. But now they have, by following the example of Bants and
Sudras, exchanged their original object of worship for that of Bhutas (demons).”

On the subject of the religion of the Koragas, Mr. Walhouse states that “like all the slave
castes and lower races, the Koragars worship Mari Amma, the goddess presiding over
small-pox, the most dreadful form of Parvati, the wife of Siva. She is the most popular
deity in Canara, represented under the most frightful form, and worshipped with bloody
rites. Goats, buffaloes, pigs, fowls, etc., are slaughtered at a single blow by an Asādi, one
of the slave tribes from above the ghauts. Although the Koragars, in common with all
slaves, are looked upon as excommunicated and unfit to approach any Brahminical
temple or deity, they have adopted the popular Hindoo festivals of the Gokalastami or
Krishna’s birthday, and the Chowti. In the latter, the preliminaries and prayers must be
performed by a virgin.” Concerning these festivals, Mr. Ullal Raghvendra Rao gives the
following details. “The Koragars have no fixed feasts exclusively of their own, but for a
long time they have been observing those of the Hindus. Of these two are important.
One is Gōkula Ashtami, or the birthday of Krishna, and the other is the Chowti or
Pooliyar feast. The latter is of greater importance than the former. The former is a holy
day of abstinence and temperance, while the latter is associated with feasting and merry-
making, and looks more like a gala-day set apart for anything but religious performance.
On the Ashtami some cakes of black gram are made in addition to the usual dainties. The
services of Bacchus are called in aid, and the master of the koppu invites his relatives
and friends. A regular feasting commences, when the master takes the lead, and enjoys
the company of his guests by seating himself in their midst. They are made to sit on the
floor crosswise with a little space intervening between every guest, who pays strict
regard to all the rules of decency and rank. To keep up the distinction of sexes, females
are seated in an opposite row. The host calls upon some of his intimates or friends to
serve on the occasion. The first dish is curry, the second rice; and cakes and dainties
come in next. The butler Koragar serves out to the company the food for the banquet,
while the guests eat it heartily. If one of them lets so much as a grain of rice fall on his
neighbour’s plate, the whole company ceases eating. The offender is at once brought
before the guests, and charged with having spoiled the dinner. He is tried there and then,
and sentenced to pay a fine that will cover the expenses of another banquet. In case of
resistance to the authority of the tribunal, he is excommunicated and abandoned by his
wife, children and relatives. No one dare touch or speak to him. A plea of poverty of
course receives a kind consideration. The offender is made to pay a small sum as a fine,
which is paid for him by a well-to-do Koragar. To crown the feast, a large quantity of
toddy finds its way into the midst of the company. A small piece of dry areca leaf sewed
together covers the head of a Koragar, and forms for him his hat. This hat he uses as a
cup, which contains a pretty large quantity of liquid. A sufficient quantity is poured into
their cup, and if, in pouring, a drop finds its way to the ground, the butler is sure to
undergo the same penalty that attaches itself to any irregularity in the dinner as described
above. After the banquet, some male members of the group join in a dance to the pipe
and drum, while others are stimulated by the intoxicating drink into frisking and jumping
about. To turn to the other festival. The inmates of the house are required to fast the
previous night—one and all of them—and on the previous day flesh or drink is not
allowed. The next morning before sunrise, a virgin bathes, and smears cowdung over a
part of the house. The place having been consecrated, a new basket, specially made for
the occasion, is placed on that spot. It contains a handful of beaten rice, two plantains,
and two pieces of sugar-cane. The basket is then said to contain the god of the day,
whom the sugar-cane represents, and the spot is too holy to be approached by man or
woman. A common belief which they hold, that the prayers made by a virgin are duly
responded to on account of her virgin purity, does not admit of the worship being
conducted by any one else. The girl adorns the basket with flowers of the forest, and
prays for the choicest blessings on the inmates of the house all the year round.

A Koraga woman, when found guilty of adultery, is said to be treated in the following
extraordinary way. If her paramour is of low caste similar to herself, he has to marry her.
But, in order to purify her for the ceremony, he has to build a hut, and put the woman
inside. It is then set on fire, and the woman escapes as best she can to another place
where the same performance is gone through, and so on until she has been burnt out
seven times. She is then considered once more an honest woman, and fit to be again
married. According to Mr. Walhouse, “a row of seven small huts is built on a river-bank,
set fire to, and the offender made to run over the burning sticks and ashes as a penance.”
A similar form of ordeal has been described as occurring among the Bākutas of South
Canara by Mr. Stuart. “When a man is excommunicated, he must perform a ceremony
called yēlu halli sudodu, which means burning seven villages, in order to re-enter the
caste. For this ceremony, seven small booths are built, and bundles of grass are piled
against them. The excommunicated man has then to pass through these huts one after the
other, and, as he does so, the headman sets fire to the grass” (cf. Koyi). It is suggested by
Mr. R. E. Enthoven that the idea seems to be “a rapid representation of seven existences,
the outcast regaining his status after seven generations have passed without further
transgression. The parallel suggested is the law of Manu that seven generations are
necessary to efface a lapse from the law of endogamous marriage.”

Of death ceremonies Mr. Walhouse tells us that “on death the bodies of all the slave
castes used to be burnt, except in cases of death from small-pox. This may have been to
obviate the pollution of the soil by their carcases when their degradation was deepest,
but now, and from long past, burial is universal. The master’s permission is still asked,
and, after burial, four balls of cooked rice are placed on the grave, possibly a trace of the
ancient notion of supplying food to the ghost of the deceased.” A handful is said192 to be
“removed from the grave on the sixteenth day after burial, and buried in a pit. A stone is
erected over it, on which some rice and toddy are placed as a last offering to the departed
soul which is then asked to join its ancestors.”

“It may,” Mr. Walhouse writes, “be noted that the Koragars alone of all the slave or other
castes eat the flesh of alligators (crocodiles), and they share with one or two other
divisions of the slaves a curious scruple or prejudice against carrying any four-legged
animal, dead or alive. This extends to anything with four legs, such as chairs, tables,
cots, etc., which they cannot be prevailed upon to lift unless one leg be removed. As they
work as coolies, this sometimes produces inconvenience. A somewhat similar scruple
obtains among the Bygas of Central India, whose women are not allowed to sit or lie on
any four-legged bed or stool.” Like the Koragas, the Bākudas of South Canara “will not
carry a bedstead unless the legs are first taken off, and it is said that this objection rests
upon a supposed resemblance between the four-legged cot and the four-legged ox.”193

Of the language spoken by the Koragars, Mr. Ullal Raghvendra Rao states that “it is a
common belief that the Koragar has a peculiar dialect generally spoken by him at his
koppu. He may be induced to give an account of his feasts, his gods, his family, but a
word about his dialect will frighten him out of his wits. Generally polite and well-
behaved, he becomes impolite and unmannerly when questioned about his dialect.” “All
the Hindoos,” Mr. Walhouse writes, “believe that the Koragars have a language of their
own, understood only by themselves, but it seems doubtful whether this is anything
more than an idiom, or slang.” A vocabulary of the Koraga dialect is contained in the
South Canara Manual (1895).

Korama.—See Korava.

Korava.—Members of this nomad tribe, which permeates the length of the Indian
peninsula, through countries where many languages and dialects are spoken, are likely to
be known by different names in different localities, and this is the case. They are known
as Korava from the extreme south to the north of the North Arcot district, where they are
called Koracha or Korcha, and in the Ceded Districts they become Yerukala or Yerakala.
In Calcutta they have been traced practising as quack doctors, and assuming Marātha
names, or adding terminations to their own, which suggest that they belong to a caste in
the south higher in the social scale than they really do. Some Koravas pass for Vellālas,
calling themselves Agambadiar Vellālas with the title Pillai. Others call themselves Palli,
Kavarai, Idaiyan, Reddi, etc.194 As railways spread over the country, they readily
adapted themselves to travelling by them, and the opportunities afforded for going
quickly far from the scene of a recently committed crime, or for stealing from sleeping
passengers, were soon availed of. In 1899, the Superintendent of Government Railways
reported that “the large organization of thieves, commonly called Kepmari Koravas
(though they never call themselves so), use the railway to travel far. Some of them are
now settled at Cuttack, where they have set up as native doctors, whose speciality is
curing piles. Some are at Midnapūr, and are going on to Calcutta, and there were some at
Puri some time ago. It is said that a gang of them has gone recently to Tinnevelly, and
taken up their abode near Sermadēvi, calling themselves Servaikars. One morning, in
Tinnevelly, while the butler in a missionary’s house was attending to his duties, an
individual turned up with a fine fowl for sale. The butler, finding that he could purchase
it for about half the real price, bought it, and showed it to his wife with no small pride in
his ability in making a bargain. But he was distinctly crestfallen when his wife pointed
out that it was his own bird, which had been lost on the previous night. The seller was a
Korava.”

In 1903, a gang of Koravas, travelling in the guise of pūjāris, was arrested at Puri. The
Police discovered that a warrant remained unexecuted against one of them, who had
been concerned in a dacoity case in North Arcot many years previously. The report of the
case states that “cognate with the Kepmaries is a class of Korava pūjāris (as they call
themselves in their own village), who, emanating from one small hamlet in the Tanjore
district, are spread more or less all over India. There are, or were until the other day, and
probably are still some of them in Cuttack, Balasore, Midnapūr, Ahmedabad, Patna,
Bombay, Secunderabad, and other places. One of them attained a high position in
Bombay. Their ostensible profession is that of curing piles and fistulas, but it is
noticeable that, sooner or later after their taking up their abode at any place, the
Kepmaries are to be found somewhere near, and the impression, which is not quite a
certainty but very nearly so, is that they play the convenient rôle of receivers of property
stolen by the Kepmaries.” Kēpmari is regarded as a very strong term of abuse,
indicating, as it does, a rogue of the worst character. In the southern districts, the
Kāsukkar Chettis and Shānāns are said to be very much trusted by the Koravas in the
disposal of property.

It is noted by Mr. H. A. Stuart195 that the Koravas or Yerukalas are a vagrant tribe found
throughout the Presidency, and in many parts of India. In the Telugu country they are
called Yerukalavāndlu or Korachavāndlu, but they always speak of themselves as Kurru,
and there is not the slightest room for the doubt that has been expressed regarding the
identity of the Koravas and Yerukalas. Several derivations of Yerukala have been
proposed by Wilson and others. It has been suggested, for example, that yeru is
connected with erra, meaning red. In Telugu Yerukalavāndlu would mean fortune-tellers,
and Dr. Oppert suggests that this is the origin of the name Yerukala. He says196 “it is
highly probable that the name and the occupation of the fortune-telling Kuruvāndlu or
Kuluvāndlu induced the Telugu people to call this tribe Yerukulavāndlu. Dr. Oppert
further connects Kurru with the root ku, a mountain; and, in a Tamil work of the ninth
century,197 Kurru or Kura (Kuramagal) is given as the name of a hill tribe.” A strong
argument in favour of the caste name being connected with the profession of fortune-
telling is afforded by the fact that women go about the streets, calling out “Yeruko,
amma, yeruku,” i.e., prophecies, mother, prophecies. The Kuravas are, Mr. Francis
writes,198 “a gipsy tribe found all over the Tamil country, but chiefly in Kurnool, Salem,
Coimbatore and South Arcot. Kuravas have usually been treated as being the same as the
Yerukalas. Both castes are wandering gipsies, both live by basket-making and fortune-
telling, both speak a corrupt Tamil, and both may have sprung from one original stock. It
is noteworthy in this connection that the Yerukalas are said to call one another Kurru or
Kura. But their names are not used as interchangeable in the districts where each is
found, and there seem to be no real differences between the two bodies. They do not
intermarry, or eat together. The Kuravas are said to tie a piece of thread soaked in
turmeric water round the bride’s neck at weddings, while Yerukalas use a necklace of
black beads. The Yerukalas have a tradition that those who went to fetch the tāli and pipe
never returned, and they consequently use black beads as a substitute for the tāli, and a
bell for the pipe. The Kuravas worship Subramanya, the son of Siva, while the Yerukalas
worship Vishnu in the form of Venkateswara and his wife Lakshmi. It may be noted that,
in a very early Sanskrit drama, the Brāhman thief mocks Subramanya as being the patron
saint of thieves. The Kuravas treat the gentler sex in a very casual manner, mortgaging or
selling their wives without compunction, but the Yerukalas are particular about the
reputation of their womankind, and consider it a serious matter if any of them return
home without an escort after sunset. The statistics of this year accordingly show
Yerukalas separately from Koravas. The reports from the various districts, however, give
such discrepant accounts of both castes, that the matter is clearly in need of further
enquiry.” There is no district in the Madras Presidency or elsewhere, where both
Koravas and Yerukalas live, unless it be the smallest possible corner of the Coimbatore
district bordering on the south-east of Mysore, for the name Korcha intervenes; and, for
a wide strip of country including the north of the North Arcot district and south of the
Cuddapah district, the Korava is known as a Korcha, and the Census Superintendent, in
common with other authorities, has admitted these names to be synonymous. It is in the
north of the Cuddapah district that the Yerukalas first appear in co-existence with the
Korcha. The Korcha being admitted on all sides to be the same as the Korava, our doubt
regarding the identity of the Korava with the Yerukala will be disposed of if we can
establish the fact that the Korcha and the Yerukala are the same. The Rev. J. Cain,
writing199 about the Yerukalas of the Godāvari district, states that “among themselves
they call each other Kuluvāru, but the Telugu people call them Erakavāru or
Erakalavāru, and this name has been derived from the Telugu word eruka, which means
knowledge or acquaintance, as they are great fortune-tellers.”

Yerukalas.

According to Balfour,200 the Koravas, or a certain section of them, i.e., the Kunchi
Koravas, were known as Yerkal Koravar, and they called the language they spoke Yerkal.
The same authority, writing of the Yerkalwadu, alludes to them as Kurshiwanloo, and
goes on to say that they style themselves Yerkal, and give the same appellation to the
language in which they hold communication. The word Yerkal here undoubtedly stands
for Yerukala, and Kurshi for Korcha. It is evident from this, supported by authorities
such as Wilson, Campbell, Brown and Shortt, that the doubt mentioned by the Census
Superintendent in regard to the identity of the Yerukala and Korava had not arisen when
the Cyclopædia of India was published, and it is the subsequent reports of later
investigators that are responsible for it. The divergencies of practices reported must be
reckoned with, and accounted for. They may be due to local customs existing in widely
separated areas. It is contended that the Koravas and Yerukalas do not intermarry or eat
together. A Korava, who has made a permanent home in a village in the south, if asked
whether he would marry a Yerukala, would most certainly answer in the negative,
probably having never heard of such a person. A circular letter, submitted to a number of
Police Inspectors in several districts, produced the same sort of discrepant information
complained of by the Census Superintendent. But one Inspector extracted from his notes
the information that, in 1895, marriages took place between the southern Koravas of a
gang from the Madura district and the Yerukalas of the Cuddapah district; and, further,
that the son of one of a gang of Yerukalas in the Anantapur district married a Korcha girl
from a gang belonging to the Mysore State. The consensus of opinion also goes to prove
that they will eat together. Yerukalas undoubtedly place a string of black beads as a tāli
round the bride’s neck on marriage occasions, and the same is used by the Koravas.
Information concerning the use of a turmeric-dyed string came from only one source,
namely, Hosūr in the Salem district, and it was necessary even here for the string to be
furnished with a round bottu, which might be a bead. A plain turmeric-soaked thread
appears to be more the exception than the rule. Yerukalas are both Vaishnavites and
Saivites, and a god worshipped by any one gang cannot be taken as a representative god
for the whole class. Yerukalas may treat their womankind better than the southern
Koravas, but this is only a matter of degree, as the morals of both are slack. The
Yerukalas, occupying, as they do, the parched centre of the peninsula, more frequently
devastated by famine than the localities occupied by the Koravas, may have learnt in a
hard school the necessity of taking care of their wives; for, if they allowed them to pass
to another man, and a drought ruined his crop and killed the cattle, he would find it hard
to procure another, the probability being that the price of wives rises in a common ratio
with other commodities in a time of scarcity.

From the accounts given by them, it appears that the Koravas claim to have originated in
mythological ages. The account varies slightly according to the locality, but the general
outlines agree more or less with the story related in the Bhāgavātham. The purōhits, or
priests, are the safest guides, and it was one of them who told the following story, culled,
as he admitted, from the Sāstras and the Rāmāyana. When the great Vēnudu, son of
Agneswathu, who was directly descended from Brahma, ruled over the universe, he was
unable to procure a son and heir to the throne, and, when he died, his death was looked
on as an irreparable misfortune. His body was preserved. The seven ruling planets sat in
solemn conclave, and consulted as to what they should do. Finally they agreed to create
a being from the right thigh of the deceased Vēnudu, and they accordingly fashioned and
gave life to Nishudu. But their work was not successful, for Nishudu turned out to be not
only deformed in body, but repulsively ugly in face. It was agreed at another meeting of
the planets that he was not a fit person to be placed on the throne. So they set to work
again, and created a being from the right shoulder of Vēnudu, and their second effort
was crowned with success. They called the second creation Proothu Chakravarthi, and,
as he gave general satisfaction, he was placed on the throne. This supersession naturally
caused the first-born Nishudu to be discontented, and he sought a lonely place, in which
he communed with the gods, begging of them the reason why they had created him if he
was not to rule. The gods explained that he could not now be placed on the throne, as
Chakravarthi had already been installed, but that he should be a ruler over forests. In this
capacity Nishudu begat the Bōyas, Chenchus, Yānādis, and Koravas. The Bōyas were
his legitimate children, but the others were all illegitimate. It is because Nishudu
watched in solemn silence to know his creator that some of his offspring called
themselves Yerukalas (yeruka, to know). Another story explains the name Korava. When
the princes Dharmarāja and Duryodana were at variance, the former, to avoid strife, went
into voluntary exile. A woman who loved him set out in search of him, but, through fear
of being identified, disguised herself as a fortune-teller. In this manner she found him,
and their offspring became known as Koravas, from kuru, fortune-telling.

The appellation Koracha or Korcha appears to be of later date than Korava, and is said to
be derived from the Hindustani kori (sly), korri nigga (sly look) becoming corrupted into
Korcha. Whenever this name was applied to them, they had evidently learnt their calling
thoroughly, and the whole family, in whatever direction its branches spread, established
a reputation for cunning in snaring animals or birds, or purloining other peoples’ goods,
until to-day their names are used for the purpose of insulting abuse in the course of a
quarrel. Thus a belligerant might call the other a thieving Yerukala, or ask, in tones other
than polite, if he belongs to a gang of Korchas. In the Tamil country, a man is said to
kura-kenju, or cringe like a Korava, and another allusion to their dishonesty is
kurapasāngu, to cheat like a Korava. The proverb “Kuruvan’s justice is the ruin of the
family” refers to the endless nature of their quarrels, the decision of which will often
occupy the headmen for weeks together.

In communicating among themselves, the Koravas and Yerukalas speak a corrupt


polyglot, in which the words derived from several languages bear little resemblance to
the original. Their words appear to be taken chiefly from Tamil, Telugu, and Canarese. A
short vocabulary of the Yerukala language has been published by the Rev. J. Cain.201
The Yerukalas call this language Oodra, which seems to stand for gibberish or thieves’
slang, or, as they explain, something very hard to understand. Oriya or Oodra is the
language of the districts of Ganjam and Orissa. The word Oriya means north, and the
fact that the Yerukalas call their language Oodra would seem to confirm their belief that
they are a northern tribe. The wanderers always know more than one language
colloquially, and are able to make themselves understood by the people of the country
through which they may be passing. Those who have settled in villages invariably speak
the language of the locality. When talking among themselves, they call a Brāhman
Thanniko Koravan, or the bathing Korava. They consider the Brāhmans to be more
cunning than themselves, and, as they are fond of bathing to remove pollution, they have
given them this nickname.

Korava.

A detailed account of the Korava slang and patois has been published by Mr. F. Fawcett,
Deputy Inspector-General of Police,202 from whose note thereon the following examples
are taken:—
Constable Erthalakayadu. Red-headed man.
Head constable Kederarilu. The man who rides on an ass.
Taking bribe Kalithindrathu. Eating rāgi food.
Toddy Uggu perumalu ollaithanni. White water, or good water.
Fowls Rendukal Naidu. The Naidu of two legs.
Mussalmans Arthupottavungo. Those who have cut (circumcised).
Pariah Ūtharalu keenjalu. The man that pipes.
Butcher’s knife Elamayarathe bottarathu. That for striking those that graze leaves.
Rupees Pālakanna. Milk eyes.
Ollakelluka. White pebbles.

Korava society is purely patriarchal, and, in whatever division or sept of the caste a
Korava may be born, he has to subordinate himself to the will of his elders or the leaders
of his particular gang. The head of a gang is called the Peru Manusan or Beriya Manasan
(big man). He is selected principally because of his age, intelligence, and the influence
he commands amongst the members of the gang. It is a post which carries with it no
remuneration whatever, but the holder presides at all consultations, and is given the
position of honour at all social functions.

Concerning the caste government, Mr. Fawcett writes that “the kulam or caste assembly
adjudicates claims, inflicts penalties, ejects individuals from the caste, or readmits them
thereto. Free drinking of toddy at the expense of one of the parties accompanies every
caste assembly. It is the aggrieved party who gives notice for assembly of the kulam. The
disputants join hands, thereby indicating to the kulam that their dispute should be
decided by them. Each pays one rupee. The kulam may decide the dispute at once, or
adjourn for further consideration at any time. The next meeting is called the second
joining of hands, when each pays one rupee, as before, to be spent in toddy. A man who
fails to attend when the kulam has been convened loses his caste absolutely. If there is a
third adjournment, that is a third joining of hands, each side pays Rs. 3½ for toddy, to
keep the kulam in good spirits. As this is always the final adjournment, the decision is
sometimes arrived at by means of an ordeal. An equal quantity of rice is placed in two
pots of equal weight having a quantity of water, and there is an equal quantity of
firewood. The judges satisfy themselves most carefully as to quantity, weights, and so
on. The water is boiled, and the man whose rice boils first is declared to be the winner of
the dispute. The loser is to recoup the winner all his expenses. It sometimes happens that
both pots boil at the same time; then a coin is to be picked out of a pot containing boiling
oil. There is yet another method of settling disputes about money. The amount claimed is
brought by one party, and placed beside an idol. The claimant is then asked to take it,
and, should nothing unpleasant happen to him or to his family afterwards, he is declared
to have made out his claim. The kulam has nothing whatever to do with planning the
execution of offences, but is sometimes called upon to decide about the division of
plunder, as, for instance, when any member of a criminal expedition improperly secretes
something for himself. But they engage vakils (pleaders) for defending members of the
gang who are charged with a criminal offence, whether they have been concerned in it or
not.”

There are a great many classes of Koravas, most of them obtaining their names from the
particular occupations they have followed as an ostensible means of livelihood for many
generations. But, whatever they may call themselves, they all, according to Mr.
Mainwaring, fall within three divisions, viz.:—

1. Sakai, Sampathi, Sāthupadi.


2. Kāvadi or Gujjula.
3. Dēvarakonda, Mendrakutti, or Menapadi.

The members of the first two divisions are pure Koravas, the legitimate descendants of
Koravas who have never married outside the caste, whereas the third division represents
and includes the mixed marriages, and the offspring thereof. The Koravas receive into
their ranks members of castes other than Paraiyans (including Mālas and Mādigas),
Yānādis, Mangalas, and Tsākalas. The ceremony of introduction into the Korava
community consists in burning the tongue with a piece of gold. The Koravas have a
strong objection to taking food touched by Mēdaras, because, in their professional
occupation of doing wicker-work, they use an awl which resembles the tool used by
Mādigas in shoe-making. The Koravas are said to be divided into two large families,
which they call Pōthu and Pēnti, meaning male and female. All the families included in
the first division noted above are Pōthu, and those in the second Pēnti. The families in
the third division, being the product of mixed marriages, and the position of females
being a lowly one, they are also considered to be Pēnti. The Pōthu section is said to have
arisen from men going in search of brides for themselves, and the Pēntis from men going
in search of husbands for their daughters. When a Korava, male or female, wishes to
marry, a partner must be sought in a division other than their own. For example, a
Korava of the first division is bound to marry a female belonging to the second or third
division, who, after marriage, belongs to her husband’s division. This may be a little
hard on the women of the first division, because they are bound to descend in the social
scale. However, their daughters can rise by marrying into the first division. For the
purpose of religious ceremonies, each division has fixed duties. The members of the first
division have the right of decorating the god, and dressing him in his festival attire.
Those of the second division carry the god and the regalia in procession, and burn
incense, and those of the third drag the temple car, and sing and shout during its
progress. For this reason, it is said, they are sometimes called Bandi (cart).

“The major divisions,” Mr. Paupa Rao Naidu writes, “are four in number, and according
to their gradation they are Sāthepāti, Kāvadi, Mānapāti, Mendragutti. They are all
corrupted Tamil words.

“1. Sāthepāti is a corruption of Sāthupādi, which means adorning a Hindu deity with flowers,
jewels and vestments.

“2. Kāvadi, meaning a pole carried on the shoulders with two baskets pendant from its ends, in
which are contained offerings for a deity or temple.

“3. Mānapāti is a corruption of Mānpadi, which means singing in praise of god, when He is
worshipped in a temple.

“4. Mendragutti is a corruption of Menrikutti, which means stitching a pair of shoes, and
presenting them to the temple—a custom still prevalent at Tirupati and other important shrines.

“Of these four divisions, the first two are, or rather were, considered superior to the other two, a
Kāvadi man being styled Pōthuvādu (man), and a Sāthepāti man Pēnti (female).”

A still further classification of divisions and sub-divisions is given by Mr. F. S.


Mullaly.203 I am informed by Mr. C. Hayavadana Rao that, in the Vizagapatam district,
the Yerukalas are divided into Pattapu or Oddē, and Thurpu (eastern). Of these, the
former, when they are prosperous, live in tiled houses, while the latter live in huts.
Pattapu women wear brass bangles on both wrists, and Thurpu women brass bangles on
the right wrist, and glass bangles on the left. The former throw the end of their cloth over
the left shoulder, and the latter over the right.

It is recorded, in the Gazetteer of the Trichinopoly district, that “the Kuravans are
divided into a number of endogamous sections, of which the Īna Kuravans and the
Kāvalkāran Kuravans are the most criminal, especially the latter. The latter are also
called the Marasa, Mondu, and Kādukutti Kuravans. In dress and appearance the
Nāmakkal Kuravans are said to be superior to those of Karūr, and to look like well-
dressed Vellālans or Pallis. They are peculiar in wearing long ear-rings. They are also
said to be much better thieves than the others, and to dislike having a Karūr Kuravan
when breaking into a house, for fear he might wake the household by his clumsiness.”

As examples of intipēru, or exogamous septs, the following, which were given by Uppu
Yerukalas, may be cited:—

Dāsari, Vaishnavite mendicant. Mogili (Pandanus fascicularis)


Sukka, star. Uyyāla, swing.
Kampa, bush of thorns. Rāgala, rāgi grain.
Āvula, cows. Pūla, flowers.
Thoka, tail. Katāri, dagger.
Kānaga (Pongamia glabra). Ambojala, lotus.
Bandi, cart. Samudrāla, sea.
Gajjala, small bell. Venkatagiri, a town.

“A knowledge,” Mr. Fawcett writes, “of these house or sept names may be useful in
order to establish a man’s identity, as a Koravar, who is generally untruthful as to his
own name, is seldom if ever so as regards his house or sept name, and his father’s name.
He considers it shameful to lie about his parentage, ‘to be born to one, and yet to give
out the name of another.’ Totemism of some kind evidently exists, but it is rather odd
that it has not always any apparent connection with the sept or house name. Thus, the
totem of persons of the Konēti sept is horse-gram (kollu in Tamil), which they hold in
veneration, and will not touch, eat, or use in any way. The totem of the Samudrāla sept is
the conch shell, which likewise will not be used by those of the sept in any manner. It
may be noted that persons of the Ramēswari sept will not eat tortoises, while those of the
Konēti sept are in some manner obliged to do so on certain occasions.”

As regards names for specific occupations among the Koravas, the Bīdar or nomad
Koravas originally carried merchandise in the form of salt, tamarinds, jaggery (crude
sugar or molasses), leaves of the curry leaf plant (Murraya Kœnigii) from place to place
on pack-bullocks or donkeys. The leaves were in great demand, and those who brought
them round for sale were called in Tamil Karuvaipillai, and in Telugu Karepāku, after the
commodity which they carried. This is a common custom in India, and when driving
through the bazār, one may hear, for example, an old woman carrying a bundle of wood
addressed as firewood. “Kāvadi” will be screamed at a man carrying a pole (kāvadi) with
baskets, etc., suspended from it, who got in the way of another. The section of Koravas
who carried salt inland from the coast became known as Uppu (salt) Koravas. Another
large class are the Thubba, Dhubbai, or Dhabbai (split bamboo) Koravas, who restrict
their wanderings to the foot of hill ranges, where bamboos are obtainable. With these
they make baskets for the storage of grain, for carrying manure at the bottom of carts,
and various fancy articles. In the Kurnool district, the Yerukalas will only cut bamboos
at the time of the new moon, as they are then supposed to be free from attacks by boring
weevils, and they do certain pūja (worship) to the goddess Malalamma, who presides
over the bamboos. In the Nallamalai forests, the Yerukalas do not split the bamboo into
pieces and remove the whole, but take off only a very thin strip consisting of the outer
rind. The strips are made up into long bundles, which can be removed by donkeys. There
is extreme danger of fire, because the inner portions of the bamboos, left all over the
forest, are most inflammable.204 Instead of splitting the bamboos in the forest, and
leaving behind a lot of combustible material, the Yerukalas now have to purchase whole
bamboos, and take them outside the forest to split them. The members of a gang of these
Yerukalas, who came before me at Nandyāl, were each carrying a long split bamboo
wand as an occupational insigne. A further important section is that of the Kunchu or
Kunchil Koravas, who gather roots in the jungle, and make them into long brushes
which are used by weavers. The Koravas have a monopoly in their manufacture, and
take pride in making good brushes. These Kunchu Koravas are excellent shikāris
(hunters), and snare antelope, partridges, duck, quail, and other game with great skill.
For the purpose of shooting antelopes, or of getting close enough to the young ones to
catch them after a short run, they use a kind of shield made of dried twigs ragged at the
edges, which looks like an enormous wind-blown bundle of grass. When they come in
sight of a herd of antelopes, they rest one edge of the shield on the ground, and, sitting
on their heels behind it, move it slowly forward towards the herd until they get
sufficiently close to dash at the young ones, or shoot the grown-up animals. The
antelopes are supposed to mistake the shield for a bush, and to fail to notice its gradual
approach. They capture duck and teal largely at night, and go to the rice fields below a
tank (pond or lake), in which the crop is young, and the ground consequently not entirely
obscured. This would be a likely feeding-ground, or traces of duck having fed there on
the previous night might be noticed. They peg a creeper from one bund (mud
embankment) to another, parallel to the tank bund, four inches above the water in the
field. From this they suspend a number of running loops made of sinews drawn from the
legs of sheep or goats or from the hind-legs of hares, the lower ends of the loops
touching the mud under water. If the duck or teal come to feed, they are sure to be
caught, and fall victims to the slip noose. “The Kuntsu (Kunchu) Korachas,” Mr. Francis
tells us,205 “catch small birds by liming twigs or an arrangement of bits of bamboo with
a worm hung inside it, or by setting horse-hair nooses round the nests. Quails they
capture by freely snaring a piece of ground, and then putting a quail in a cage in the
middle of it, to lure the birds towards the snare. They also catch them, and partridges
too, by driving the bevy towards a collapsible net. To do this, they cover themselves with
a dark blanket, conceal their heads in a kind of big hat made of hair, feathers and grass,
and stalk the birds from a bullock trained to the work, very gradually driving them into
the net. They also occasionally capture black-buck (antelope) by sending a tame buck
with nooses on his horns to fight with a wild one. The latter speedily gets his horns
entangled in the nooses, and is easily secured.” Sometimes the Kunchu Korava begs in
villages, dragging about with him a monkey, while the females earn a livelihood by
tattooing, which occupation, known as pricking with green, has gained for them the
name of Pacchai (green) Kutti. The patterns used in tattooing by a Korava woman,
whom I interviewed, were drawn in a note-book, and consisted of fishes, scorpions, a
fortress, five-storeyed house, conventional designs, etc. The patterns were drawn on the
skin, with great dexterity and skill in freehand drawing, by means of a blunt stick dipped
in a mixture of a lamp-black, lamp-oil, and turmeric contained in a half cocoanut shell.
The pattern is pricked in with a bundle of four or five needles tied together. The needles
and drawing-stick were kept in a hollow bamboo, and the tattooing mixture in the
scooped out fruits of the bael (Ægle Marmelos) and palmyra palm (Borassus flabellifer).
For tattooing an entire upper extremity, at several sittings, the Korava woman would be
paid from eight to twelve annas, or receive food-grains in lieu of money. The hot
weather is said to be more favourable for the operation than the cold season, as the
swelling after it is less. To check this, lamp-oil, turmeric, and leaves of the avarai plant
(Dolichos Lablab) are applied.

Concerning the Pacchaikuttis, or, as they are also called, Gadde (soothsayers), Mr. Paupa
Rao Naidu writes that “the women start with a basket and a winnowing basket or tray
into a village, proclaiming their ostensible profession of tattooing and soothsaying,
which they do for grain or money. When unfortunate village women, who always lose
children or who often fall ill, see these Gadde women moving about, they call them into
their houses, make them sit, and, pouring some grain into their baskets, ask them about
their past misery and future lot. These women, who are sufficiently trained to speak in
suitable language, are clever enough to give out some yarns in equivocal terms, so that
the anxious women, who hope for better futurity, understand them in the light uppermost
in their own minds. The Korava women will be rewarded duly, and doubly too, for they
never fail to study the nature of the house all the time, to see if it offers a fair field for
booty to their men.”

At Srungavarapukōta in the Vizagapatam district “the local goddess, Yerakamma, is a


deification of a woman who committed sati. Ballads are sung about her, which say that
she was the child of Dāsari parents, and that her birth was foretold by a Yerukala woman
(whence her name) who prophesied that she would have the gift of second sight. She
eventually married, and one day she begged her husband not to go to his field, as she
was sure he would be killed by a tiger if he did. Her husband went notwithstanding, and
was slain as she had foreseen. She committed sati on the spot where her shrine still
stands.”206

The Ūr or village Koravas have given up their nomad life, and settled in villages of their
own, or together with other communities. Many of them have attended pial schools, and
can read and write to some extent. Some of them are employed in the police and salt
departments, as jail warders, etc. The Ūr Korava is fast losing his individuality, and
assimilating, in dress, manners and customs, the ryots among whom he dwells. In the
Salem district there is a village called Koravūr, which is inhabited entirely by Koravas,
who say that they were originally Uppu Koravas, but now cultivate their own lands, or
work as agricultural labourers for the land-owners. They say further that they pay an
occasional visit to Madras for the purpose of replenishing their stock of coral and beads,
which they sell at local shandis (markets). Some Koravas are said to buy gilded beads at
Madura, and cheat unsuspecting villagers by selling them as gold. Though the Ūr
Koravas are becoming civilised, they have not yet lost their desire for other men’s goods,
and are reported to be the curse of the Anantapur, Cuddapah, and Bellary districts, where
they commit robbery, house-breaking, and theft, especially of sheep and cattle. A
particularly bold sheep theft by them a few years ago is worthy of mention. The village
of Singanamalla in the Anantapur district lies a few miles off the railway. It is bordered
on two sides by Government forest reserves, into which the villagers regularly drove
their sheep and goats to graze, in charge of small boys, in the frequent absences of the
forest watcher, or when the watcher was well disposed towards them. An arrangement
was made between the Koravas and a meat-supplier at Bangalore to deliver on his behalf
a large number of sheep at a wayside station near Dharmāvaram, to receive which trucks
had to be ready, and the transaction was purely cash. One morning, when more than a
hundred sheep had been driven far into the reserve by their youthful charges, who kept
more or less close together for the sake of company, a number of Koravas turned up, and
represented themselves as forest watchers, captured the small boys, gagged them and
tied them to trees, and drove off all the available sheep. The boys were not discovered
till late at night, and the police did not get to work till the following morning, by which
time the sheep were safely entrained for Bangalore.

It is noted, in the Madras Police Report, 1905–1906, that “a large number of members of
the notorious Rudrapād Koracha gangs have recently been released from His Highness
the Nizam’s prisons, and their return will add appreciably to the difficulties of the
Bellary Police.”

A small class of Koravas is named Pāmula (snake), as they follow the calling of snake-
charmers. In the Census Report, 1901, Pūsalavādu (seller of glass beads) and Utlavādu
(makers of utlams) are given as sub-castes of Yerukala. An utlam is a hanging receptacle
for pots, etc., made of palmyra fibre. In the same report, Kādukuttukiravar (those who
bore a hole in the ear) and Valli Ammai Kūttam (followers of the goddess Valli Ammai)
are returned as synonyms of Koravas. They claim that Valli Ammai, the wife of the god
Subrahmanya, was a Korava woman. Old Tamil books refer to the Koravas as fortune-
tellers to kings and queens, and priests to Subrahmanya. Some Koravas have, at times of
census, returned themselves as Kūdaikatti (basket-making) Vanniyans. Balfour refers to
Walaja Koravas, and states that they are musicians. They are probably identical with the
Wooyaloo Koravas,207 whose duty it is to swing incense, and sing before the god during
a religious celebration. The same writer speaks of Bajantri or Sonai Kolawaru and Kolla
and Soli Korawars, and states that they inhabit the Southern Marātha country. These
names, like Thōgamallai for Koravas who come from the village of that name in the
Trichinopoly district, are probably purely local. Further, the Abbé Dubois states that “the
third species of Kuravers is generally known under the name of Kalla Bantru, or robbers.
The last Muhammadan prince who reigned over Mysore is said to have employed a
regular battalion of these men in time of war, not for the purpose of fighting, but to infest
the enemy’s camp in the night, stealing away the horses and other necessaries of the
officers, and acting as spies. They were awarded in proportion to the dexterity they
displayed in these achievements, and, in time of peace, they were despatched into the
various States of neighbouring princes, to rob for the benefit of their masters.” It is
possible that the Kaikadis of the Central Provinces are identical with Koravas, who have
migrated thither.
A section of Koravas, called Koot (dancing) or Kōthee (monkey) Kaikaries, is referred to
by Mr. Paupa Rao Naidu as “obtaining their living by prostitution. They also kidnap or
sell children for this purpose. Some of the women of this class are thriving well in the
Madras Presidency as experts in dancing. They are kept by rich people, and are called in
the Telugu country Erukala Bōgamvaru, in Tamil Korava Thevidia. They also train
monkeys, and show them to the public.”

The household god of the Korava, which is as a rule very rudely carved, may be a
representation of either Vishnu or Siva. As already noted, it is stated in the Census
Report, 1901, that the Koravas worship Subrahmanya, the son of Siva, while the
Yerukalas worship Vishnu in the form of Venkatēswara and his wife Lakshmi. They
worship, in addition to these, Kolāpuriamma, Perumālaswāmi, and other appropriate
deities, prior to proceeding on a depredatory expedition. Kolāpuriamma is the goddess of
Kolhapūr, the chief town of the Native State of that name in the Bombay Presidency,
who is famous in Southern India. Perumālswāmi, or Venkatēswara, is the god of
Tirupati, the great place of pilgrimage in the North Arcot district. The signs of a recent
performance of worship by Koravas may prove an indication to the Police that they have
been concerned in a dacoity, and act as a clue to detection thereof. They sacrifice sheep
or goats once a year to their particular god on a Sunday or Tuesday, while those who
worship Venkatēswara honour him on a Saturday, and break cocoanuts as an offering.
All offerings presented to the gods are divided among those present, after the ceremonies
have been completed. Venkatēswara is said to be sometimes represented, for the purpose
of worship, by a brass vessel (kalasam) decorated with flowers, and bearing on it the
Vaishnavite nāmam (sect mark). Its mouth is closed by a cocoanut, beneath which
mango or betel leaves are placed. On the day appointed for the religious service,
everything within the hut is thrown outside, and the floor is purified with cow-dung, and
devices are drawn thereon. The brass vessel is set up, and offerings of large quantities of
food are made to it. Some of this dedicated food (prasādam) must be given to all the
inhabitants of the settlement. A lump of clay, squeezed into a conical shape, with a tuft of
margosa (Melia Azadirachta) leaves does duty for Pōlēramma. In front thereof, three
stones are placed. Pōlēramma may be worshipped close to, but not within, the hut. To
her offerings of boiled rice (pongal) are made by fasting women. The manner in which
the boiling food bubbles over from the cooking-pot is eagerly watched, and accepted as
an omen for good or evil. In a note on the Coorroo, Balfour states208 that “they told me
that, when they pray, they construct a small pyramid of clay, which they term
Māriamma, and worship it. The women had small gold and silver ornaments suspended
from cords round their necks, which they said had been supplied to them by a goldsmith,
from whom they had ordered figures of Māriamma. The form represented is that of the
goddess Kāli. They mentioned that they had been told by their forefathers that, when a
good man dies, his spirit enters the body of some of the better animals, as that of a horse
or cow, and that a bad man’s spirit gives life to the form of a dog or jackal, but they did
not seem to believe in it. They believe firmly, however, in the existence and constant
presence of a principle of evil, who, they say, frequently appears, my informant having
himself often seen it in the dusk of the evening assuming various forms, at times a cat,
anon a goat, and then a dog, taking these shapes that it might approach to injure him.”

The domestic god of the Koravas, in the southern districts, is said to be Sathavu, for
whom a day of worship is set apart once in three or four years. The Koravas assemble,
and, in an open place to the west of the village, a mud platform is erected, on which
small bricks are spread. In front of the platform are placed a sickle, sticks, and arrack
(liquor). Cocoanuts, plantain fruits, and rice are offered, and sheep sacrificed. Sandal and
turmeric are poured over the bricks, and camphor is burnt. The proceedings terminate
with a feast.

The presiding goddess of the criminal profession of the Koravas is stated by Mr. M.
Paupa Rao Naidu209 to be Moothēvi, the goddess of sleep, whom they dread and
worship more than any other god or goddess of the Hindu Pantheon. The object of this
worship is twofold, one being to keep themselves vigilant, and the other to throw their
victims off their guard. Moothēvi is invoked in their prayers to keep them sleepless
while on their nefarious purpose bent, but withal to make their victims sufficiently
sleepy over their property. This goddess is worshipped especially by females, who
perform strange orgies periodically, to propitiate her. A secluded spot is preferred for
performing these orgies, at which animal sacrifices are made, and there is distribution of
liquor in honour of the goddess. The Edayapatti gang worship in addition the deity
Ratnasabhapathy at Ayyamala. When prosecuted for a crime, the Koravan invokes his
favourite deity to let him off with a whipping in the words ‘If the punishment of
whipping be inflicted I shall adore the goddess.’

The following account of a peculiar form of human sacrifice by the Koravas in former
days was given to Mr. C. Hayavadana Rao by an old inhabitant of the village of Āsūr
near Walajabad in the Chingleput district. A big gang settled at the meeting point of the
three villages of Āsūr, Mēlputtūr, and Avalūr, on an elevated spot commanding the
surrounding country. They had with them their pack-bullocks, each headman of the gang
owning about two hundred head. The cow-dung which accumulated daily attracted a
good many of the villagers, on one of whom the headmen fixed as their intended victim.
They made themselves intimate with him, plied him with drink and tobacco, and gave
him the monopoly of the cow-dung. Thus a week or ten days passed away, and the
Koravas then fixed a day for the sacrifice. They invited the victim to visit them at dusk,
and witness a great festival in honour of their caste goddess. At the appointed hour, the
man went to the settlement, and was induced to drink freely. Meanwhile, a pit, large
enough for a man to stand upright in it, had been prepared. At about midnight, the victim
was seized, and forced to stand in the pit, which was filled in up to his neck. This done,
the women and children of the gang made off with their belongings. As soon as the last
of them had quitted the settlement, the headmen brought a large quantity of fresh cow-
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like