51 (edited by Genroa 2015-05-04 18:38:21)

Right now the engine uses the default BGT sound system, but in a future version full 3D sound is planned with the FMODEx library smile but before that 360 degrees rotation will be added with a modified soundpool.

Seal : some audiogames like A Blind legend are being developed with professional engines (Unity). The goal of this engine isn't to make something as good as this, the goal is to give a simple and accessible audiogame engine to help developers creating cool games without being stuck by the technical aspect.

Thumbs up +1

52

Okay, so here is the code where I have no wait functions or loops for my menu and it opens without issue. Could that be because I have music streaming? The code contains function calls for Speech Manager, and those are kinda working, just NVDA isn't, even though the NVDA DLL is in the same directory. It's also in includes.

#include "dynamic_menu.bgt"
#include "/bgtstuff/firstshift/includes/speech_manager.bgt"
//The main menu, speech and other things.
speech_manager speech;
sound music;
void main()

{

speech.init("Config.dat", "9223315");
music.stream("sounds/music/mainmenu.ogg");
music.volume = -10;

show_game_window("Test");
dynamic_menu menu;
set_error_output("error.log");
music.play_looped();
int result;
menu.set_speech_mode(speech.mode);
menu.set_tts_object(speech.sapi);
menu.add_item_tts("start");
menu.add_item_tts("Speech Options");
menu.add_item_tts("exit");

result=menu.run("Please choose an option.", true);

if(result==1)
{
alert("Sorry", "This option is not available yet.");
}
else if(result==2)
{
speech.configure();
}
else if(result==3)
{
exit();
}
}

Here is my current code that exits immediately upon startup.

#include "HeatEngine\\Game.bgt"
#include "dynamic_menu.bgt"
Game game("Test");
sound music;

void main()
    
{
        dynamic_menu menu;
int choice;
menu.add_item_tts("New Game");
menu.add_item_tts("Continue Game");
    menu.add_item_tts("Exit Game");
    
    choice=menu.run("Please choose an option from the following menu.", true);
    
    if(choice==-1)
{
        alert("Error", "There was a problem with menu loading.");
        exit();
}
    
    if(choice==1)
{
        alert("Unavailable", "Map file unavailable.");
}
if(choice==2)
{
        if(file_exists("saves\\save.hemap"))
        game.config.setMapFile("saves\\save.hemap");
    else
        alert("Woops", "There is not a saved game to load.");
}
    
    
    if(choice==3)
{
        exit();
}
}
Orin

Thumbs up

53

I don't understand how the first program can run without exiting O_o

Thumbs up

54

I know--it's pretty much the same idea.

Orin

Thumbs up

55

The dynamic menus run method contains it's own loop. That's probably the reason the first one works.

Some of my games
Keep up to date by following @Jeqofire on twitter!
Ear Ninja?

Thumbs up

56

But the run method is called in each example! That's why I don't understand where is the problem

Thumbs up

57

I'll have to try loading up Heat Engine in the first example to see if it breaks. If it does, it may be something with the global Game class.

Orin

Thumbs up

58

Remove the include and everything about H.E.. If the problem remains then you will know that it doesn't comes from H.E. smile

Thumbs up

59

It could be because of the fact that, does h-e use a loop too? Because if so, you're gonna need to make a callback that runs any loops in the menu, I think it looks like this.
int loops([email protected] m, string d)
{
//put stuff to do here
return 0; //gotta return 0 or it closes.
}

----------
An anomaly in the matrix. An error in existence. Neo, without Morpheus. A being who cannot get inside the goddamn box! A.K.A. Me.

Thumbs up

60

Normally the Game constructor does nothing by itself, no loop and all. So it shouldn't block the program. The game.run() is blocking but nothing else.

Thumbs up

61

Alright everyone, it must be something with the Heat Engine. Removing everything related to HE, and calling show_game_window, it's working great here. Is it maybe because I'm making/calling the game object for HE before void main()?
Anyhow, here's the new code. If I can use show_game_window while using engine functions, that'd be good as there's some issue with the game object.

#include "dynamic_menu.bgt"

void main()
    
{
        dynamic_menu menu;
int choice;
show_game_window("test");
menu.add_item_tts("New Game");
menu.add_item_tts("Continue Game");
    menu.add_item_tts("Exit Game");
    
    choice=menu.run("Please choose an option from the following menu.", true);
    
    if(choice==-1)
{
        alert("Error", "There was a problem with menu loading.");
        exit();
}
    
    if(choice==1)
{
        alert("Unavailable", "Map file unavailable.");
}
if(choice==2)
{
        alert("Woops", "There is not a saved game to load.");
}
    
    
    if(choice==3)
{
        exit();
}
}

HTH.

Orin

Thumbs up

62

H.E. opens the game window itself when the run method is called (which may be stupid, I know), but the doc explicitely explains that calling show_game_window more than once in the game isn't a problem.

The Game object HAVE to be created exactly like how you did, so the problem isn't coming from here. It has to be a global variable called game.

I really don't see from where the problem may come...I'll try to find out.

Thumbs up

63 (edited by Orin 2015-05-07 15:01:10)

Calling show_game_window worked, thanks. Now that I know HE calls show_game_window when the game level starts, will there be two Windows? So, when I call it for the menu and when the engine calls it for the first level when I call game.run? Is there a way to close that extra window once game.run is called?

Orin

Thumbs up

64

According to the BGT doc, calling show_game_window more than once will just rename the opened window, so it causes no problem smile

Thumbs up

65

