Tilengine A 2D graphics engine with raster effects

Similar documents
Writing a Client Application for Genesis II Contributors: Chris Sosa Last Modified: 06/05/2007

Game Development for

Eclipse CDT Tutorial. Eclipse CDT Homepage: Tutorial written by: James D Aniello

Laboratory Assignment #3 Eclipse CDT

Building FFplay for Windows Using MinGW and MSYS

Tutorial: Packaging your server build

C Language Documentation For Windows 7 64 Bit Compiler

Introduction to Autodesk MapGuide EnterpriseChapter1:

AN 834: Developing for the Intel HLS Compiler with an IDE

Introduction to Autodesk MapGuide EnterpriseChapter1:

Computer Games 2014 Selected Game Engines

Welcome! Graphics Fundamentals. Lecture 2. Welcome! Lecturer: Jacco Bikker

This is a set of tiles I made for a mobile game (a long time ago). You can download it here:

The Road to CCSv4. Status Update

CROSS-PLATFORM UTILITIES (CXUTILS) LIBRARY 2.0 USER DOCUMENTATION

Tutorial: Creating a Gem with code

Tutorial: Overview. CHAPTER 2 Tutorial

Page 2 PragmaDev Studio V5.3

Intermediate Python 3.x

Transitioning from Spread 3.17.x to Spread 4.0

ENERGY 211 / CME 211. Evolution

SlickEdit Gadgets. SlickEdit Gadgets

12/15/2008. All about Game Maker. Integrated Development Environment for 2D games Global idea

MRCP. Installation Manual. Developer Guide. Powered by Universal Speech Solutions LLC

Communications Library Manual

Module 3: Working with C/C++

What s New in SpriteKit

TNM093 Practical Data Visualization and Virtual Reality Laboratory Platform

APPLICATION COMMON OPERATING ENVIRONMENT (APPCOE)

Building scalable 3D applications. Ville Miettinen Hybrid Graphics

XML Tutorial. NOTE: This course is for basic concepts of XML in line with our existing Android Studio project.

Game Programming with. presented by Nathan Baur

Code Composer Studio v4. Introduction

What is this? How do UVMs work?

Programming Concepts and Skills. Creating an Android Project

Parallel Tools Platform for Judge

Creating a new CDC policy using the Database Administration Console

Saleae Device SDK Starting a Device SDK Project on Windows Starting a Device SDK Project on Linux... 7

NDK OVERVIEW OF THE ANDROID NATIVE DEVELOPMENT KIT

OOSIML SIMULATION MODELS. On Windows and Linux

Thank you for backing the project. Hope you enjoy these PDFs over the next few months <3

Table of Contents. PropellerIDE Documentation

USING CODEBLOCKS. Implementing Computational Models

StudioPrompter Tutorials. Prepare before you start the Tutorials. Opening and importing text files. Using the Control Bar. Using Dual Monitors

5.0 Service Release 1

IMPLEMENTING SCL PROGRAMS. Using Codeblocks

1 Installation (briefly)

DualSPHysics Interface Documentation

AVT Vimba. AVT Vimba User Guide for Linux Jun-25 V1.2. Allied Vision Technologies GmbH Taschenweg 2a D Stadtroda / Germany

Installing and Using Dev-C++

Setting Up a Paper in APA Style Using Microsoft Word 2008 for MACs

Computer Games 2011 Selected Game Engines

Building Allegro 5 Library using TDM-GCC and CMake

Software Development & Education Center. Java Platform, Micro Edition. (Mobile Java)

Computer Basics 1/24/13. Computer Organization. Computer systems consist of hardware and software.

Compiling SA_MESH (r965)

Configuring Ubuntu to Code for the OmniFlash or OmniEP

About this document. Introduction. Where does Life Forms fit? Prev Menu Next Back p. 2

LabWindows /CVI Release Notes Version 9.0

CPSC 436D: Video Game Programming Intro to Game Graphics Assignment

9.2 Linux Essentials Exam Objectives

Datasheet for MiniGUI V2.0.4/V1.6.10

Lecture 1. A. Sahu and S. V. Rao. Indian Institute of Technology Guwahati

Cybernetics Oriented Programming (CYBOP)

User Manual. 1. Open pjsip-apps/build/wince-evc4/wince_demos.vcw EVC4 workspace, 2. Build the pjsua_wince application.

Using Eclipse for C Programming

FRAQCEL USER GUIDE

8K Earth, Moon and Mars Shaders Asset V Documentation

Today. Operating System Evolution. CSCI 4061 Introduction to Operating Systems. Gen 1: Mono-programming ( ) OS Evolution Unix Overview

TREX Set-Up Guide: Creating a TREX Executable File for Windows

Code Blocks Cannot Find Compiler Executable Windows 7

Using Eclipse. Computational Thinking and Engineering for pre-college! Using Eclipse. Must READ:

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

Genesis 3d game engine windows 7. Genesis 3d game engine windows 7.zip

Pengwyn Documentation

Godot engine Documentation

Intro to Linux. this will open up a new terminal window for you is super convenient on the computers in the lab

Intermediate Programming, Spring Misha Kazhdan

Computer Basics 1/6/16. Computer Organization. Computer systems consist of hardware and software.

P&E Microcomputer Systems, Inc. PKGPPCNEXUS

ECM583 Special Topics in Computer Systems

VikiLABS. July 8, 2017

PocketVNA API documentation

David Scuse Department of Computer Science University of Manitoba. Eclipse 3.1

Xcode. Chapter 1. Creating a Project

Input Validation For Free Text Fields

Today. Operating System Evolution. CSCI 4061 Introduction to Operating Systems. Gen 1: Mono-programming ( ) OS Evolution Unix Overview

Introduction to Linux Environment. Yun-Wen Chen

Introduction to Linux (Part II) BUPT/QMUL 2018/03/21

Eclipse Environment Setup

PTN-202: Advanced Python Programming Course Description. Course Outline

Working with Metal Overview

Code Autocomplete Manual

App Central: Developer's Guide. For APKG 2.0

CS354R: Game Technology

Multimedia-Programmierung Übung 3

Flip-Q. Version 2.4. Overview

3D Production Pipeline

ArcGIS Runtime SDK for WPF

Using the Unix system. UNIX Introduction

Transcription:

Tilengine A 2D graphics engine with raster effects http://www.tilengine.org Last updated in 2/9/2015 9:17:00 By Marc Palacios (Megamarc)

Table of contents TABLE OF CONTENTS...2 PACKAGE CONTENTS...3 Tilengine.pdf...3 install.bat...3 install.sh...3 /samples...3 /lib...3 /src...3 /dev-cpp...3 /visualc...3 /Python...3 /Java...3 INSTALLING...4 Installing in Windows...4 Installing in Linux...4 RUNNING THE SAMPLES...5 List of samples...5 User input...5 BUILDING THE SAMPLES...6 Windows MS Visual Studio...6 Windows Dev-CPP...6 Windows MinGW...6 Linux GNU GCC...6 PYTHON...7 Basic usage...7 Interactive mode and multithreading...7 Sample scripts...8 Interactive sample scripts...8 JAVA...9 Files...9 Basic usage...9 Included samples...9 SAMPLES LAYOUT...10 ACKNOWLEDGEMENTS...11 Tiled...11 Spritesheet packer...11 Libpng...11 SimpleXML...11 LibSDL...11 Mark Ferrari...11 2

Package contents This document describes the contents included inside the file Tilengine.zip. Please visit http://www.tilengine.org for the latest news. Tilengine.pdf This file. install.bat Installation batch for Windows (see Installing in Windows) install.sh Installation bash script for Linux (see Installing in Linux) /samples Graphics assets used by the samples (tmx, tsx, png, sqx, txt ) This is the main target path for all executables after install/build /lib Precompiled tilengine binaries and header file for C samples /src Source code of the C samples Makefile for building the samples /dev-cpp Orwell Dev-CPP projects to build the C samples /visualc MS Visual Studio 2005 projects of the C samples /Python Python wrapper and sample scripts (see Python) /Java Java JNI wrapper and sample programs (see Java) 3

Installing Extract the files in any directory of your convenience (preserving the structure of directories) and open a command window in the root folder of the pack. Installing in Windows The supplied install.bat file copies all the precompiled libraries, examples, and python wrapper and samples and precompiled java wrapper and samples to the /samples directory. Just type > install Installing in Linux The supplied install.sh bash script copies all the precompiled libraries, examples, and python wrapper and samples and precompiled java wrapper and samples to the /samples directory. It also registers the libtilengine.so library in a system-wide location (/usr/local/lib), so administrator privileges are required to install. Just type > sudo./install.sh 4

Running the samples Binaries for the C samples are already precompiled for Windows and Linux. To run them, open a console in /samples directory and run their executables or double-click their icons from the file explorer. List of samples There are eight samples: Name barrel mode7 Description Sidescroller with barrel-distortion effect similar to SNES Super Castlevania IV and basic character control (jumping, tile collision) Classic 2D perspective projection to simulate a 3D floor, similar to SNES Super Mario Kart platformer racer scaling shooter tutorial wobble ColorCycle SeizeTheDay Sidescroller with palette animation and linescroll to simulate depth using only two layers. Similar to Sega Genesis Sonic Fake 3D road using linescroll, floor palette switching and scaling sprites. Similar to Sega Super Hang On Combination of layer scaling and alpha blending Complex example with intense use of raster effects for sky gradient, linescroll and layer multiplexing. Basic shooter engine similar to Sega Genesis Thunder Force IV Basic sample on how to setup the engine, load a tileset/tilemap and make a scrolling layer Water-like distortion effect combining linescroll and column offset mode to create an ondulating effect Color cycling animation Color cycling animation with palette interpolation This directory also contains the Python (.py) and Java (.class) versions of some samples User input All samples use the same input: Use keyboard cursor arrows or joystick d-pad to move Press z key or joystick button 1 to fire in the shooter example or jump in the barrel example 5

Building the samples The samples can be built with 4 different tools: Microsoft Visual Studio 2005 and later, Orwell Dev-CPP, MinGW and GNU GCC for Linux Windows MS Visual Studio Go to the /visualc folder and open the TilengineSample.sln solution file, convert to the newer version of Visual Studio if asked for, and build. The executables are directly placed in the /samples folder. Windows Dev-CPP Go to the /dev-cpp folder and open any of the eight.dev files (one for each sample). Set up the compiler if desired (defaults to the first toolchain installed) and build. The executables are directly placed in the /samples folder. Note: newer version of Dev-CPP use the GNU command rm for the clean target, which is not available in Windows, instead of the standard del /Q. If there is a build error when doing clean, install rm for windows or tweak the intermediate makefile by hand. Windows MinGW Open a command prompt inside the /src folder and type the following command: > mingw32-make The executables are directly placed in the /samples folder. Linux GNU GCC Open a command prompt inside the /src folder and type the following command: > make The executables are directly placed in the /samples folder. 6

Python Tilengine can be accessed from Python through the provided Tilengine.py module wrapper. It uses the ctypes feature in Python to interface with native libraries. It is just a barebones wrapper, with all the functions in a single module. Basic usage To use the wrapper, you have to import the corresponding module, for example: import tilengine as tln Now all the API is available through the tln namespace, and removing the original TLN_ prefix. For example, to initialise the engine: # create a 400x240 pixels renderer with 2 layers and 80 sprites tln.init (400,240, 2,80,0) # create a window with a scanline overlay and v-sync tln.createwindow ( overlay2.bmp, tln.cwf_vsync) #load some resources and setup layer tileset = tln.loadtileset ( mytileset.tsx ); tilemap = tln.loadtilemap ( mytilemap.tmx, Layer 1 ); tln.setlayer (0, tileset, tilemap); Interactive mode and multithreading The default windowing system in tilengine is single-threaded: the game main loop is responsible of attending the event queue of the window and updating the screen, calling the functions ProcessWindow() and DrawFrame(): # main loop while tln.processwindow(): # do game stuff (read inputs, update logic...) tln.drawframe (frame) frame += 1 # deinitialise tln.deletewindow () tln.deinit () However, during an interactive session in the interpreter, the window gets unattended (nobody is calling ProcessWindow() and DrawFrame() periodically) so the window doesn t refresh and suffers a non responding state. 7

To solve this problem, a secondary windowing mode has been implemented. Instead of the previous CreateWindow function, you have to use: # create a multithreaded window with a scanline overlay tln.createwindowthread ( overlay2.bmp, 0) This function creates the window in its own thread, which has a loop that attends events and updates it at 60 Hz (always v-sync) in the background. In this mode you don t have to call ProcessWindow(), DrawFrame() and DeleteWindow(). Sample scripts Some of the original samples written in C have been ported to python. These are platformer.py, mode7.py and scaling.py. To run them just open a python console in the samples directory and type any of these: import platformer import mode7 import scaling To finish the script just press Esc or close the window Interactive sample scripts Each one of the three sample scripts listed above have a tweaked version intended to be played with interactively. These are platformer_test.py, mode7_test.py and scaling_test.py, To run them just open a python console in the samples directory and type any of these: import platformer_test as t import mode7_test as t import scaling_test as t The as t sentence is just for shortening the namespace. Each sample has some prebuilt functions for easy interaction, and from any of them you can access directly tilengine. 8

Java Tilengine can be accessed from Java through the provided JNI wrapper: the java class Tilengine.java which in turn accesses the engine through two native bridges: TilengineJNI.dll (windows) and libtilenginejni.so (linux). This wrapper is just a barebones bridge to the native Tilengine API, which doesn t use classes or other Java-like features. All the functions are contained in a single class, and all the object references are plain integers. Files File Tilengine.java TilengineJNI.c Makefile_* TestWindow.java TestPanel.java /class /linux /win32 Description Java side source of the JNI wrapper Native side source of the JNI wrapper Makefiles for building the JNI bridge Java sample that uses Tilengine internal windowing Java sample that uses an AWT JPanel as a rendering target Precompiled java classes Precompiled linux JNI bridge Precompiled windows JNI bridge Basic usage To use the wrapper, first create an instance of the Tilengine class: Tilengine tln = new Tilengine(); Then you can access all the functions in the tln variable. For example for setting up a basic layer yo can do: // init a 400x240 display, 1 layer and 0 sprites tln.init (400,240, 1,0,0); tln.createwindow ( overlay.bmp, tln.cwf_vsync); // load some resources and setup renderer int tileset = tln.loadtileset ( mytileset.tsx ); int tilemap = tln.loadtilemap ( mytilemap.tmx, Layer 1 ); tln.setlayer (0, tileset, tilemap); Included samples There are two sample programs that show how to use the wrapper. They re not an example of Java best practices, but just a simple way to setup a basic game loop and rendering with Tilengine. TestWindow uses the internal windowing (SDL) as the C or Python samples. TestPanel shows how to use Tilengine as a backend renderer, drawing inside an AWT Jpanel To run the samples in windows, type: > java TestWindow To run from Linux: > java Djava.library.path=. TestWindow 9

Samples layout The following chart shows how the examples, Tilengine, and other components are laid out for easy porting and integration: Examples (or games) are at the top-most layer. They use Tilengine for rendering and its built-in windowing environment. They are open source. Tilengine provides the 2D scanline-based rendering and optional windowing environment. It is freeware closed source. In order to build on as many platforms as possible, built-in Tilengine windowing system uses SDL (Simple DirectMedia), an open-source cross-platform library that provides windowing and rendering on many platforms. As long as there is a build of SDL on a given platform, Tilengine and its examples can run there. Below SDL there are the underlying operating system and hardware. 10

Acknowledgements Tilengine wouldn't be possible without these work previously created by other generous people. Thanks to all of you! Tiled Tiled is a fantastic open-source tilemap map editor by Thorbjørn Lindeijer. Tilengine reads the maps created with Tiled. http://www.mapeditor.org Spritesheet packer This tool created by Nick Gravelyn takes a list of independent graphics and outputs a single image with all the original images inside it with their coordinates. Tilengine reads spritesheets for the sprites. https://spritesheetpacker.codeplex.com/ Libpng Libpng the reference library for reading png image files, open source by many authors. http://www.libpng.org/pub/png/libpng.html SimpleXML SimpleXML is a tiny XML parser for embedded systems. Tilengine uses it to read the Tiled maps, which are in XML format. http://simplexml.sourceforge.net/ LibSDL LibSDL is a cross-platform windowing and user input library, among other things. The built-in windowing environment in Tilengine uses SDL. https://www.libsdl.org/ Mark Ferrari Mark Ferrari is a pixel art illustrator (among other things), who drew and animated all the awesome images in ColorCycle and SeizeTheDay examples and gave his permission to use them here. http://markferrari.com/ 11