• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Creature Sound phase one

Mike "riff"

Member
Joined
Dec 27, 2016
Messages
16
Reaction score
5
Location
Toled,Ohio
OTSound project

Latest News:
Sound project halted to address OTClient bugs: 2/8/17

Phase one: complete add single creature sound to game 2/5/17

Phase two: complete play multiple monsters and repeat for new creature. 2/5/17

Phase three: complete database: my OTClient database with all build file, SDK, and sound files. Be aware 4 gigs 17,000 + files at this time 2/6/17.
https://www.dropbox.com/sh/kkr5q5blbgykevx/AADsytcm8EMx15XxbUTphzpia?dl=0

Phase four creature attack sounds.

Phase five creature death sounds.

Phase six action sound.
more to follow.

data/sounds/ has more changes to it. It now include Music, creature, action, effects, voices.
will be also adding attack and death under creature.

I encourage those who are interested in sound engineer to start downloading files and add them to the correct directories. You can save, convert, and mix sounds with Audocity. Enjoy!

There is a bug in OTClient its being called at sprite loading call so I don't think it has to do with me unless a unforeseen memory issue is found. When I have time I might look into it.

If not installing my complete OTClient you will have to do the following installation
Install notes:
All you have to do, is get irrklang files put them in your SDK pack
then link header and lib
then make these changes to main.cpp and creature.cpp

Then get free monster sound from Open Game Art
put the sounds into your data/sounds folder
change there name to these files for the creature they sound like
exsample: rat.wav or
dragon.wav

The program will get the right files load them automatically and play it.

If someone would like to help the project by downloading sound and rename them that would be a big help so I can keep programming....

I'm using irrklang this is a professional sound engine just google them
Here are the code changes:
main.cpp:
Code:
#include <iostream>
#include <irrklang.h>

// To avoid having to put irrklang::before of the name of every class, we tell the compiler that we use
// that namespaces here.
using namespace irrklang;

#pragma comment(lib, "irrKlang.lib") // link with irrKlang.dll

int main(int argc, const char* argv[])
{
    std::vector<std::string> args(argv, argv + argc);

    // start the sound engine with default parameters
    ISoundEngine* engine = createIrrKlangDevice();

    if (!engine)
        return 0; // error starting up the engine

    // setup application name and version
    g_app.setName("OTClient");
    g_app.setCompactName("otclient");
    g_app.setVersion(VERSION);
Top of creature.h:
Code:
virtual void onPositionChange(const Position& newPos, const Position& oldPos);
    virtual void onAppear();
    virtual std::string creatureSound(std::string creatureName);//< added function
    virtual void onDisappear();
    virtual void onDeath();
Top of creature.cpp:
Code:
#include <stdio.h>
#include <irrKlang.h>

#include <string>
using namespace std;
using namespace irrklang;
ISoundEngine* engine = createIrrKlangDevice();

Creature::Creature() : Thing()

The sound trigger and sound player are in the creature.cpp file line 450(range)
Code:
/*
// this is my file detector test it checks if file name and path are correct
std::fstream fs;
fs.open("../data/sounds/demon2.wav");
if (fs.is_open())
{
fs << "lorem ipsum";
std::cout << "Operation successfully performed\n";
fs.close();
}
else
{
std::cout << "Error opening file";
}
*/

string Creature::creatureSound(string creatureName) {//< new function

   // can not move to own class we need variable m_name
   if (creatureName != m_oldName) {//< added this line to drop if creature still on screen
       m_oldName = creatureName; //< make old creature the new creature name
       // make music types ogg files and sound samples .wav format for all sound keep it simple
       string filePath = "../data/sounds/creature/", fileName, fileType = ".wav";

       fileName = creatureName;
       string soundFileName = filePath + fileName + fileType;

       // now the converted file name is in strBuffer. We can play it.
       engine->play2D(soundFileName.c_str());
   }
   return creatureName;
}
localplayer.cpp
This how I write code I write a story then change it to code languages.
I call it first pass method just to help others if start out like me.
Code:
        callLuaField("onHealthChange", health, maxHealth, oldHealth, oldMaxHealth);
        // call creatureSound, just got hit
        // Creature creature1;
        // mmmm no poison damage curse ect..long after
        // creature1.creaureSound(string creatureName);

        // get nearest creature to repeat creature sound
        // if error: test only list creature name to check for error this time
        // play creature sound here ok for now

        // cannot walk if dead
        if(health == 0) {
 
Last edited:
OTClient already support sounds, you don't need to use any external
Library. Check luafunction source to see what function you can use to play sounds, you can do all of this thought Lua API
 
I'm sorry but I am just learning c++ and lua got to confusing for me. The sound engine is very confusing so many libraries doesn't make a lot of sense to me. So I like the plain English and easy install of this library . I am always looking for tips but understand my limitations.

I tried for a month to learn lua and old sound engine without success and one day with this library and its works right out of the box and right now I'm happy to get this far. I hope I can finish it for the community. I don't know any complete sound project?
 
Last edited:
"data/sound folder" normal players cant play sounds, correct?
 
It is my hope that these file be put on the official otclient download so "normal" non programmers can dowmload ;)

I still need to make a large database of sounds plus a time repeater and buffer memory setup

However this library is easy to use so wont take long.

I also got to make a action sounds, effects sound, and then voice scripts.

my bad its data/sounds/ folder
 
Last edited:
I'm sorry but I am just learning c++ and lua got to confusing for me. The sound engine is very confusing so many libraries doesn't make a lot of sense to me. So I like the plain English and easy install of this library . I am always looking for tips but understand my limitations.

I tried for a month to learn lua and old sound engine without success and one day with this library and its works right out of the box and right now I'm happy to get this far. I hope I can finish it for the community. I don't know any complete sound project?

I don't have idea of any otserver with voices the monsters, only music/sound of areas respawn
You continue your project is good ;)
 

Similar threads

Replies
2
Views
510
Back
Top