Responsive Ad Area
Home » Blog » Main Slider

Main Slider

Random Access Files with Java

Random Access Files with Java Random Access Files (RAF) in Java are super easy to use. Use an RAF when you are doing more database-like operations vs document-like operations. With an RAF you can move to any location in the file based on the byte number.  Then read or write primitives and Strings. You can also read and write arrays of bytes. It would be easy enough to write a set of primitives associated with an object which is the object's state, then reload and rebuild the object later. Six Examples So in this article, I will give you 6 examples of storing and reading - one, two and three dimensioned arrays of integers. The first 3 examples simply generate random numbers in arrays then write them to an RAF. They then read the whole file back displaying it at the console. The next 3 read ...

Sprite Organizer 0.1 Alpha

Organizing Sprites, Tiles, Textures etc on Image Strips or Grids. This article is about a tool for organizing sprite or tile images into image grids or image strips. It's useful for organizing game sprites, simulation sprites, textures or even CSS sprites used on web pages.  It has buffers which contain images. Images can be broken into cols and rows.  Cells or sprites are defined as so many pixels by so many pixels in size.  Saves and loads images.      Features Load and save single images or sprite sets. Load images into one of 10 buffers (more buffers in the next versions) Paste from one buffer into a grid or image strip.  Divide a blank image into cols or cols and rows. Sprite size is determined by the size of the grid in pixels and number of cols and rows. Copy, Paste, Move ...

Sound effects and Musical Notes.

Sound Effects and Musical Notes I will demo how to play a wave file or other sound files as effects. How to play musical notes. Later I will write on how to play music files simultaneously with sound effects.  There is a website that is like a YouTube for sound effects. freesound.org is a website where anyone can get an account to upload sound effects that they have recorded. So you too can record and contribute.  Sox Wikipedia and Sox Sourceforge is a command line sound conversion tool where you may convert most any format found on freesound.org to .wav for use in your Java software. Listen to my Podcast about 2D Game coding. Playing WAV Sound Effects I now show you how to play some sound effects. I have a small collection of wave files for a beaver trapping game. One of the files threw a...

SQLite: JDBC and SQLite

SQLite and Java First, you must go to download page and get the binaries for either 32 or 64 bit, placing them in the system path. If you don't know how to do that, google adding folders to the system path. There will be an SQLite.exe file. Run it as a command to verify that it is in the path and working. But for Java coding get the jar file at Jar file. A very good resource you will need is A good tutorial and Another tutorial. Working with Java and Files Tutorial Trail Serialize Java to XML H2 DB and Java Setup for simple example Download the SQLite jar file from BitBucket SQL downloads. Put it and the source below in the same folder. Set the classpath to include that jar file and the '.' current folder or use -cp option with 'sqlite-jdbc-3.21.0.jar;.' when using java.exe. One Step Creat...

Serializing Java Objects to XML and Deserializing XML back to Java Objects

Like object serialization this is very easy and straight forward. Below is two examples of psuedo code for writing and then reading. This code merely shows the steps. We didn't have to use the buffered streams. With small files you do not have to but with larger files it will speed up reading and writing. XMLEncoder Class //psuedo code does not run import java.beans.*; import java.io.*; public class SerializeToXML { public static void main(String args[]){ // an object, composition of objects or collection of objects AnObject anObject = new AnObject(); XMLEncoder encoder=null; try{ encoder=new XMLEncoder(new BufferedOutputStream(new FileOutputStream("objects.xml"))); }catch(FileNotFoundException fnfe){ fnfe.printStackTrace(); } encoder.writeObject(anObject); encoder.close(); } } //psuedo co...

ESS Model an easy to use UML Modeling Tool

ESS Model UML Tool ESS Model is a light weight easy to use Modeling tool that can help you to understand your source as well as other developers source code. It will give you at a glance uml models for classes in the same folder. This shows classes, fields and methods for given classes in a box model. Lines will connect classes in the same package(folder). I use this on my article post here at SDZ some when I feel I have the time. You can make screen shots of the uml using PrtSc on home row then paste into MS Paint, crop, save then insert images in your own post. When you download this put the exe in the path somewhere or add it to the path. Then just navigate to the folder which is the package you want to display. Then type 'essmodel *.java' at the command line. More about ESS Model If yo...

Handling Keyboard Input and Mouse Events

Keyboard Input and Mouse Events In this example, I show you some simple input examples using Applets. Later I might add Web Start or even Swing Desktop examples. Here we get keyboard input (typing) as keyDown event. And we get mouse positions and clicks. We demonstrated mouse input as move, clicks and mouse drag and drop with a more complex example using a vector sprite stickman. See also Sound Effects and Music Keyboard Input Here I give you sample HTML needed. Put the source and HTML in the same folder and compile the source with 'javac KeyTest.java' Save this as 'keyboard.html' then run it at the console with 'appletviewer keyboard.html' . Note that you will have to give the window focus by clicking it, then when you press a key, output in the console will show which key was pressed. It...

Arksoft Podcast Episode 8-3D Game Engine Programming with Java

Episode 8 3D Game Engine Programming 3D Game Engine coding can be simple or complex. Also see 2D Game Coding using Java RSS feed is http://arksoft.libsyn.com/rss I talk about books that I have been reading. I discuss techniques and concepts related to 3D game programming using Java. Though much of this content is about game development in general and only a small part is directly about Java or exact coding. Books that I talk about.. Black Art of Java Game Programming Black Art of 3D Game Programming C Building a 3D Game Engine C++ I talk about.. Isometric Parallel Orthogonal view World Perspective view Rendering Pipeline Texture Mapping Shading Lighting Other effects Culling for efficiency Painters algorithm for removing hidden objects. Culling for removing hidden objects Z buffer and Z or...

Arksoft Demo 2 Applets Part 1

Applets Demo Part One Applets I show you how to find the dox console, or windows shell, or command line. I show you how to find and use the Java Control Panel. I show you how to add a trusted site. I show you how to write and applet and view it with both applet viewer and Windows Internet Explorer from the local hard drive or localhost. I also show  you a little about a Java game Free Colonization. http://freecol.org

Java Programming Language

I explain to you the evolution of programming language up to Java. What is a JVM? What is OOP? What is cryptic? What is interpreted vs compiled languages? What is ByteCode? What is Von Neuman Language? How is Java similar or different from other popular langauges.