Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Announcements and Showcase
2D AI (NPC) Behavior

2024-02-21 14:24:27

Hi there folks! I have released a new extension a few days ago but haven't announced it here. I just recorded and uploaded a video tutorial (a very bad tutorial tbh) on YouTube. So I wanted to announce the extension.


So the extension allows you to create 2D characters for your 2D games with tonnes of features.

Below are some features of the behavior:-

Tag system:- Use tags for the AI and Players (helpful when creating teams and different groups of NPC's).
Automatic Health/Damage calculation (Requires 2D weapons extension)
The activation system (Activates the AI when the enemy comes in range)
Chase system (start and stop chasing the enemy when in and out of radius).
Random Patroling system (Define area to roam/patrol randomly)
Death detection (automatically remove the ai after death)
Automatic collision detection and obstacle avoidance when roaming/patrolling.
Various actions to execute in various situations.
Automatic shooting (Requires 2D Weapons Extension)
Go back to the initial position if idle
Go back to patrolling/roaming if not chasing the enemy
Automatic enemy detecting
Waiting when roaming/patrolling
So many toggles for various features
and many more, watch the video tutorial

Here is the list of actions that you can execute for AI:-

Action on Move (do something if AI is moving)
Action on Wait ( do something while waiting when roaming)
Action on Activate (Do something when AI gets activated)
Action on DeActivate (Do something when stop chasing)
Action on Shoot (Do something when AI is attacking/shooting)
Action on Reload (Do something when AI is reloading weapon)
Action on Idle (do something if AI is idle)
Action on Hit (do something when AI receives damage)
Action on Death (do something when AI is dead)
Action on Collision (do something when collided with something while roaming)
Action on Enemy Collision (do something when colliding with the enemy)

It also allows us to use some special CopperCube variables:-

nodename.hit ("true"/"false") - execute the action on hit. (number) - health of the provided AI

The above variables allow you to have a health/damage system to work even if you don't have a 2D Weapons script.

I couldn't cover everything in the video tutorial but I tried to give details about each option. Watch the video tutorial here:-

The video also showcases some other extensions like 2D platformer, 2D camera, and 2D shoot (unreleased) behavior as well.

Hope that somebody will find this extension useful.

Registered User
2024-02-21 18:17:47

This is cool. I can only imagine how much effort was put into it.

Don't you plan supporting Tiled maps

2024-02-22 03:05:34

Thanks @okeoke, Actually, I was working on many extensions side by side when developing this specifically for 2D, so yeah I put a lot of effort into this. The collision and automatic enemy size calculation was a bit of a trick but I am glad that it worked out in the end. Everything else was just added for the wider use case of the extension.

It's actually, the 2D shoot (Bullet) action that's more interesting and allows you to create any type of weapon in just a few seconds and you can control everything. The ammo, Magazine, reload stuff, and all. I will release that extension soon enough in public as well.

Regarding Tiled Maps, I think something similar was already been done by @sven, to create levels in CopperCube, one can also use the CopperCube room editor to create levels just like Tiled in CopperCube. Just use the floor, and create your level stuff. I think @niko can extend the floor maker window so that we don't have to add textures manually for "floor1", "floor2" etc. but instead simply select the texture from the texture panel and start painting the floor. There should be just toggles for what you are painting, like walls or floors, etc.

That way we can simply paint the floor with different tiles, create a room without ceiling and wall, and then simply rotate and align it in the scene.

Otherwise, something like @sven's level editor is sufficient to be used in Coppercube for Tilemapping.

I will try to look more into the Tiled level editor to see if we can directly import levels created with it in CopperCube.

Registered User
2024-02-24 00:13:31

Good job Just_in_case! Amazing plugin! Your work have very quality!

2024-03-20 18:38:15

Hi, does it work with 3D objects ? I want to create a 3D side scroller game, so I was thinking if this will help me in creating AI for my game?

2024-03-23 11:47:50

I am expecting a reply, please answer if this extension of yours will work with 3D animated objects or not, I do need a good NPC system for my 3D sidescroller, I thought of using your beat them up game demo as example but the NPC has limited functionality there. Please confirm if this extension of your will work with 3D or not?

2024-03-23 13:43:46

I think the 2D controller uses sprites (not 3D) and requires physics-simulation setting enabled in windows publish settings.

You could probably recode it to use 3D if you know scripting and have the correct permission fro JIC to do so.

You don't actually need a controller at all for side-scroller games, but the plugin script adds so many great features that are hard/timely to add without coding. I'd highly recommend this plugin and advise you to try using 2D sprites for a 2D game, rather than 3D objects.

You can render your 3D objects as 2D sprites and they look identical to the 3D objects (you can render with baked lighting and normal-maps). There are many advantages in using 2D - main advantages of 3D in a 2D game is that you can child items to the joint-nodes (weapons/shields etc) and you can use dynamic lighting. If you really need 3D for 2D, you can set the z- depth of your 3D object to 0.1 to make it flat (2D), then set lighting to (none).

2024-03-24 05:11:24

@Guru, as Peter mentioned it only works with 2D sprite but You don't need to have physics simulation turned on, as the NPC's don't use any kind of physics mechanism you can use it without enabling the physics simulation.

As you already know about the beat'em up demo, I would suggest you to use that , if you look at the behavior than you can alter that or modify that behavior as per your need, there comes 2 behavior in that beat'em up demo, one is for AI and one is for player, so you can check and expand upon the AI animation.

For now I don't have any plans to create a 3D version of this, as there are already some extensions that does pretty good AI thing is available to the community, try using @sven's AI or others or just use the method proposed by @VP to create the game with just inbuilt behaviors and actions that will be time consuming but is definitely easy to use to create a good NPC system.

If you want to work with 2D games, then my extensions and plugins can help you a lot.

Create reply:

Posted by: (you are not logged in)

Enter the missing letter in: "Inte?national" (you are not logged in)




Possible Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]



Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact