Allegro.cc - Online Community

Allegro.cc Forums » Game Design & Concepts » Iso 2D engine using CG Shaders [video]

This thread is locked; no one can reply to it. rss feed Print
 1   2   3 
Iso 2D engine using CG Shaders [video]
Dario ff
Member #10,065
August 2008
avatar

So I've been playing around with this pretty much all day, just placing and rendering random objects. So much fun that I felt like recording a video to show this!

[The video is inside the spoiler since the new thumbnail size is messing with the forum, but once you click it, it'll play fine!]

video

I saw a guy long time ago doing something like this(and quite better in some ways) using XNA, but since he kind of disappeared and never heard from him of releasing the engine, I just started playing with the idea.

Til now, it features the dynamic lighting showed off, and shadows casted by the directional light. They're not really accurate, but I think they look great. Trying to figure out how to do shadows casted by the dynamic lights as well.

And this must've been the simplest thing I ever wrote! Just two fragment shaders, some math and some bitmaps. It's built on Allegro 5 + the CG shaders. ;)

I'm looking for feedback on how could I improve the looks even more. Maybe ambient occlusion? Bloom? :) I was thinking of trying out water next.

TranslatorHack 2010, a human translation chain in a.cc.
My games: [GiftCraft] - [Blocky Rhythm[SH2011]] - [Elven Revolution] - [Dune Smasher!]

GullRaDriel
Member #3,861
September 2003
avatar

You should add collision instead of occlusion.

It's a nice thing thought.

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Mark Oates
Member #1,146
March 2001
avatar

That's pretty cool.

Dario ff said:

I'm looking for feedback on how could I improve the looks even more.

For the fun of it, how about a depth of field blur since you have the depth map.

What does it look like with the shaders turned off? 8-)

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Dario ff
Member #10,065
August 2008
avatar

For the fun of it, how about a depth of field blur since you have the depth map.

I must admit that for some reason, I hate depth of field blurs. :P Anyway, I don't think it'd work well since it's not a perspective camera, it's isometric. And iso isn't really doing "focus" on a particular point.

Quote:

What does it look like with the shaders turned off? 8-)

Like the first part of the video. I even lowered the quality of the music in that part to show how crappy it looks with no lighting. :P And it wouldn't have any object intersections at all.

TranslatorHack 2010, a human translation chain in a.cc.
My games: [GiftCraft] - [Blocky Rhythm[SH2011]] - [Elven Revolution] - [Dune Smasher!]

AMCerasoli
Member #11,955
May 2010
avatar

I like that... Could you attach the .exe? it's possible?

I don't like using 3D models with static cameras because you have to create an entire model and just one side is going to be visible...

But I really like isometrics games in 3D, with some perspective it looks really awesome. So I'm always thinking in a way to create a 3D world using an static camera, but take advantage of the entire mesh, material and texture...

Dario ff
Member #10,065
August 2008
avatar

But I really like isometrics games in 3D, with some perspective it looks really awesome.

But... then it's not isometric. :-/ It's just a camera angle.

EDIT: Mine isn't perfect isometric either, I think it's called an ortographic projection actually. But it doesn't take perspective into account. Bleh, I don't really know how it's called. It's just isometric with a slightly modified angle.

TranslatorHack 2010, a human translation chain in a.cc.
My games: [GiftCraft] - [Blocky Rhythm[SH2011]] - [Elven Revolution] - [Dune Smasher!]

imaxcs
Member #4,036
November 2003

You probably mean orthogonal. :)
Anyway, it's looking really nice! Keep up the good work!

AMCerasoli
Member #11,955
May 2010
avatar

Where is the exe? where is the exe?!

Dario ff
Member #10,065
August 2008
avatar

imaxcs said:

You probably mean orthogonal.

Ah, I knew I was close, thanks. Pure isometric doesn't look really good IMO, I prefer the style used in the Infinity Engine games. It uses as similar angle, but slightly rotated.

Where is the exe? where is the exe?!

Umm, wouldn't you prefer I at least put some editor's functions, like selecting and moving the objects? It's all big one hack at the moment just moving the pilar, the robot, and the sphere. ;D

(And you could screw up the whole lighting by just pressing random buttons)

TranslatorHack 2010, a human translation chain in a.cc.
My games: [GiftCraft] - [Blocky Rhythm[SH2011]] - [Elven Revolution] - [Dune Smasher!]

gnolam
Member #2,030
March 2002
avatar

You were right from the start with orthographic (if no perspective is involved). :P
(And an isometric projection is a special case of orthographic projection, where the projected unit axes are the same length with an angle of 120 degrees between each other)

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

Dizzy Egg
Member #10,824
March 2009
avatar

Looks frikkin awesome to me! Nice work.

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Neil Walker
Member #210
April 2000
avatar

I remember watching the original ages ago and this look just the same. Keep it up and turn it into a useable api :)

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Dario ff
Member #10,065
August 2008
avatar

gnolam said:

You were right from the start with orthographic (if no perspective is involved)

Then orthographic it is, I guess.

I'm trying out another angle camera at the moment and it looks sweet. Much better IMO. Compare the house to the one in the video for reference.
{"name":"603208","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/3\/d377a9a9895980e4fd8fa13ded954b6a.png","w":629,"h":468,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/3\/d377a9a9895980e4fd8fa13ded954b6a"}603208
I built it in a way that it's quite easy to change the projection settings. :) The thing is I have to render again all the objects.

And I've discovered there was a pretty horrible bug on the depth rendering, so yeah, quite a big part of the video was rendering it wrong. :-/ (At least the parts where the objects were elevated)

Keep it up and turn it into a useable api

Yeah, it can be easily plugged in since it just uses a Renderer class, a Camera, and the list of objects and lights. So just calling the renderer when drawing the frame should do all the work. ;) I need to do a usable editor though.

