Wednesday, January 18, 2006

SDL & Enlighten

As promised I'm going to post on my first endeavor of this project (hmm, does the project itself need a name?). If you're not that interested in the development story you can skip to the game itself (unzip all files to a directory, double-click enlighten.exe).

The Idea
This is actually something I worked on last year. Working for an honest-to-goodness game company and actually releasing games has made me a lot more confident about my ability to follow through on a game and create something "professional". I was looking for a way to take this a bit further with a project that I had control over.

The idea was to learn more about developing titles for a PC and try out my skills at creating a fairly complex puzzle game. I decided to create a clone of Lumines, a puzzle game that I was very addicted to at the time, and had great gameplay and execution which I admired (Tetsuya Mizuguchi has done a lot of great work, and I like what he has been doing with Q Entertainment). At the time I had several ideas about how I wanted to expand the initial concept -- I was interested in putting in some dynamic lighting models and trying light as a game mechanic. Certain blocks would emit light and without enough light it would be difficult to see and use the entire board. I called the game Enlighten with this in mind.

The first task for me was to pick a development platform and create the basic engine I would need to create the game. The likeliest canidate was DirectX. It's nearly industry standard and has pretty much everything I'd need for the game. There were a few problems with DirectX though. It's proprietary, you can't port it, and you need Visual Studio to develop with it. I wasn't excited to blow money on copy of Visual Studio for my home computer. So I looked at my options and found SDL, a C-based library that does most everything I need, is free and is multi-platform.

I set to work creating a prototype of the game. I read over some tutorials, figured out the basics of how to push pixels to the screen and read keyboard input and created a down and dirty engine for updating based on user input and rendering to a small window. Then I got to gameplay, first having blocks that dropped, then blocks that stacked, and finally blocks that filled in holes (albeit, automagically, there were no physics involved). I introduced the timeline and allowed blocks to delete. At this point I'd spent about 15 hours researching and a few hours coding. Then I added some graphical flourishes. A score readout, a menu, a background image. At some point I got side-tracked looking at graphical effects and decided to put in a plasma effect for the backdrop of the game.

Getting the graphics and the code in was relatively painless. I wrote some graphics primitives, blitting stuff, some alpha blending, etc., and it just worked. Where I got bogged down was in implementing the game "physics" of Lumines. Even though I appreciated the somewhat analog nature of the original game, I hadn't appreciated just how complex the rules were for determining when to delete something. I also got bogged down into trying to implement those rules in as efficient a manner as possible, which when considering the overhead for drawing operations, was almost certainly a waste of time. It made me consider the development process of the game and wonder just how many iterations the original design went through and how they got down to exactly the rules they did. And appreciate how complex rules may be required for a simple user experience. I suspect that the game was probably designed from the perspective of the user experience itself and the rules came later.

I played around with a few visual effects. What you see in the final product doesn't have all of these. I tried having a fade effect as the piece moved around the board. The alpha-blending proved a bit too expensive for the lower-end laptop I tried the game on. To get good acceleration for this, apparently, it would have been necessary to draw using OpenGL on a 2d projection -- I chose not to go that far.

All told I spent about 20 hours planning/researching for the game and about 30 or so hours coding the thing. Not a lot of time all things considered -- basically one "work week" and I had to build up a lot of my engine from scratch. I didn't finish the gameplay completely. There are a few quirks in the gameplay, I didn't do "levels" and I never got to the lighting models I wanted to do. I looked into getting some music loops to play during the game but didn't follow through on that. But that's ok. I did get a non-trivial fun, game done with SDL in a fairly short amount of time. And I got enough expore with SDL to determine that it is definitely sufficient for smaller-scale puzzle style games although if I wanted to do some more extreme graphical effects I think I would need to integrate OpenGL into my project or move to DirectX.

Moving Forward
My goals have changed a lot since I made Enlighten. Instead of trying to make one game right the first time I want to throw out a bunch of ideas and then maybe come back to those that worked particularly well or were fun -- I may even come back to Enlighten at some future date. But for now I'd like to work on some smaller ideas that are more fully my own. I did get to play around with SDL though and become more confident that I can make a decent looking PC version of a game though.

I've also decided that, for the purposes of documenting this all on the web, I will get a better response if I am able to create web-based games. So I'm looking at Flash as a platform for developing games. So far Flash is proving very different from what I'm used to -- it's geared for artists, animators, movie-makers -- not programmers. Programming a game feels like a hack. But it does have a lot of nice tools for visual effects and I have an idea for a game that I'm putting through the paces now.

More on that soon (I hope).


Anonymous Anonymous said...

It's a bit too fast (on the time line, I mean-- the sweeps go by too fast).

