Java

This category contains all the posts under core java and ways to program in Java

Details of Class Loading in JVM

Have you ever seen a ClassNotFoundException or a NoClassDefFoundError? Did you ever face a situation where you are trying to cast and assign it to a compatible reference but it throws a ClassCastException ? Or did you face issues where you never understood where to put the jars in your application? Ever did any hot deployment on a running Application Server and wondered how the new changes get reflected without a server restart? Ever got confused with the process of Class Loading in JVM? If you didn't face any of these, then you are extremely lucky or you are yet to start development :)...
Read More

Java Virtual Machine Startup

In the last post we had a brief idea about the memory model of the Java Virtual Machine. We also came across certain terms like the Creation, Linking, Loading and Initialization of classes. In this post we will try to improve our understanding of all these terms. At the Java Virtual Machine Startup The JVM starts up by creating an initial class and loads it using the bootstrap class loader (we will learn about the class loader in another post). Some implementation of the JVM allow us to pass the name of the initial class using the command line. The JVM then links this initial class. L...
Read More

Memory Model of Java Virtual Machine

The Java Virtual Machine is an abstract computing machine. It is responsible for most of the features which made Java a great technology. Few of the major selling points of Java was: Platform Independence Hardware Independence Operating System Independence Security from malicious programs It is said to be abstract computing machine because it offers all the specification which if implemented properly can act as a machine to execute instructions. Sun Microsystems (now acquired by Oracle) offers an implementation of the JVM. The JVM understands a particular binary format wh...
Read More

Seed in Random Number Generation

Random Numbers Randomization is an awesome concept. Efficiency of most of the algorithms are proportional to how randomly the algorithm is implemented. Talking about one the best sort algorithms - Quick Sort. The efficiency depends on the choice of pivot and it is wise to choose a pivot randomly to get an even distribution of elements around it. Of course no one can beat my bad luck if my randomly chosen pivot misbehaves. But still you will be luckier and have a better running time and upper bound on the running time of this algorithm. This is not the only algorithm where randomization ...
Read More

Resource Management in Game

Introduction This post is the next in the game development series. In this post we will learn about Resource Management in the Game. After writing the game engine, now we can add some background to our game. We will try to add our menu as well and try to add navigation in the menu. Once that is done we will be able to move through the menu and choose various options. Without wasting much time, lets dive in. Objects in the Game There are many different type of entities in our game. They can be categorized into Screens and Actors and few more. You have absolute freedom to make it more gran...
Read More

Writing a Game Engine

Introduction This is the second post in the series and I suggest you to read the Basics of Game Development first. There are two important things in this game. Drawing the Game Canvas Writing a Game Engine (The Game FSM - Finite State Machine) In this post we will discuss about both. The Game Canvas The Game Canvas is a rectangular area on which we will draw all our game objects. It will have a predefined size (WIDTH and HEIGHT). The best way to make our game canvas is to extend the java.awt.Canvas class. [crayon-58feed86b5e9a685882592/] Now let us create a frame and add...
Read More

Basics of Game Development

Introduction Everyone is fond of computer games and most of us wish to create games (professionally or even just for fun). Here, in this series of posts I will be explaining the Basics of Game Development, the approach and code from scratch for the first game I developed. About the Game If you want to try what we will develop, then you can click on the above image, download the game and play it to have a good understanding. You can download the .exe file and straight away launch it to run. This is a simple arcade game where you are facing an Alien Invasion and you are given a figh...
Read More