October update! (yay!!)

It's been already more than 10 monthes since the last update here... It's really hard for me to be consistent in the frequency of posts on this blog. The good thing is that I don't work on the game only when I post new stuff here 🙂

Despite the limited number of hours I can work on the game each week, I did a lot of things, amongst which (I'm more verbose about these items after the list):

  1. Switched to UE4
  2. Started to implement AI using behaviour trees of UE4 and action planners.
  3. Made every features of the gameplay working in local standalone games as well in networking games
  4. Implemented a working system of periods / possessions like a real basket ball game
  5. Added numerous visual debug tools
  6. Use external CSV files to defines the properties / abilities of the playable heroes
  7. Started to create animations myself to add more "life" to the game

  1. As soon as Epic released UE4, I bought the subscription. I really felt I was not as efficient as I should have been with UDK. The lack of a decent code editor and moreover a debugger was a real pain in the neck, and I was more than happy when Epic announced that UE4 was full C++, meaning I could use Visual Studio again. Porting the code from unreal script to c++ was really easy, as the class architecture was almost the same. I think it took me between 10 to 15 hours to convert the code base, which is far less than my expectations at that time.
    My experience with UE4 so far is very positive. The editor is very useful, pretty stable, and tons of new stuff are added release after release. Hot reload (to compile the code while the editor is running in debug mode in Visual Studio), although a bit buggy and limited at the beginning, now allows to never close the editor, which results in a huge speed up in the iteration process. Up until now, I didn't use a lot of features, but each time it was very easy to achieve what I wanted to do. Epic seems to listen to the community a lot and improves the editor based on the feedbacks. Moreovern Epic is pretty responsive when it is about accepting pull requests you submit to them through GitHub, and does not forget to credit you in the release note, which is good for the ego :p
  2. Epic has implemented Behavior Tree in their editor to manage AI. It's pretty easy to understand, supports latent tasks to "freeze" the execution of the graph while a task is running, and of course allows you to create custom tasks / decorators / services. It's really easy to debug, as you can visually see diretcly on the graph which task is being executed by each bot.
    On top of the behavior trees, I implemented a system of Goal Oriented Action Planning in the services. I won't talk about this a lot, as I plan to write a dedicated blog post the implementation. But in summary, a service is a piece of code which is run periodically, and "in parallel" of the currently executed task. On the above picture for example, the behavior tree can only execute one task at a time, out of the available 4 (the violet boxes). But a service (the green box) continues to be executed while the behavior tree is executing a child task. This allows to make the bots take some decisions while actually doing something.
    For now, the AI of the bots consist in a few things: "controlled" behaviors: the situations when the game takes control of everybody, bots and players, to run specific behavior, like the jumpball, the throwin when a basket is scored... - basic attacking behaviors: pass to the teammate if he is closer to the attacking hoop, drive to the basket, shooting the ball, dunking, jumping for an alley-oop,finding the best position on the court - very basic defending behaviors : for now, bots just follow the ball owner. I'll improve their defending skills when I will master the item list #6 a bit more.
  3. When I started this game with UDK, I had in mind to make it first playable locally, as a standalone game, and then to implement the networking stuff later. I completely changed my mind when I started from scratch with UE4. Now, everytime I start a new feature, I don't finish it until it works completely both in the standalone version and the online version. I realized after looking at the samples provided by Epic that if you intend to make your game playable online, it has to be forseen right from the beginning as the flow of the game is (obvisouly) completely different. Fortunately, the way Epic exposes replication and RPC is very convenient, and once you have a good understanding of how things work, it's pretty easy to move forward.
  4. Well, nothing fancy here 🙂
  5. I implemented the same kind of debug menu as here. This menu allows me to:
    • replace the fixed camera by a free one which allows me to travel in the level while the game is paused. This is very useful to debug collision problems, or trajectories going wrong.
    • show pathfinding information, like the target and the path the pawn will follow
    • show the various trajectories I use for the ball (when passed or shot) or for the players (currently, only when they dunk or do alley-oops)
    • display useful textual information like the position / velocity of the players, their distance to the hoops
    • see the collision meshes, the traces I may use sometimes (for example to check if the access to the hoop is free of any defender)
    • help debug AI behaviors: I can see for each bot which behavior tree it is using, and which action was chosen in the action mapper
      BasketBall Game Preview Standalone (64-bitPCD3D_SM5)     BasketBall Game Preview Standalone (64-bitPCD3D_SM5)_2     BasketBall Game Preview Standalone (64-bitPCD3D_SM5)_3
  6. There is a built-in support in UE4 for importing CSV files. You just need to create a C++ structure which maps the columns of the file. You then have an array of this structure, and you access each line with an identifier (the first column of the CSV). It allows designers to quickly and easily change the values in the file, and then re-import the file in the editor. It's great for the player abilities for example, as you can see in a glimpse how a player stands compared to the others for his success chances when shooting a 3 points for example.
  7. This is the newest thing I've been working on lately. I used the basic animations available in the starter packs packaged in UE4, imported them in 3DSMax, and started to create custom animations, because it was getting difficult to understand what the players were doing. (there was only animations for idle / jumping and walking / running). I've started to produce very crappy animations for shooting / passing / pushing. This also allowed me to start using the (very complete) animation tools from the editor. It's a lot of WIP right now, but I'll try to share some videos each time I integrate new animations.

As I said everytime, I'll try to share more content on a more regular basis (maybe every 2 weeks? or every month?) to keep you posted on the new things done in the game. Let's hope I can fulfill this promise for once 🙂

2 thoughts on “October update! (yay!!)

  1. Hi Michael,

    I stumbled onto your blog after looking for reference info around basketball AI behaviour trees. Just wanted to say hi and wish you all the best with development! I'm also working on a basketball game (although streetball focused) using Unity3D. Your posts are a good read and am looking forward to reading about future progress.

    If you're on Twitter you can find me on @hulkamaphone although not a lot of dev stuff posted as yet as I'm still early in prototyping and learning to code.

    Keep up the good work!


  2. Thanks for your comment and your encouragements. I plan on writing a post where I'll explain what I have implemented for the AI of the bots.

    But as I'm playing with animations integration right now, I now realize I will have to modify the system a bit, because I sometimes have to wait for events when playing montages. This will make me have to hold the execution of the behaviour trees until I catch one of these events to resume it.

    Hopefully it will be up soon

Comments are closed.