Project File Major Project Sandy2 PDF
Project File Major Project Sandy2 PDF
ON
ADVENTURE GAME IN PYTHON
Submitted in the partial fulfillment of requirement for the award of the
Diploma of
COMPUTER ENGINEERING
SUBMITTED BY
Gharuan Gharuan
The Project work is a task which cannot be done by an individual in isolation. I have no
exception to this rule and have gratefully accepted the helping hand offered by many.
We express my deep gratitude and indebtedness to Dr. Gurmeet Singh Swag (Principal
Chandigarh Polytechnic College Gharuan) and Chandigarh Polytechnic College for
providing us such a platform, infrastructure and learning environment.
SANDEEP MISHRA
SUMIT KUMAR
Adventure games focus on puzzle solving within a narrative framework, generally with
few or no action elements. Other popular names for this genre are “graphic adventure”
or “point-and-click adventure”, but these represent only part of a much broader,
diverse range of games.
But labels can only take us so far. Many games push traditional genre boundaries in
new and interesting ways while still remaining adventure games at their
core. Dreamfall, sequel to the point-and-click classic The Longest Journey, includes
some stealth and fight scenes. Heavy Rain is a new breed of interactive movie-style
adventuring featuring motion controls and Quick Time Events. At the other end of the
spectrum, titles like Mystery Case Files: Dire Grove mix in plenty of Where’s Waldo?-
styled scavenger hunts. Even Portal, which gives you a gun to solve physics-based
puzzles instead of killing, has a right to be called an adventure.
Of course, stories, puzzles, and exploration are not limited to just adventures. More
and more games outside the genre are incorporating adventure game elements,
like Scribblenauts, Braid and Limbo. Given their shared features, we will sometimes
cover these as special “games of interest”, though always with the understanding that
they fall outside the scope of our adventure game definition.
Certificate__________________________________________________________2
Acknowledgements__________________________________________________ 3
Abstract___________________________________________________________ 4
List of Figures______________________________________________________ 6
Chapter No.1_______________________________________________________8
2. Introduction to games__________________________________________16
Chapter No 2 _____________________________________________________18
1. Familiarization to project______________________________________19
Chapter No 3_____________________________________________________26
2. Technology______________________________________________28
Conclusion___________________________________________________29
References___________________________________________________42
List of Figures
INTRODUCTION TO PYTHON
Here is the sample run of the first python programming example. This is the initial
output.
Now let's re-run the above example, and this time, type x as shown
in below screenshot:
The Python Package Index (PyPI) contains numerous third-party modules that make
Python capable of interacting with most of the other languages and platforms.
Python provides a large standard library which includes areas like internet protocols,
string operations, web services tools and operating system interfaces. Many high use
programming tasks have already been scripted into the standard library which reduces
length of code to be written significantly.
Further, its development is driven by the community which collaborates for its code
through hosting conferences and mailing lists, and provides for its numerous modules.
Python offers excellent readability and uncluttered simple-to-learn syntax which helps
beginners to utilize this programming language. The code style guidelines, PEP 8,
provide a set of rules to facilitate the formatting of code. Additionally, the wide base
of users and active developers has resulted in a rich internet resource bank to
encourage development and the continued adoption of the language.
Python has built-in list and dictionary data structures which can be used to construct
fast runtime data structures. Further, Python also provides the option of dynamic high-
level data typing which reduces the length of support code that is needed.
This should give people an idea of how big this industry has become. The first game had
just a ball like figure bouncing between two platforms. Over the last five decades, gaming
has grown into a giant powerhouse of entertainment and self-perpetuating revenue. We have
come a long way as today, complete worlds have started to exist within machines that have
become more powerful and efficient than ever before. As Personal computers get more
The games can never be ignored by anyone as it really the matter of importance. It makes
people mentally alert and physically active. They can be more disciplined, healthy, active,
and punctual and can easily cope with any difficult situation in their personal and
professional life. Being involved in the games regularly helps to easily overcome from the
anxiety, tension and nervousness. It helps to keeps mind peaceful, sharp, and active with
improved concentration.
CHAPTER – 2
FAMILIARIZATION TO PROJECT
In video game culture, an adventure game is a video game in which the player
literary genres. Levels or character statistics that could be improved over the course of
the game.
Adventure games contain a variety of puzzles, decoding messages, finding and using
items, opening locked doors, or finding and exploring new locations. Solving a puzzle
will unlock access to new areas in the game world, and reveal more of the game story.
Some puzzles are criticized for the obscurity of their solutions, for example, the
combination of a clothes line, clamp, and deflated rubber duck used to gather a key
stuck between the subway tracks in The Longest Journey, which exists outside of the
game's narrative and serves only as an obstacle to the player. Others have been
criticized for requiring players to blindly guess, either by clicking on the right pixel,
or by guessing the right verb in games that use a text interface. Games that require
players to navigate mazes have also become less popular, although the earliest text-
adventure games usually required players to draw a map if they wanted to navigate
the abstract space.
Collecting Powerups.
An adventure game is a video game in which the player assumes the role of a
protagonist in an interactive story driven by exploration and puzzle-solving. The
genre's focus on story allows it to draw heavily from other narrative-based media,
literature and film, encompassing a wide variety of literary genres. Many adventure
games (text and graphic) are designed for a single player, since this emphasis on story
and character makes multi-player design difficult. This game is created using python
because Python is an object-oriented, high-level programming language with
integrated dynamic semantics primarily for web and app development. It is extremely
attractive in the field of Rapid Application Development because it offers dynamic
typing and dynamic binding options.
Python is relatively simple, so it's easy to learn since it requires a unique syntax that
focuses on readability. Developers can read and translate Python code much easier
Creating a narrative
Our game needs two things: a story to keep the player entertained, and logic to control
how the story unfolds. For our story we're creating the world of Narule, where magic
and adventure are around every corner. And we're creating a hero – you – who must
travel the land, visiting new villages and settlements, and talking to people to learn
more about this land and the dark shadow cast upon it.
To start our project off, we've created some narrative for you to expand upon. Feel
free to make the story your own.
Python is a really great language to learn because it is very easy to understand, and
once you master the concepts of programming logic with Python, you will be well on
your way to developing larger applications.
No matter what language you use, the underlying concepts of coding provide a firm
foundation that can be used across many languages. The main concepts are:
Sequences
A series of tasks required to be completed in a certain order. For example, the steps
needed to solve a maze.
Loops
A way to repeat a sequence. Can be run for ever (while True) or controlled using a for
statement (for x in range(0,3)).
Parallelism
Events
An event is a trigger that starts a sequence of code, and the most visible event in the
game we're creating is entering the name of our hero to start the game.
Data
We use a variable to store the value of our hero's name, and then we can later retrieve
and manipulate the variable to show the player's name throughout the game,
personalising the gaming experience.
Conditionals form the basis of our logic, and they provide a method for us to compare
data against the input given by the player. We used conditionals in our game to
compare the answer given to the expected answer. If they matched, in Boolean logic
this would be classed as TRUE.
Operators
These are the basic mathematical rules that we learned back in school. We can apply
operators to text and numbers, which enables us to perform calculations in our code
and iterate data if required.
IDLE has two windows to work with: the editor, containing our code, and a shell,
where our game is played. To launch the game, in the editor click on 'Run', then 'Run
Module'.
The shell window appears in front of every other window and our game starts to play.
2. Import modules
Modules created by other coders can be imported into your code. We're importing two
modules: Random, which contains code that enables us to use random choice for our
character; and Time, which enables us to work with time and pause the game.
3. Create functions
You can group lots of code into a function. To create one, we use def name(): – this
creates a function called name, and we can call the function whatever we want.
We press [Enter] and Python indents our code by four spaces, and awaits the code to
be run in this function.
We use variables to store information we can use later. For example, we save our
narrative and re-use it many times. Think of variables as empty boxes – we can put
anything in them and write their name on the side.
You will see the term 'global' used with some variable names; this enables us to use
them inside and outside of functions.
5. Get input
Raw input is the Python way of asking for input from the player. We use it to capture
the name of the player and to capture their decisions in the game.
Raw input captures keyboard input as a string of text, so any numbers captured need
to be converted to an integer or float, and this can be done using the int() and float()
helper functions.
6. Make choices
Conditional statements are logical choices; we use them to control the flow of the
game – for example, which direction do you go?
We store the direction that the player wishes to go as a variable called move, then
compare the value stored in the variable with the key we asked the user to press. If the
two match, the related code is run.
If..elif..else are further conditional statements and they work as follows: the first
condition is looked at, and if that is correct (or true in Python), the code underneath
this condition is run. Else if (elif) this condition is true, the code is run for this
statement.
Else is all the above conditions are false, then this must be true, so this code is run.
Lists are large containers that can hold lots of data. Think of them as a filing cabinet
filled with documents. In our game, we used a list to store our inventory of items (our
sword and shield).
"weapons = []"
Just like variables, we can give our list any name we wish. To add to our list we use:
weapons.append("sword")
9. Pick a number
Random numbers help our hero to be completely unique. To randomly select these
numbers, we use the random module, in particular a function called randint, or
random integer.
To use randint, we must tell it what range of numbers to work with, and this is done as
follows:
randint(5,20)
This creates a range between 5 and 20, and asks randint to pick a random number in
that range.
Our game needs interesting people to speak to, so let's create one. You will see on line
57 of the code that we have a new function that handles a random villager.
Their name is random and is chosen from a list, but first we shuffle the list and then
select the first item from the list, which in Python is always 0 (zero) or
npcnamechoice[0].
Adding new content to your game is easy. If you wish to add new characters or
villagers, the best way is to create a new function. That way the code for each new
entry is contained in its own function, but can be easily used in your game.
Your narrative should piece together these functions and provide a linear story for the
player to follow.
What about combat? Enemies can be created in the same way as villagers, but perhaps
you would like to give them randomly assigned health and magic points (HP and MP
in adventure speak), just as you have given your hero.
Create a new function that contains an enemy and place it into your code at a set
point, then test your code.
When working with text or, in Python speak, strings, we may want to join a string and
a number together. If we try to do it like this:
print "Hello" + 1
Python produces an error saying that the two cannot be joined. But if we wrap the
integer in a helper function called str() we can join them both together like so:
CHAPTER – 3
• Disk space: 1 GB
TECNOLOGY
PYTHON
Python is derived from many other languages, including ABC, Modula-3, C, C++,
Algol-68, SmallTalk, and Unix shell and other scripting languages.
Python is copyrighted. Like Perl, Python source code is now available under the
GNU General Public License (GPL).
Python is Interactive − You can actually sit at a Python prompt and interact
with the interpreter directly to write your programs.
Easy-to-read − Python code is more clearly defined and visible to the eyes.
A broad standard library − Python's bulk of the library is very portable and
cross-platform compatible on UNIX, Windows, and Macintosh.
Portable − Python can run on a wide variety of hardware platforms and has
the same interface on all platforms.
Scalable − Python provides a better structure and support for large programs
than shell scripting.
Apart from the above-mentioned features, Python has a big list of good features, few
are listed below −
CONCLUSION
In video game culture, an adventure game is a video game in which the player assumes the
role of a protagonist in an interactive story driven by exploration and puzzle-
solving. The genre's focus on story allows it to draw heavily from other narrative-based
media, literature and film, encompassing a wide variety of literary genres. Levels or
character statistics that could be improved over the course of the game.
1.4 OBSTACLE 1:
1.8 MOVEMENTS:
1.10 JUMPING:
Here we are able to complete our project with the reference of our PROJECT GUIDE,
1. https://www.python.org/
2. https://www.python.org/doc/av/
3. https://pypi.org/project/pygame/
4. BOOK: -Python Cookbook: Recipes for Mastering Python 3
5. BOOK: - Dive into Python