TranslatorHack 2010, a human translation chain in a.cc.
My games: [GiftCraft] - [Blocky Rhythm[SH2011]] - [Elven Revolution] - [Dune Smasher!]

Neil Walker
Member #210
April 2000
avatar

I wouldn't push the boat out on an api or editor unless you really want to. The one here:
http://retrospec.sgn.net/users/ignacio/isoeng.htm

Has only attracted 1500 in 6 years ;)

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Dario ff
Member #10,065
August 2008
avatar

Maybe a clean API for everyone isn't really needed, but an editor would be a must. And I have all my GUI code to reuse anyway.

I think you showed me isomot in the past. Must've been another of my isometric engine threads. ;D

TranslatorHack 2010, a human translation chain in a.cc.
My games: [GiftCraft] - [Blocky Rhythm[SH2011]] - [Elven Revolution] - [Dune Smasher!]

Jones64
Member #10,718
February 2009

Wow! looking great!
Waiting for a wip version ;)

Dario ff
Member #10,065
August 2008
avatar

Here you go so you can play around a bit.
It isn't optimized at all, so framerate drops might be possible. And I'm not sure if the shader even works on most cards.

F1 - Show/Hide light positions.
F2 - Toggle Height Map
F3 - Toggle Normals
F4 - Toggle Lighting
F5 - Toggle Editor mode.

It might lag quite a bit more in editor mode since I'm just using al_get_pixel to know if I'm picking a certain object. I will replace that later.

In the editor, select an object with the middle click. Left click to move it to an X/Y position, and hold right click and move up/down to change Z. If you hold Left control while using right click, you can scale the objects.

It should adapt to your display's desktop resolution in the fake fullscreen mode. If not, you can replace some settings in the .ini.

TranslatorHack 2010, a human translation chain in a.cc.
My games: [GiftCraft] - [Blocky Rhythm[SH2011]] - [Elven Revolution] - [Dune Smasher!]

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

I ran your program, and there was about 30 seconds of black screen, then the screen turned gray. I messed around with the F-keys and F5 brought up a view of an isometric tiled square with a pale brownish texture on it. F1 drew a little yellow circle and a vertical line on the screen. Whatever it was supposed to do, I don't think it did. Of course this is on my laptop, with crappy onboard graphics though.

What was it supposed to look like?

Dario ff
Member #10,065
August 2008
avatar

Nothing like that really. It's just that the shader doesn't compile for some reason since I'm still learning about profiles. I tried with a 6100 and pretty much the same happened.

What's your GPU model?

TranslatorHack 2010, a human translation chain in a.cc.
My games: [GiftCraft] - [Blocky Rhythm[SH2011]] - [Elven Revolution] - [Dune Smasher!]

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Dario ff
Member #10,065
August 2008
avatar

It's an integrated GPU right? I didn't really expect it to run well on that hardware...

All I guess you could try is going to the assets/shader folder and replace the profile in the .cgfx files with a text editor. Try out the glslf profile. The line is near the end of the file.

For example:
FragmentProgram = compile latest ps_main();
to
FragmentProgram = compile glslf ps_main();

And the loading time is because the bitmaps are pretty big. :-/

EDIT: I've always had some quirks when using the CG Effects file when compiling. I remember being able to compile almost anything by just extracting the fragment shader program from the first pass without anything else.

TranslatorHack 2010, a human translation chain in a.cc.
My games: [GiftCraft] - [Blocky Rhythm[SH2011]] - [Elven Revolution] - [Dune Smasher!]

Neil Walker
Member #210
April 2000
avatar

The mouse doesn't work for me and the scrolling is really slow and jumpy, probably because I'm only getting 8fps according to fraps.

I've got an nvidia geforce 8400m gs running on an intel core 2 duo T8100.

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

AMCerasoli
Member #11,955
May 2010
avatar

I ran your program, and there was about 30 seconds of black screen, then the screen turned gray. I messed around with the F-keys and F5 brought up a view of an isometric tiled square with a pale brownish texture on it. F1 drew a little yellow circle and a vertical line on the screen.

I had the same problem... then I changed the game_config.ini file to see the program in windowed mode.. and the console after the gray screen says "Technique lighting did not validate. Skipping."

then I wrote in the console: "don't skip please"

and then the computer wrote "Sorry..." and the program closed...

EDIT: BTW my graphic car is also an ATI 12..something... in a laptop...

Dario ff
Member #10,065
August 2008
avatar

I'll try my luck in just extracting the shader program rather than using the full CGFX file.

EDIT: For reference, my GPU is an NVidia Geforce 9600 GT. I get 60fps almost all the time. Integrated GPUs have never worked well for me when shaders are involved. :-/

TranslatorHack 2010, a human translation chain in a.cc.
My games: [GiftCraft] - [Blocky Rhythm[SH2011]] - [Elven Revolution] - [Dune Smasher!]

Neil Walker
Member #210
April 2000
avatar

I should add I have a laptop so it's the mobile version of the card, but dedicated non the less and is DX9 compatible.

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

 1   2   3 


Go to: