Info: You can download the compiled JAR file below. This is purely to show off some feature in the engine via the command console, the game is nowhere near complete (this is a demo really.)
Feedback\Bug Reports are welcome. Contains Course Language
Features: Some of the latest features of the engine I can remember: - Fully Scriptable, scriptable scenes, events & NPCs (Scripts are written in JavaScript - go figure) - UI Is entirely skinnable and customizable - Jeva Core provides a solid infastructure for most general UI components. - Basic particle engine (implemented primary for attack\heal\projectile effects so not too fancy, but can handle ~30000 particles on the very low-end machine I develop on) -Entities can save states and reload states (essential for game saves). States are can be saved on an integrated back-end that works over GameJolt API for Achievements, Scoring and Cloud Saving - Fully capable quest system & dialogue system (dialogue can be complex with various pathways which effect any internal variables of the character (i.e. moral)) - Most of the engine is entirely extensible - with logical partitions in implementation logic between Java and external scripts. - Map Editor & Dialogue editor - Dynamic lighting and scriptable weather subsystem - powerful debugging console - very powerful user interface via scripts to engine. Both through the console and entity configuration files.
Known Issues: - Precaching has not yet been implemented, as such you might get random FPS drops as the game prepares resources. - Using the command console to invoke commands like load unvisited areas will cause the quests scripts to screw up etc. - Sometimes the quests don't trigger properly, this is an error with the quest scripts, not a big deal though. - Use of Area object is risky as I found a bug in the JDKs implementation of it, while I haven't encountered any issues with it since, symptoms will be a freeze for about 50 seconds and then a crash due to lack of heap memory.
Modding: If you want to write a Mod etc, just add the .zip extension and snoop around res folder - there are tons of cool things you can do, even add your own NPCs etc.
I may need to implement signing of game content for security reasons (i.e, since the engine supports a scripting interface I'd want to sign my scripts so that the users of my engine can't have their computer\savegame destoryed by some engine exploit via a mod script they download)
I think it is absolutely absurd people are 'attacking' other people's mods by exploiting the mod's interface to the game. That's really quite stupid.
I've acheived a rough implementation of dynamic lighting - this was really quite tricky in Java2D because you really don't have any access to pixel shaders or vertex-shaders which means you need to be quite crafy when implementing the lighting effect. I feel obligated to explain how I managed to do it since I feel that there is a serious lack of material out there for pure Java2D Isometric lighting algorithms.
The lighting effect is unpolished - i.e. there are still a few small things I need to do before it looks pretty but you can see it starting to shape up:
I did a lot of research since I posted this question - there are tons of alternatives and JavaFX does intend (on a later release) to include its own shader language for those interested. There is also a ofcourse LWJGL that will allow you to load your own shaders onto the GPU.
However, if you're stuck in Java2D (as I am) it is still possible to implement lighting in an isometric game it is just 'awkward' because you cannot perform the light shading on a per-pixel level.
How it Looks:
I have achieved a (highly unpolished - after some polishing I can assure you it will look great) effect for casting shadows, depth sorting the light map, and applying the lighting without experiencing a drop in frame-rate. Here is how it looks:
You'll see in this screen-shot a diffuse light (not shaded in but that step I'd say is relatively easy in contrast to the steps to get there) casting shadows - the areas behind the entities that obstructs the light's passage BUT also in the bounds of the light's maximum fall-out is shaded in as the ambient lighting but in reality this area is passed to the lights rendering routine to factor in the amount of obstruction that has occurred so that the light can apply a prettier gradient (or fading effect of some sort.)
The current implementation of the diffuse lighting is to just simply render obstructed regions the ambient colour and render non-obstructed regions the light's colour - obviously though you'd apply a fading effect as you got further from the light (that part of the implementation I haven't done yet - but as I said it is relatively easy.)
How I did it: I don't guarantee this is the most optimal method, but for those interested:
Essentially, this effect is achieved by using a lot of Java shape operations - the rendering of the light map is accelerated by using a VolatileImage.
When the light map is being generated, the render routine does the following:
Creates an Area object that contains a Rectangle that covers the entirety of the screen. This area will contain your ambient lighting.
It then iterates through the lights asking them what their light-casting Area would be if there were no obstructions in the way.
It takes this area object and searches the world for Actors\Tiles that are contained within that area that the light would be cast in.
For every tile that it finds that obstructs view in the light's casting area, it will calculate the difference in the light source's position and the obstruction's position (essentially creating a vector that points AT the obstruction from the light source - this is the direction you want to cast your shadow) This pointing vector (in world space) needs to be translated to screen space.
Once that has been done, a perpendicular to that vector is taken and normalized. This essentially gives you a line you can travel up or down on by multiplying it by any given length to travel the given direction in. This vector is perpendicular to the direction you want to cast your shadow over.
Almost done, you consturct a polygon that consists of four points. The first two points are at the the base of the screen coordinate of your obstruction's center point. To get the first point, you want to travel up your perpendicular vector (calculated in 5) a quantity of half your tile's height [ this is a relatively accurate approximation though I think this part of the algorithm is slightly incorrect - but it has no noticable decay on the visual effect] - then ofcourse add to that the obstructions origin. To get the second, you do the same but instead travel down.
The remainder of the two points are calculated exactly the same way - only these points need to be projected outward in the direction of your shadow's projection vector calculated in 4. - You can choose any large amount to project it outwards by - just as long as it reaches at least outside of you light's casting area (so if you just want to do it stupidly multiply your shadow projection vector by a factor of 10 and you should be safe)
From this polygon you just constructed, construct an area, and then invoke the "intersect" method with your light's area as the first argument - this will assure that your shadows area doesn't reach outside of the bounds of the area that your light casts over.
Subtract from your light's casting the shadow area you constructed above. At this point you now have two areas - the area where the light casts unobstructed, and the area the light casts over obstructed - if your Actors have a visibility obstruction factor that you used to determine that a particular actor was obstructing view - you also have the grade at which it obstructs the view that you can apply later when you are drawing in the light effect (this will allow you to chose between a darker\brighter shade depending on how much light is being obstructed
Subtract from your ambient light area you constructed in (1) both the light area, and the obstructed light area so you don't apply the ambient light to areas where the lighting effect will take over and render into
Now you need to merge your light map with your depth-buffered world's render routine
Now that you've rendered you're light map and it is contained inside of a volatile image, you need to throw it into your world's render routine and depth-sorting algorithm. Since the back-buffer and the light map are both volatileimages, rendering the light map over the world is relatively optimal.
You need to construct a polygon that is essentially a strip that contains what a vertical strip of your world tiles would be rendered into (look at my screen shot, you'll see an array of thin diagonal lines seperating these strips. These strips are what I am referring). You can than render parts of this light map strip by strip (render it over the strip after you've rendered the last tile in that strip since - obviously - the light map has to be applied over the map). You can use the same image-map just use that strip as a clip for Graphics - you will need to translate that strip polygon down per render of a strip.
Anyway, like I said I don't guarantee this is the most optimal way - but so far it is working fine for me.
This game in particular started as an excercise for the engine - so I could figure out where some core limitations are etc.
Here are some idea I have for the engine, the current one is pretty simple, ntext next few are complex in nature (simple to implement) and likely appeal to a smaller audience. (I'll be brief)
Now, lol, give me a break because I am not a great writer.
The current one: [inspiration: Looking at the assets I have on hand and trying to put together a game to excercise the engine]
Essentially, you are a military solider who has woken up from a short state of unconsciousness - you are unsure where you are and what has happened to you - you hardly know your name. You learn that you where the leading member of a small squad that had accompanied you to what you later discover to be 'Sector 3' - an enclosed area full of biological life in a very large military research facility.
You hear a gun shot and upon investigation you discover a solider - the solider tells you that he was sent to recover you and explains that you are in Sector 3 - the 'playground' for biological warfare and development - i.e. creepy biologically engineered species developed for warfare\research call sector 3 home.
You encounter creepy and disturbing experiments performed - enlarged spiders, fungus that infects test subjects and turns them into zombies etc. Once you return to what the soldier, Eric, calls 'control' you discover that the research center has had its security breached and that all the biological research subjects had escaped into nearby general population. The game ends as you fight your way through the sectors to come to this realization that you now live in a post-apocalyptic world.
The one I hope to develop later: [Inspiration: Notches incomplete game 0x10c]
I discovered an incomplete\unreleased game by notch called 0x10c - it was mainly about space exploration but that wasn't really what made the game great. Each space-craft had a programmable CPU onboard it - users would program their own operating systems and write their own emulators for an instruction-set that wasn't even developed - this was the heart of the game. Users _loved_ rewriting what we had years ago - people tried to implement DOS clones etc and it became an incredibly popular games based off of fan emulators etc. Something in us drives us to these challenges and I think it is what makes a game really great. People would have conversations regarding security, hacking, etc.
So my idea was to implement a sort of 'server-tycoon' game. Each user would be provided some initial funds and could purchase a 'server' (the server would be a virtual computer - a very primitive virtual computer - I'm talking 16 bit, no memory managment unit etc - 100MHZ - this challenge is what made 0x10c so popular). Those 'servers' could interface with virtual peripheral devices like keyboards and monitors. Then, the user would connect their virtual server house with a game server, or the game-lingo term would be "ISP" and they would be assigned an "IP Address" (really just some sort of way the game server can ID the user) these servers people write the software for could then communicate with each-other, people would create their own virtual 'internet' and could implement things like games in games etc. Finally, these "ISP"s could expose their clients to real computer via the browser. I.e, an in-game CPU could implement a minimal HTTP web-server and then you could browse to it via your webbrowser.
The coolest thing about it all though? It brings back the days of hacking servers (except the servers being hacked wouldn't be real servers.) The days of buffer-overflows etc - I think that would be a big part of the game to.
As you get more connections to your server you would make more money - and then could purchase quicker adapters (to transfer more data to the "ISP") and purchase more expensive hardware (I.e, one with an MMU allowing for more complex operating systems.)
The market sounds very small for this game, but when noche released it - with such a simple 16 bit CPU _kids_ were learning to program these primitive applicaitons for this very primitive CPU.
- Implemented a basic particle engine for blood\projectile\healing effects
- Added Character menu screen that shows level\equipment
- Fixed several UI bugs (actually, mostly this week I have been profiling and tracking down bugs)
It is a quick particle engine implementation, it can handle ~30000 until the lag gets pretty bad. I can optimize in a few places but I won't bother because I won't have more than >1000 particles on the screen at any point in time with the game I am going for.
Anyway, here are a few clips of the particle engine in the game doing some stuff - they still need a bit of fine tuning:
Attacking (Blood effect):
Medium amount of particles
Absurd amount (15000-30000) particles on the screen:
I've now implemented items. Each item can be bound to script to perform a scriptable routine when consumed. Weapons\Armor can scripted regarding how & what to do to the attackee & how to scale the attack damage on the attackee\attacker (i.e, armor will scale down damage or negate it completely if it is fire armor vs. fire weapons or something.) A fire sword might ignite the target on fire etc...
Here is a screen-shot showing the looting system I created. I am going to add an onEnter function invocation for entity scripts so they can properly initialize, for now I just use this hack (This is a quest spider, so its script is a bit more tedious than usual) You can see it provides itself with a health pack at the initialization routine that it can (itself) consume using me.consume(...) or it can keep it and die with it so that the player can loot it later:
[code] var isDead = false; var init = false;
function onInteract() { me.cancelTasks(); me.dialog(0); }
function onDialogEvent(eventId) { return -1; }
function onIdle(isIdle) {
//Stupid init hack until I implement an onEnter function. if(!init) { init = true; me.addItem('item/healthpack.jitm', 1); }
JevaEngine - Undeground Demo
Info:
You can download the compiled JAR file below. This is purely to show off some feature in the engine via the command console, the game is nowhere near complete (this is a demo really.)
Feedback\Bug Reports are welcome.
Contains Course Language
Features:
Some of the latest features of the engine I can remember:
- Fully Scriptable, scriptable scenes, events & NPCs (Scripts are written in JavaScript - go figure)
- UI Is entirely skinnable and customizable - Jeva Core provides a solid infastructure for most general UI components.
- Basic particle engine (implemented primary for attack\heal\projectile effects so not too fancy, but can handle ~30000 particles on the very low-end machine I develop on)
-Entities can save states and reload states (essential for game saves). States are can be saved on an integrated back-end that works over GameJolt API for Achievements, Scoring and Cloud Saving
- Fully capable quest system & dialogue system (dialogue can be complex with various pathways which effect any internal variables of the character (i.e. moral))
- Most of the engine is entirely extensible - with logical partitions in implementation logic between Java and external scripts.
- Map Editor & Dialogue editor
- Dynamic lighting and scriptable weather subsystem
- powerful debugging console - very powerful user interface via scripts to engine. Both through the console and entity configuration files.
Download:
Executable Jar:
http://www.filedropper.com/jeu
Applet:
It can be downloaded as an executable JAR (See Above) OR run as an applet here:
http://gamejolt.com/games/rpg/jevaengine-project-d0/16225/
Please post comments\suggestions etc.
Known Issues:
- Precaching has not yet been implemented, as such you might get random FPS drops as the game prepares resources.
- Using the command console to invoke commands like load unvisited areas will cause the quests scripts to screw up etc.
- Sometimes the quests don't trigger properly, this is an error with the quest scripts, not a big deal though.
- Use of Area object is risky as I found a bug in the JDKs implementation of it, while I haven't encountered any issues with it since, symptoms will be a freeze for about 50 seconds and then a crash due to lack of heap memory.
Modding:
If you want to write a Mod etc, just add the .zip extension and snoop around res folder - there are tons of cool things you can do, even add your own NPCs etc.
Command Console:
How to use the command console:
http://pastebin.com/iciidRCv
Thanks.
I've done tons of C, C++ and C# .Net - if I were to port it to anything it would probably be C# .Net.
There is absolutely no reason for me to port it over to an unmanaged environment so I would never consider doing that.
That said, I am pretty confident with it as a Java application right now and I know porting it to any other managed laguage will be relativley easy.
I've added tons of features since I last posted here.
There is a video of me showing off the scripting engine (and accidently a bug I found - which I have since resolved):
If anyone is interested, I also maintain a much more frequently updated blog at java-gaming.org
http://www.java-gaming.org/index.php/topic,30313.msg279530.html
(You have to watch in 720p to read the script I am tryping into the engine via the command console):
http://www.youtube.com/watch?feature=player_embedded&v=pmf7vrsz0TY#at=21
I may need to implement signing of game content for security reasons (i.e, since the engine supports a scripting interface I'd want to sign my scripts so that the users of my engine can't have their computer\savegame destoryed by some engine exploit via a mod script they download)
I think it is absolutely absurd people are 'attacking' other people's mods by exploiting the mod's interface to the game. That's really quite stupid.
I've acheived a rough implementation of dynamic lighting - this was really quite tricky in Java2D because you really don't have any access to pixel shaders or vertex-shaders which means you need to be quite crafy when implementing the lighting effect. I feel obligated to explain how I managed to do it since I feel that there is a serious lack of material out there for pure Java2D Isometric lighting algorithms.
The lighting effect is unpolished - i.e. there are still a few small things I need to do before it looks pretty but you can see it starting to shape up:
Thanks for the response @JblueEntertainment
This game in particular started as an excercise for the engine - so I could figure out where some core limitations are etc.
Here are some idea I have for the engine, the current one is pretty simple, ntext next few are complex in nature (simple to implement) and likely appeal to a smaller audience. (I'll be brief)
Now, lol, give me a break because I am not a great writer.
The current one:
[inspiration: Looking at the assets I have on hand and trying to put together a game to excercise the engine]
Essentially, you are a military solider who has woken up from a short state of unconsciousness - you are unsure where you are and what has happened to you - you hardly know your name. You learn that you where the leading member of a small squad that had accompanied you to what you later discover to be 'Sector 3' - an enclosed area full of biological life in a very large military research facility.
You hear a gun shot and upon investigation you discover a solider - the solider tells you that he was sent to recover you and explains that you are in Sector 3 - the 'playground' for biological warfare and development - i.e. creepy biologically engineered species developed for warfare\research call sector 3 home.
You encounter creepy and disturbing experiments performed - enlarged spiders, fungus that infects test subjects and turns them into zombies etc. Once you return to what the soldier, Eric, calls 'control' you discover that the research center has had its security breached and that all the biological research subjects had escaped into nearby general population. The game ends as you fight your way through the sectors to come to this realization that you now live in a post-apocalyptic world.
The one I hope to develop later:
[Inspiration: Notches incomplete game 0x10c]
I discovered an incomplete\unreleased game by notch called 0x10c - it was mainly about space exploration but that wasn't really what made the game great. Each space-craft had a programmable CPU onboard it - users would program their own operating systems and write their own emulators for an instruction-set that wasn't even developed - this was the heart of the game. Users _loved_ rewriting what we had years ago - people tried to implement DOS clones etc and it became an incredibly popular games based off of fan emulators etc. Something in us drives us to these challenges and I think it is what makes a game really great. People would have conversations regarding security, hacking, etc.
So my idea was to implement a sort of 'server-tycoon' game. Each user would be provided some initial funds and could purchase a 'server' (the server would be a virtual computer - a very primitive virtual computer - I'm talking 16 bit, no memory managment unit etc - 100MHZ - this challenge is what made 0x10c so popular). Those 'servers' could interface with virtual peripheral devices like keyboards and monitors. Then, the user would connect their virtual server house with a game server, or the game-lingo term would be "ISP" and they would be assigned an "IP Address" (really just some sort of way the game server can ID the user) these servers people write the software for could then communicate with each-other, people would create their own virtual 'internet' and could implement things like games in games etc. Finally, these "ISP"s could expose their clients to real computer via the browser. I.e, an in-game CPU could implement a minimal HTTP web-server and then you could browse to it via your webbrowser.
The coolest thing about it all though? It brings back the days of hacking servers (except the servers being hacked wouldn't be real servers.) The days of buffer-overflows etc - I think that would be a big part of the game to.
As you get more connections to your server you would make more money - and then could purchase quicker adapters (to transfer more data to the "ISP") and purchase more expensive hardware (I.e, one with an MMU allowing for more complex operating systems.)
The market sounds very small for this game, but when noche released it - with such a simple 16 bit CPU _kids_ were learning to program these primitive applicaitons for this very primitive CPU.
New game-play video showing off a bit of the combat system and item system:
http://youtu.be/G0bxGhwkaNs
I've done tons of stuff today:
- Implemented a basic particle engine for blood\projectile\healing effects
- Added Character menu screen that shows level\equipment
- Fixed several UI bugs (actually, mostly this week I have been profiling and tracking down bugs)
It is a quick particle engine implementation, it can handle ~30000 until the lag gets pretty bad. I can optimize in a few places but I won't bother because I won't have more than >1000 particles on the screen at any point in time with the game I am going for.
Anyway, here are a few clips of the particle engine in the game doing some stuff - they still need a bit of fine tuning:
Attacking (Blood effect):
Medium amount of particles
Absurd amount (15000-30000) particles on the screen:
Finally got a solid quality recording uploaded:
http://www.youtube.com/watch?v=kNLXVcxmFSM&feature=player_embedded
Today, just refactored some code and implemented entity state saving\restoring.
I've now implemented items. Each item can be bound to script to perform a scriptable routine when consumed. Weapons\Armor can scripted regarding how & what to do to the attackee & how to scale the attack damage on the attackee\attacker (i.e, armor will scale down damage or negate it completely if it is fire armor vs. fire weapons or something.) A fire sword might ignite the target on fire etc...
Here is a screen-shot showing the looting system I created. I am going to add an onEnter function invocation for entity scripts so they can properly initialize, for now I just use this hack (This is a quest spider, so its script is a bit more tedious than usual) You can see it provides itself with a health pack at the initialization routine that it can (itself) consume using me.consume(...) or it can keep it and die with it so that the player can loot it later:
[code]
var isDead = false;
var init = false;
function onInteract()
{
me.cancelTasks();
me.dialog(0);
}
function onDialogEvent(eventId)
{
return -1;
}
function onIdle(isIdle)
{
//Stupid init hack until I implement an onEnter function.
if(!init)
{
init = true;
me.addItem('item/healthpack.jitm', 1);
}
if(isIdle && !isDead)
{
if(game.getQuest('quests/almostatcontrol.jqf').getTask('initial').getState() == quest_inProgress)
{
me.idle(2000);
}
else
{
var target = core.getEntity('player');
me.moveTo(target.getLocation().x, target.getLocation().y, 1);
me.attack(target);
}
}
}
function onAttacked(entityInfo)
{
}
function onAttack(attackee)
{
me.playAudio('audio/spider/sight.wav');
}
function onDie()
{
isDead = true;
me.cancelTasks();
me.playAudio('audio/spider/die.wav');
game.getQuest('quests/almostatcontrol.jqf').getTask('helpEric').setState(quest_completed);
}
[/code]
Pages