What is the easiest way to create a character with the character class? Should I modify the character class with pathes for the various step sounds, etc, and do that for multiple characters such as the player and any AI actors? I guess I should just use normal sound stream playback for music during levels? There's the ambience in HE, but trying to figure out how I'll set up my own game before I screw up any of the classes without meaning to. I make backups, but that's beside the point. I'll also modify the keys in fpControler so that I can use the arrow keys.
Thanks.

Orin

Thumbs up

66 (edited by Genroa 2015-05-08 09:55:07)

The character class is one the most changing classes in the engine for each version tongue and that's the good actor to use for playable characters and enemies. This is basically an actor which can be controled and have built in functions to make it move, with sounds for footsteps in all directions, etc.

Two solutions to make your character : if it is only exactly the character behaviour that you're looking for, you can use it in mapfiles with no modification and just configure the sounds paths and values. If you want to add functionalities like health, jumping and all, you should create a new actor (class) inheriting from the Character actor and use this one. You should never modify the default actors because they may be used by other parts of the engine, and so modifying their behaviour could destroy the whole engine.

To make ambiences, there's an AmbientSound actor. Its configuration in a file is very simple, you just have to set the sound path and the volume.

For a sidescroller I wouldn't use the standard FPControler wich is made for first person controls. But if you make something in first person, making a modifyed version of the FPControler is very simple : the first lines define some constants linked with keyboard keys. You just have to copy/paste the class, change the constructor, parameters and class name, and modify them. smile (don't forget to rebuild the engine after adding a new actor or controler!)

Thumbs up

67

I'm curious: Have you released the sidescroller controller?
In any event, to make characters and such, I just take the character.bgt file, paste it in a new file and modify the properties in it to create a new character for my game, save it in the actors folder, rebuild the engine and I can then use it in the maps file? Sounds... better than doing it from scratch, at least.
Same goes with the weapons? I suppose the Inventory is different since I'd have to create custom item actors and then atatch it to the inventory whenever a character picks said actor/items up...

Orin

Thumbs up

68

Right now I'm very busy, but I will try to release the sidescroller controler this evening.

In order to make a special Character, you have to:
1. Create a new BGT file containing the actor class, like for any others, in the Actors directory.
2. Make this actor inheriting from the standard class that you want (here, the Character actor)
3. That's all.

Things can become tricky if you want to add new functionalities to actors (and that's why you want to create new actors, so read carefully smile ) :
- you can add new functions with no problem wink
- but functions like: tick, gameStarted, parseObject, load and the constructor should (must!) always call the superclass same function first. It may end in strange behaviors if you don't!
- some functions like parseObject and load have to be overriden when you add new attributes (class variables) to your class. Each function is very precise and the format of what you write inside them should follow the one which can be found in any standard actor class)

Same goes for the weapons. For the inventory, no need to override this class, most of the work will be done by the controlers

Thumbs up

69

Here's the link to the SideScrollerControler, to link with a Character actor. An example project will be released when I'll have more time : https://www.dropbox.com/s/jdyohjo4ouyk5 … r.bgt?dl=0

Thumbs up

70 (edited by Genroa 2015-05-17 15:45:33)

@Lucas (on the Let's Code folder) : The cast syntax is coming directly from the AngelScript reference : it is made to convert (cast) an object into another class. For example, if you have an array of @Items objects, you can store any object from any child class of Item. But because of this, when you get the item handle, you can't know which thing it was. Or in other cases, you know a function will only accept an object and no object from a child class, and you want to use this object (example : operators overloading). So, you convert it. The cast works only with handles if think, and will return a new handle of the asked class, or null if it is not possible smile (for example you want to cast an object from class A to class B but B isn't a child class of A, or cast from B to A but B isn't a child class of A, etc.)
I often use it because the engine has to handle a lot of different objects, including classes I will never know because creators can make their own.

This can also be used like the instanceof Java keyword, in order to know if an object is an instance of a given class.

Java :

if(myObject instanceof myClass)
{
//stuff
}

BGT:

if(cast<myClass>(myReference)!=null)
{
//stuff
}

Thumbs up

71

Oh. My Gooooosh.

This sounds amazing! I'd definitely have a myriad of uses for something that simplifies BGT to this extent. I know I'll still have to do a lot of coding but I don't mind that. Having an engine that simplifies things like maps and characters is perfect for my plans.

Should I download it now or wait until you've added more features or something? I'm just really excited about this. big_smile

Thumbs up

72 (edited by Genroa 2015-05-18 20:06:35)

Like naugtur said on another thread : "My idea for an engine is to provide a way to build the world declaratively, from objects having position, dimensions and sounds, and control them in an event-based environment. So, instead of working on an array and deciding everything in every iteration of your main loop, you'd declare a sound to play on collision with the object and never worry about it again. Interactive items could have sounds attached to events, and you'd just trigger events on them."

At this moment, if you want to make a complete game with it, you may be a little bit limited, and programing will never be erased from the game development. If you want a new special actor, you will have to program it.

So, because it is in an early stage, you will still have to program a lot of actors, and a lot of feature are unfinished. But you can already try some demos and begin programing with it. Upgrading to new versions of the engine for a project is almost never a problem, as long as you don't modify the engine default files. smile

You could also wait for next versions : a map editor is under development for the engine, coming in the next version. smile

Thumbs up +1

73

I think I'll get a better grasp on the rest of BGT for the moment, and download it when I think I'm capable enough to make full use of the features I'll require. smile

I'm keeping an eye on this thread to see how things develop in the meantime. Keep up the awesome work!

Thumbs up

74

Good idea. Don't forget to take a look at the Robot Factory demo to have a little idea of how the engine works, and improve your BGT skills until I release a more advanced and easy to use version wink

Thumbs up

75

Can you also make a character and actor editor as well? Then you can go into the Map editor and atatch said charactors to the maps or whereever they needed to be.

Orin

Thumbs up