Desperate Times - A game about kidnapped unicorns

Hey everyone,
A while ago I was working on this game, in the BGE.
Now I’m trying it again, by using BDX,
a small open-source & cross-platform java-game-engine (made to work with blender), with IMO a much better API.


‘Desperate Times’ will be a 2d game with procedurally generated levels.
You have to explore castles, and your goal is to find the kidnapped unicorns. You’ve got to rescue them, but you’ll be facing a lot of enemies.


For updates and videos look here:

GO TO UPDATES:

***Here are some random screenshots/gifs of the game so far:

  • A* Pathfinding AI

  • Platformer physics: (you can pass through a platform from below)

      ![http://i296.photobucket.com/albums/mm185/hilkojj/GIF%20platforms_zpshhhwn0qw.gif](http://i296.photobucket.com/albums/mm185/hilkojj/GIF%20platforms_zpshhhwn0qw.gif)
    
  • The tileset I made:

      ![http://i296.photobucket.com/albums/mm185/hilkojj/tileset_zpsubhisg33.png](http://i296.photobucket.com/albums/mm185/hilkojj/tileset_zpsubhisg33.png)
    

I hope that at the end of this year a playable demo is ready to play. Including a few levels, a few enemies and a few weapons.

I hope to frequently post updates on twitter.

Thanks for reading.

Wow!! that’s really cool! keep up the good work!! :slight_smile:

Cool! I keep thinking of using BDX. How are you finding it? I did some java tutorials to brush up but I’m afraid I’ll forget them before I get around to trying it…
Game looks amazing by the way! I love the character animation.

Hah, I posted on your Twitter - this looks pretty cool so far, dude! Your art’s improved a lot between the last attempt and this one, as well.

Hey, thanks for all the kind words!

@Smoking_mirror, thanks! Yeah, I find BDX an awesome engine.
The only things I can think of that BDX is missing are: Armature animations and shadows. (Though these are only 2 things, they can be really important for making 3d games, like you do).

Though:

  • It gives you much, much more freedom when it comes to coding. There almost ain’t restrictions to it.
  • The source code is really clean and light-weighted, and it’s open source so you can easily take a look at it (or even make changes to it, if I’m not wrong).
  • BDX (and other libraries) offers some really handy things that you CAN use to make things easier, like Components.
  • Support for custom shaders and material-shaders (and it comes with several pre-made shaders like motion-blur and DOF).
  • I prever Java way more over Python, but that’s a personal opinion I guess.
  • It’s cross platform, support for HTML, Android, iOs, etc.
  • No annoying l0g|c-br!ck$, and no GPL.

I’m not sure why, but I just enjoy making my game with BDX and Java way more than BGE and Python.

@SolarLune, thx m8. Yeah I really enjoy pixel art and animations, Pixel art may seem easy but it’s pretty hard to make good looking animations xD

Thanks for the info. I wouldn’t mind making a game with sprites and objects rather than rigged characters. In fact I’ve got just the project for that.
One thing I worry about is that I use mathutils a lot. I guess there’s some alternative to allow you to work easily with Vectors and Matrix etc…

Also I second what Solar Lune said. Your animations are getting loads better.

Oh, don’t worry about that, Java itself has a lot of useful utilities, and LibGDX as well, and if there’s something missing, there are a lot of libraries you can download from internet, (but I never needed to).
And yes, BDX automatically includes gwt-vecmath in your project, useful for vectors and matrix.

I really recommend to use an IDE (I personally like IntelliJ the most), because it gives you a great overview of all libraries/classes/methods that are available to use, it warns you when something’s wrong, and it just makes it way easier to code.

And, thanks :slight_smile:

Yeah, I’ve been using PyCharm with Blender, but it doesn’t pick up the auto complete that well, even with the workaround.
After my current project i think I’ll try BDX. :slight_smile:

Here is my only issue with BDX (for more information):
Dynamic text - Right now, SolarLune has been trying to find an alternative way to implement dynamic text because the current solution only offers text in low-res. You can have high-res dynamic text in-game, but it’s extremely hand-wavy and a bit of a hassle. Also, text manipulation right now is very limited because of the lack of text information - you don’t know the size of your text on screen or in 3D space. This kind of sucks because fonts have different sizes, this makes writing dialogue systems like the one below non-trivial:

(I wrote this in my own custom BDX build because the default text in BDX wasn’t enough)
I know the text looks low-res, that’s because YouTube scaled it up to fit the video, the text box is actually around 350by350. Take note that because I know the size of the letters (width and height), I can figure out how many characters fit in a line and automatically make a new line when the current lines runs out of space.

To me, dynamic text is probably my biggest issue with BDX. That being said, I’m still working on BDX because of all the reasons hilkojj mentioned, it’s a great engine :slight_smile: Also, as you can tell, I managed to resolve my text issue problem (at least for what I need).

As a side note, this just a fun little interesting thing, the reason why PyCharm has trouble auto completing is because Python is dynamically-typed. As a result, any identifier could be of any type at any moment. Pair that with the ability to create objects and first-class functions, and you effectively have a language that is very difficult to predict accurately, sometimes it’s not even decidable (which is why you get a lot of weird shit when you try to auto complete).

Java (like C#, C++, C) is well-typed, every identifier within a specific scope has an exact type. Prediction for autocomplete it relatively easy, possible and decidable (usually).

Well Blender’s text solution is also not so hot, in many of the ways you described. It’s not easy to find a solution to that I guess.
@hilkojj
What kind of things in your game are components? How do they work in practice?
Most things I work with are classes, which I usually divide in to entities and actions. For example the player is an entity (of the sub type agent) while a fade out animation is an action.

Well Blender’s text solution is also not so hot, in many of the ways you described. It’s not easy to find a solution to that I guess.

Yeah, if you’ve got a problem in the BGE, and you can’t find a workaround for it, you’re stuck. In Bdx you’ve got much more freedom to fix things.

Well, Components are objects (not to be confused with Game-Objects) that you can apply on every GameObject you want.
Components have States, but only 1 can be active at a time. Every tick Bdx will call the .main() method of every Component’s currently active State.

I have a Component that controls character-movement and what animations should be played.
It’s got 4 States:

  • Walking; this state will move the GameObject, and play the walking animation.
  • Idle; this state will only play the idle animation.
  • Jumping; this state applies force to the GameObject, and will play the jumping animation.
  • Falling; this state will play the falling animation.

This is a simple example, but Components and States are also really useful in more complex systems.

Java (like C#, C++, C) is well-typed, every identifier within a specific scope has an exact type. Prediction for autocomplete it relatively easy, possible and decidable (usually).

This is why I like Java. This does not only make it easier for your IDE to check your code, it also makes it easier for myself to manage and understand my own, and other’s code.

Oh, that sounds very much like what I do with objects and states.
Each entity object has a FSM and a few methods. The state machine performs a hierarchical exit check (like a decision tree) every tic to see if it should change state, and if so what to, and then runs the current state if not. It usually calls methods from the agent, though some states have their own methods (which die along with the state which can be a good thing in some situations).

In some cases I don’t use states, most of the action classes I talked about don’t, but I suppose it would be fine to just treat them as if they only have one state.

Sounds like a good arrangement. Lots of people say Finite State Machines are old fashioned, but I think with some modification they can do anything you need them to.

Hey everyone here’s an update.

The levels in the game will always look different, this is because the procedurally generation system I made.
A level consist of multiple rooms, and each room will be created out of several pre-made structures.
I made these structures by myself and saved them in text-format in xml-files. The system automatically picks some random structures and puts them together and that will result in another random room. Here are 3 examples:
(open the image in a new tab to enlarge)



Sometimes rooms look quite the same, this is because a lack of variation in pre-made structures.

Here is a short video showing a random generated level…

Hello hilkojj, very nice new project.

Your art style is very good and it’s interesting to see a game using the BDX.

@Wabby thanks!


Hey,

I’m back with a post about pathfinding, but I also updated the previous post about level generation.

This week I have been working on the pathfinding AI for the game.

First I tried to understand how the A*-algorithm works, after some experimenting I found out that this was pretty easy to use.

But then I had to think of a way on how to implement this in a platformer-game. This was a pretty complex problem, knowing that there’s gravity in the game, collisions, limited jump heights etc.

Fortunately I found these 2 blogs (here and here) that tackle these problems.

I had to map out every ‘walkable’ area in a level. But I also had to know which platforms are reachable from other platforms. So I had to compute every single possible jump.

I noticed that the jump paths in my game are almost parabolic.
So after a lot of messing with an equation made by this guy, I ended up with this parabola that represents a jump pretty good.
With h being jumpHeight and v being horizontal velocity.



Parabola In-Game, (Yellow = parabola, Red = real jump path)

With this parabola I could calculate which platforms are reachable from others.

But I also had to check if the Character would collide with a block during the jump, if so, the jump would fail and is therefore not selectable by the pathfinder.
Each square represents a tile the Character would travel through:


Now that the system knows every single possible jump, walkable area etc., a Point Graph/Navigation Map can be generated that looks like this:



Each dot represents a walkable node,
each green/orange line represents a possible jump
and each red line represents a fall.

With this Navigation-map the A* algorithm can find the shortest path between 2 nodes.

Here is a video showing the pathfinder in action. (The character is being controlled by the AI, not by me)

Thanks for reading/watching!

You should be able to derive an arc that exactly represents a jump performed by your players, if you correctly model the forces and duration of the jump.

Would you be able to share your source behind the AI movement mechanics?

The A* pathfinding is cool and I enjoyed your little excerpt on how you did it too. I liked how you took a complex problem and broke it down into simple chunks for us to digest.

Nice, man :slight_smile:

Really cool.

When it comes to AI I have a tendency to just go with “dumb AI”. Taking in to account the fact that a monster is usually on the screen for a short time and dies quickly then it doesn’t matter that much if the monster’s behaviour is complex or simple.
Sometimes a monster that walks back and forth stopping at impassable objects is believable enough.
Also, lots of platformers have these “moving obstacle” type monsters and their predictable patterns of movement are what make up the gameplay.
Sometimes having too many smart monsters that follow you too efficiently can make the game less interesting as you get owned again and again by these hyper intelligent, always focused enemies. You might need an aditional mechanic like aggression cycles (the enemy is only aggressive for a period of time, perhaps they stop at random times to do a lengthy fidget animation) or visibility checks (the enemy only attacks when it can see you) or perhaps make them slower or jump less far than the player.

However smart AI like this can be great for adding interest to Boss encounters or including Friendly characters in the game. Have you considered adding a sidekick or an escort type event? Maybe guide the unicorn back to the exit…

Yeah, I know that my method is not exactly accurate, but most of the time it works good enough. And I don’t mind if an enemy sometimes fails at making jumps, they’re dumb anyway.
But thanks, I appreciate it. I would have looked into it if I had more time.

@Lucrecious hey, thanks!

@Smoking_mirror,
Thanks, I agree.
More than a year ago I called this “enemy AI”. It wasn’t fun at all, the enemy was just running and jumping as crazy, trying to hurt you.
I really try to overcome that this time, because having 10 enemies that can follow you perfectly are also not fun at all.

Thanks for the tips.
I also thought of having some kind of archers that find a place in the level where they can shoot at you without obstacles in front, and they use this pathfinding AI to walk/jump to that place. Or having a friendly dog that helps you attacking enemies.

Maybe guide the unicorn back to the exit…
Yay yay yay that’s a really good idea, haha

It’s amazing how much you’ve improved in all aspects since then. Keep going, I think this could be a great game!
SolarLune has a blog which shows some good ideas for types of enemy behavior.
There’s a great one (maybe robot monkeys ??) where an enemy runs after you and steals something and you have to chase it. Chasing a smart enemy could be more fun than trying to kill one.