Never used SDL... does it provide APIs for graphics or did you really write your own blitting routines?

I am not sure why you feel that it was designed from the user experience first; the algo for marking blocks for deletion seems pretty clear to me? It looked to me where the core idea was probably something like "a puzzle game that pulses with the music" and then the puzzle game + time line concept came from that. That may be what you mean "user experience first" -- in which case, I think just about all games start that way. ;)

I have not dug into Flash, though I have been thinking about it. As I've mentioned before, I use Blitz because it's crossplatform and wraps DX and OpenGL both...

4:18 PM  
Blogger StGabe said...

This comment has been removed by a blog administrator.

10:06 PM  
Blogger StGabe said...

Ahh. I did forget to post directions didn't I -- kind've important you'd think. I will do so first thing tomorrow. The rule for deletion is: make a square of 4 anywhere and it will delete once the line passes over it. The line speed is probably tuned for me -- if I have time I will create some different difficulty lines or have it speed up with time tomorrow.

SDL does have a sub-library for doing some graphics called SDL_gfx. It's offering of primitives is a bit eclectic however. While reading the SDL forums I saw talk of creating a library for 2d graphics that would automatically project onto a plane in OpenGL and thus utilize hardware acceleration -- but as far as I know that doesn't exist as yet. I did write my own blitting routines and other graphics primitives (lines and rectangles, with or without alpha blending). If you (or anyone else) was interested, I could put up source and you could cannabilize my engine.

Regarding game ideas, I find that a lot of my ideas come from game mechanics first. For example, the idea I'm throwing around now started with consiering what would happen if Tetris pieces were rotated 45 degrees which was followed by a some thought about rules for possible physics engines that would make that work. Only after coming up with a few ideas for that did I start to consider how it would play. Another idea I am tooling with started with thinking about tile-based boardgames like Carcassonne and how such gameplay mechanics play out. I'm guessing that I am the one that does things somewhat backwards here.

Regarding Flash, well, I will probably have more to say about it next week. I'm finding it has some nice tools. But it's difficult adjusting to it's mindset. One of my biggest challenges has just been figuring out where the darn code goes. And then figuring out that I need to setup images as "MovieClips". What I need is "Flash for C Hackers" but I haven't found that online anywhere. One thing I'm finding is that the utilization of vector graphics allows more power than I had realized (perhaps I've lived in the world of 2d graphics too long).

I'm too comfortable with C and too obsessive-compulsive about optimizing code to go to something like Blitz I think -- although the idea of 3d graphics in BASIC is interesting.

10:10 PM  
Anonymous Anonymous said...

Gosh, I so am not interested in writing blitting routines. ;)

The latest Blitz is actually even OO, and all versions of Blitz have supported DLLs in other languages. I had no trouble whatsoever going from C to Blitz; I've used C++ considerably less than C, I admit.

And they do all have a decent 2d-in-3d system that does exactly what you describe. If you visit the forums, you should see plenty of code snippets, if you wanted to try it out (plus, it's really cheap).

The reason I ended up with something like Blitz was that for me the barrier wasn't C, it was the IDE on Windows. All my C work was done on Unix, and Windows just baffles me. I literally don't know where to start. Just getting a window on screen seemed like a huge production... I am sure I could figure it out if I expended the effort, but I didn't want to expend the effort, I wanted a straightforward API so I could get to the rapid prototyping.

My comment on the line speed was based on Lumines -- it's faster than Lumines is at the first level, at any rate. :)

On mechanics versus the sort of core idea -- when you say "Tetris but with 45 degree rotation" that sounds like it's in the same "class" so to speak. *shrug* I think I mentioned on my blog that I've gotten two games so far out of "feels like a kaleidoscope," for example... one of them, though, was based on symmetry, and the other was based on rotation. The mechanics and the "vibe" both come from the same initial impulse.

11:49 AM  
Blogger StGabe said...

I also prefer a UNIX environment but I am forced to use Windows most of the time. My work-around is that I edit all of my files in Emacs (which has a Windows version) and then use the IDE's only for compilation. And SDL can be used under several UNIX platforms. If you're interested you might also check out:

which has several game libraries which will probably do what you need.

5:24 PM  
Anonymous Anonymous said...

chicago cubs tickets

8:22 PM  
Anonymous Anonymous said...

[url=] hotels[/url]

8:55 PM  
Anonymous Anonymous said...

order viagra
[url=]order viagra[/url]
buy viagra
[url=]buy viagra[/url]
viagra online
[url=]viagra online[/url]
Best wihes

6:12 PM  
Anonymous Anonymous said...

cheapest viagra prices soma and viagra prescriptions free viagra viagra 6 free samples cheap cheap viagra marijuana and viagra viagra prices buy viagra soft online bad side effects of viagra cheapest viagra prices cialis v s viagra viagra soft tabs new viagra viagra buy price iframe womens viagra

10:36 AM  
Anonymous Anonymous said...

Thank you for the article! Good luck!
Herbal for men

5:08 PM  
Anonymous Anonymous said...

[url=]Viagra without prescription overnight shipping[/url]
[url=]знакомства литва[/url]
[url=]тегос ру знакомства[/url]
[url=]ольга блядь[/url]
[url=]одинокая женщина желает познакомиться онлайн[/url]
[url=]бляди луганска[/url]
[url=]где снять молодые проститутку[/url]
[url=]чат интимных знакомств[/url]
[url=]автозаводская интим[/url]
[url=]серпуховско-тимирязевская проститутки[/url]
[url=]знакомства без[/url]
[url=]значение слова блядь[/url]
[url=]проститутки трансвеститы москвы[/url][url=]донецк знакомства секс[/url]
[url=]проститутки строгино[/url]
[url=]сайт знакомств саранск[/url]
[url=]чат знакомств в ставрополе[/url]
[url=]проститутки женщины москвы[/url]
[url=]dating ru москва знакомства[/url]
[url=]служба знакомств мужчина и женщина[/url]
[url=]интим белоруссии[/url]

6:51 AM  
Anonymous Anonymous said...

Good day !.
You may , perhaps curious to know how one can reach 2000 per day of income .
There is no need to invest much at first. You may commense earning with as small sum of money as 20-100 dollars.

AimTrust is what you thought of all the time
AimTrust incorporates an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.

It is based in Panama with affiliates around the world.
Do you want to become really rich in short time?
That`s your choice That`s what you wish in the long run!

I`m happy and lucky, I started to get real money with the help of this company,
and I invite you to do the same. It`s all about how to select a proper companion who uses your savings in a right way - that`s the AimTrust!.
I make 2G daily, and what I started with was a funny sum of 500 bucks!
It`s easy to get involved , just click this link
and go! Let`s take our chance together to get rid of nastiness of the life

12:49 PM  
Anonymous Anonymous said...

Good day !.
might , perhaps curious to know how one can manage to receive high yields .
There is no initial capital needed You may start earning with as small sum of money as 20-100 dollars.

AimTrust is what you thought of all the time
The company represents an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.

Its head office is in Panama with structures around the world.
Do you want to become a happy investor?
That`s your chance That`s what you wish in the long run!

I feel good, I started to take up real money with the help of this company,
and I invite you to do the same. It`s all about how to select a proper partner who uses your money in a right way - that`s AimTrust!.
I take now up to 2G every day, and what I started with was a funny sum of 500 bucks!
It`s easy to get involved , just click this link
and go! Let`s take this option together to become rich

7:29 AM  
Anonymous Anonymous said...

vab банк
vab банк
[url=]vab банк[/url] - vab банк

5:38 PM  
Anonymous Anonymous said...

[url=]alternative medicine distance education[/url]
[url=]alternative medicine diploma[/url]
[url=]courses in alternative medicine[/url]
[url=]institute of alternative medicine[/url]

10:15 PM  
Anonymous Anonymous said...

Hello!!! is one of the most outstanding resourceful websites of its kind. I take advantage of reading it every day. All the best.

6:47 AM  
Anonymous Anonymous said...

[url=]global institute for alternative medicine[/url]
[url=]institute for alternative medicine[/url]
[url=]courses in alternative medicine[/url]
[url=]alternative medicine Kolkata[/url]

6:46 AM  
Anonymous Anonymous said...

Hi there!
I would like to burn a theme at this forum. There is such a nicey, called HYIP, or High Yield Investment Program. It reminds of ponzy-like structure, but in rare cases one may happen to meet a company that really pays up to 2% daily not on invested money, but from real profits.

For quite a long time, I make money with the help of these programs.
I'm with no money problems now, but there are heights that must be conquered . I make 2G daily, and my first investment was 500 dollars only.
Right now, I'm very close at catching at last a guaranteed variant to make a sharp rise . Turn to my blog to get additional info.

9:00 PM  
Anonymous Anonymous said...

I want not agree on it. I over precise post. Particularly the title-deed attracted me to be familiar with the unscathed story.

5:24 AM  
Anonymous Anonymous said...

Nice dispatch and this fill someone in on helped me alot in my college assignement. Thank you on your information.

1:44 AM  
Anonymous Anonymous said...

The author of has written an excellent article. You have made your point and there is not much to argue about. It is like the following universal truth that you can not argue with: Wherever you go, you will have been there Thanks for the info.

11:09 PM  
Anonymous Anonymous said...

Как дела? Может-быть... есть мега предложение по[url=] видео[/url] порталу Думаю вам понравится

[url=]вагина крупным планом[/url]
aнекдот для разнообразия :)

Встречапются две однокуртсницы вскоре после выупска. Первая:
- Я на работу сутроилась. А ты?
- Я преднаазначена только для любви! Работа не для мен!!
- Ну дии по специальонсти.

Я 6 часов блуждала по сети, пока не вышела на ваш форум! Думаю, я здесь осатанусьл надолго!
пршоу прощеиня за опечатки.... очень маленьккая клавиатура у PDA!


11:41 AM  
Anonymous Anonymous said...

You have really great taste on catch article titles, even when you are not interested in this topic you push to read it

11:45 PM  
Anonymous Anonymous said...

I am reading this article second time today, you have to be more careful with content leakers. If I will fount it again I will send you a link

4:03 AM  
Anonymous Anonymous said... is the best. Thank your for this article. I enjoyed it very much.
AAA Toronto Payday Loans 1172 Bay St #101, Toronto, ON M5S 2B4 (416) 477-2817

7:24 PM  
Anonymous Anonymous said...

Genial brief and this mail helped me alot in my college assignement. Say thank you you seeking your information.

11:28 AM  
Anonymous Anonymous said...

Persuade the lubricous with two backs casinos? institute established of this environmental [url=]online casino[/url] regulate and stall online casino games like slots, blackjack, roulette, baccarat and more at .
you can also supplant our up to year [url=]casino[/url] orientate at and overwhelm corporeal folding shin-plasters !
another lone [url=]casino spiele[/url] find is , in lieu of of german gamblers, superintend well-wishing online casino bonus.

10:59 AM  
Anonymous Anonymous said...

секс знакомства по г тольятти проститутки харькова шлюхи г Архангельск откровенные интим знакомства с женщинами в мурманске проститутки люкс услуги проститутки и индивидуалки негритянки в самаре чат секс знакомств тюмень минет с выездом в офис район каховка шлюхи петровско разумовская секс в юрьев польском секс знакомство с парами в уфе секс с праституткой коды доступа к сайтам секс знакомств безплатно

проститутки льова

3:53 AM  
Anonymous Anonymous said...

I appear forward to coming back to read your "SDL & Enlighten" post also.
Visit my web: Poker sans depot & Poker Bonos & Bonus ohne einzahlung & Bonus senza deposito

12:51 AM  
Anonymous Anonymous said...

If you desire to increase your experience simply keep visiting this website and be updated with the most recent
information posted here.
My webpage :: pbs kids dora the explorer

11:06 AM  
Anonymous Anonymous said...

Hi, guantanamera121212

9:30 AM  
Anonymous Anonymous said...

[url=][img] alt="cheap chanel outlet" title="chanel bags"[/img][/url]

7:22 AM  
Anonymous Anonymous said...

nolvadex online pharmacy compounding pharmacy tech training [url=]parkview pharmacy[/url]
french pharmacy mass college of pharmacy [url=]pulmicort[/url]
schools in michigan to become certified pharmacy tech new york college of pharmacy [url=]providence st vincent hospital portland pharmacy[/url]
philadelphia pharmacy job agengy rite aid pharmacy hayes va [url=]aricept[/url]

7:23 PM  
Anonymous Anonymous said...

hartmann pharmacy training sandra rathbone cvs pharmacy [url=]toronto pharmacy scam[/url]
pharmacy queensland board of pharmacy oregon [url=]retin a 0 02 [/url]
fda online pharmacy pharmacy technician codes [url=]surgical supplies pharmacy eighth avenue new york[/url]
copper rx discount pharmacy texas pharmacy mistake lawyer [url=]procalisx[/url]

7:52 AM  
Anonymous Poker said...

gratis poker pro
free online poker bonus party titan
bonus start free
free poker money darmowy bonus No deposit bonus for poker
start poker game
online poker bonus za darmo
play holdem free
free cash for poker
Poker bonus ipoker
start profits to build a poker bankroll easy
iPoker Poker 770

9:50 AM  
Anonymous Anonymous said...

fortune pharmacy new pharmacy laws regarding generics [url=]kunkel pharmacy[/url]
compound prescriptions pharmacy baltimore md pharmacy school admissions [url=]digoxin[/url]
cvs pharmacy printable coupon tricare pharmacy on line [url=]pharmacy shirt[/url]
pharmacy tools viagra half price pharmacy [url=]allopurinol[/url]

2:09 PM  

Post a Comment

<< Home