Sign in to follow this  
  • entries
    26
  • comments
    48
  • views
    23202

PliGame, R.I.P

Sign in to follow this  

334 views

Just to further prove that I'm an unusual "newbie" to game development, I present to you PliGame. This package provides extensions to the Pliant language for the SDL game library. I wrote this. Its even listed on the SDL languages page. I did this as part of my undergraduate thesis.

Pliant uses a JIT like compiler, it compiles Pliant scripts into native code in memory at runtime. My thesis professor, Marcus Santos is one of the core developers of Pliant. I decided that Pliant could perform well as a game programming language and so created PliGame.

I implemented bindings for graphics, event and input function to SDL. This was enough to prove that Pliant, which syntax is as simple as Python ( so some think ) and performs comparibly to C. I found a few demos in C and Python, and wrote similar demos in Pliant. One example was the rotozoomer.

The rotozoomer is simply zooming and rotating a 2^n by 2^n tile bitmap image in and out. I was able to implement this in Pliant in just 92 lines, with comfortable white-spacing. And it performs at full 60FPS.

roto.pli:
Quote:


module "/pliant/language/context.pli"
module "/pliant/math/functions.pli"

module "/pliant/SDL/SDL.pli"

gvar Pointer:SDL_Surface tile
gvar Pointer:SDL_Surface screen

function rotate dest src angle scale
arg Pointer:SDL_Surface dest src
arg Float angle scale
var Int u v du dv x y sx sy mv mu
var uInt umask := src:w - 1

var uInt vmask := src:h - 1
var Address texture image
var Float temp

texture := src:pixels
image := dest:pixels

sx := 0; sy := 0

du := cast (scale * (cos angle) * 4096.0) Int
dv := cast (scale * (sin angle) * 4096.0) Int

for y 0 (dest:h - 1)
u := sx
v := sy

for x 0 (dest:w - 1)
mv := (v \ 2^12 ) .and. vmask
mu := (u \ 2^12 ) .and. umask

(image map uInt8) := (texture map uInt8 (mv * src:w + mu ))
image := (image translate uInt8 1)
u += du
v += dv

sx -= dv
sy += du

return

function init -> b
arg Bool b

b := true


if (SDL_Init SDL_INIT_VIDEO) < 0

console "Could not initialize SDL!" eol
SDL_QUIT
b := false
return

screen :> (SDL_SetVideoMode 640 480 8 SDL_SWSURFACE)

if not (exists screen)
console "Could not init video!" eol
SDL_QUIT
b := false

return

tile :> SDL_LoadBMP "astroids.bmp"
SDL_SetColors screen tile:format:palette:colors 0 tile:format:palette:ncolors


function main
var SDL_Event event
var Float angle := 0.0

if not (init)
console "Init failed..." eol
return

var CBool done := false

while not done
while SDL_PollEvent:event > 0
if event:type = SDL_QUIT
done := true

eif event:type = SDL_KEYDOWN
done := true

rotate screen tile angle (sin angle)
SDL_UpdateRect screen 0 0 0 0

angle += 0.005

SDL_FreeSurface tile

SDL_QUIT
return

main




I made an MPEG video player (w/ SMPEG) and almost wrote a first-person Asteroids game. But I stopped half-way. Had I completed it, that would have been my first game.



I got an A+ for the thesis, and quickly switched to other important business. I never continued the project, and my professor is still looking for thesis students to further develop the Pliant language. Its still complete enough for making games, just without sound.

One of the other reasons I discontinued were the difficulties in supporting both Linux and windows versions. I wanted it to be cross platform, but it appears that the developers of Pliant are more interested in running Pliant in its own operating system, Full-Pliant or Linux.

Window library support was a headache and I just couldn't keep up with all the new changes in the Pliant compiler. I decided that if they can't fully support Windows, then I'd just forget about gaming applications for Pliant. I hate MS as much as the next guy, but I can't ignore the fact that gaming is hot on Windows and not Linux, unfortunate as that is.

So yes, I do indeed know SDL. And I've never made a game with it. I'm still a newbie.
Sign in to follow this  


2 Comments


Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now