Jump to content

Jotunson

Community Members
  • Posts

    22
  • Joined

  • Last visited

Everything posted by Jotunson

  1. @sanderd17 Sorry I messed up. I was kinda in a stressy haze. Thanks for informing me about the possible legal implications, I didn't know and decided to send it like this to save space in sending it to people. I totally understand that you don't want to go through a bunch of code that you've never seen before. Thank you for all your help on my last posts and for making an effort here despite my fails, you have truly helped me huge amounts.
  2. By the way, there's some bad code in there because I had to rush some part of the development and create some quick fix hacks.
  3. @sanderd17 Sorry it took a while, thank you very much for doing this. I'll understand if you don't do it, but if you do could you send me a copy of the linux build that I could send on to others? @niektb I also sent Sanderd a link to the repo of the library I wrote, it's needed to make it work, however I don't want it to spread too far (but i'll pm it to anyone who wants it). https://www.dropbox.com/s/4ccyjl1chpe450v/0%20A.D.%20master%20thesis%20diff.rar?dl=0
  4. Sorry, I didn't mean that I wasn't getting the stuff, will be sending it in a sec.
  5. Hehe, fair enough. I didn't quite have the time to make sure my master thesis library is cross-platform, so It won't work on Linux without at least a recompile and probably some re-coding. . Thanks for your interest (and your help on earlier posts), I really appreciate it.
  6. It's already a compiled binary, my internet is really bad so I had to ask a friend to upload it for me because my connection kept dropping. I totally understand your concerns very well, I will get you a diff asap.
  7. By the way, it's a large file because I had to make some additions to the Pyrogenesis (simulations) to properly communicate with my project, so this is not just the bot, but also a build of the game.
  8. Hi everyone, I'm not sure if this is the right place to post thins, I've developed a modification to the Petrabot to test my masters thesis project, but I am in desperate need of some more people who can test it by tomorrow (Tuesday 31/05/16). I realize this might have been a bit rushed, but If anyone has the time to run through a few matches of the 0 A.D. today and answer a questionnaire I would really appreciate it. Here's a link to download my modded version of 0 A.D and the Petrabot. as well as a questionnaire and a set of testing instructions. Sorry, this build is Windows only, I didn't have time to develop it cross platform. https://www.dropbox.com/s/fvs289o0zbnfkq2/ZeroAD.zip?dl=0 One again, if you find the time to help me out, I would be extremely appreciative. Please send any questionnaires to 0adMasterThesisTesting@gmail.com.
  9. Sorry about the late reply, got drowned in work. But Thanks for all your help. I got it sorted because of you guys.
  10. Thanks @Loki1950, I mainly need it to be portable, so I can test it on multiple computers. I'll preferably be using an 8GB usb for this.
  11. I mean, when building the game in visual studio, does the exe include mods (like the petrabot) or do I have to include them in a custom directory? I have a custom moddification of the petrabot that I am going to test later today @niektb.
  12. Hi there, I've been looking around and I could only find information about this regarding the OSx or Linux builds, so I was just wondering: are the mods included when building on windows? or do I need to add them to a folder if I want to deploy the game with mods on other pcs?
  13. Thanks Jonbaer, changing ToJSVal<int>(cx, &name, *val.name); into JS::RootedValue name(cx, JS::Int32Value(*val.name)); worked!
  14. So it turns out that all the integer values are mutated somewhere in being called in GetEmoState or being converted to JS, all int values are mutated to something completely different. Usually a really high or low number. The odd thing is that this mutation only happens to integers, while my doubles all stay intact. I've so far changed pretty much all values in the EmoState to const, however, after outputing all integers from the EmoState they're all correct.
  15. I don't have a repo fork yet as I don't want to implement the C++ version into the game as I feel it might be better to add it fully as JS. I will definitely post updates as I go along. Thanks for this help, I will get back to you once I've attempted it.
  16. Hi, I am currently finishing up a project on implementing some emotions in the Petrabot to test a library I've written in C++. However I have run into a problem regarding the data transfer between the Pyrogenesis C++ layer and the mod javascript layer. I apologize for the amount of code in advance, but I am completely stumped as to where the error might be happening. In short, I am trying to convert data contained in a data wrapper class I've made to transfer data from the library. As far as feedback is concerned the data seems to be sent properly without any hiccups as the Javascript end seems to recognize the emotions vector as an object. However, the problem arises when I try to reference the "who" integer as it returns as undefined (this may very well be the case with more of the members of the Emotions wrapper, however I have no evidence that this is the case as of yet). class EmoState { public: class Emotions { public: int who; int strongest; std::vector<const Emote> emotes; Emotions::Emotions(); Emotions::~Emotions(); void SetWho(int s); void SetStrongest(int s); void AddEmotion(const Emote& e); }; int strAt; std::vector<Emotions> emotions; EmoState::EmoState(); EmoState::~EmoState(); void SetStrAt(int s); void AddEmotions(Emotions& e); }; The when the bot requests the data through GetEmoState (below), the C++ architecture fetches the current EmoState (which I've confirmed functions correctly through multiple tests) and tries to convert it for use with the bot. (Though I doubt this script contains the error, I included it to give a complete view of what's happening), static JS::Value GetEmoState(ScriptInterface::CxPrivate* pCxPrivate, int playerid) { ENSURE(pCxPrivate->pCBData); CAIWorker* self = static_cast<CAIWorker*> (pCxPrivate->pCBData); JSContext* cx(self->m_ScriptInterface->GetContext()); JS::RootedValue emoState(cx); const EmoState emoStates = self->ValTest.EmotionalState(playerid); self->m_ScriptInterface->ToJSVal<EmoState>(cx, &emoState, emoStates); return emoState; } The data conversion I wrote to handle the container is as seen below, I suspect that the error lies somewhere in this block of code, however I am not sure what I might have written wrong. template<> void ScriptInterface::ToJSVal<Emote>(JSContext* cx, JS::MutableHandleValue ret, const Emote& val) { JSAutoRequest rq(cx); JS::RootedValue who(cx); JS::RootedValue name(cx); JS::RootedValue intensity(cx); JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); if (!obj) { ret.setUndefined(); LOGERROR("Failed to create emote object"); return; } ToJSVal<int>(cx, &who, *val.directedAt); ToJSVal<int>(cx, &name, *val.name); ToJSVal<double>(cx, &intensity, *val.intensity); JS_SetProperty(cx, obj, "directedAt", who); JS_SetProperty(cx, obj, "name", name); JS_SetProperty(cx, obj, "intensity", intensity); ret.setObject(*obj); } template<> void ScriptInterface::ToJSVal<EmoState::Emotions>(JSContext* cx, JS::MutableHandleValue ret, const EmoState::Emotions& val) { JSAutoRequest rq(cx); JS::RootedValue who(cx); JS::RootedValue strongest(cx); JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); if (!obj) { ret.setUndefined(); LOGERROR("Failed to create emotions object"); return; } JS::RootedObject em(cx, JS_NewArrayObject(cx, 0)); if (!em) { ret.setUndefined(); LOGERROR("Failed to create emotions object"); return; } for (size_t i = 0; i < val.emotes.size(); ++i) { JS::RootedValue el(cx); ScriptInterface::ToJSVal<Emote>(cx, &el, val.emotes[i]); JS_SetElement(cx, em, i, el); } JS::RootedValue em2(cx); em2.setObject(*em); ToJSVal<int>(cx, &who, val.who); ToJSVal<int>(cx, &strongest, val.strongest); JS_SetProperty(cx, obj, "who", who); JS_SetProperty(cx, obj, "strongest", strongest); JS_SetProperty(cx, obj, "emotes", em2); ret.setObject(*obj); } template<> void ScriptInterface::ToJSVal<EmoState>(JSContext* cx, JS::MutableHandleValue ret, const EmoState& val) { JSAutoRequest rq(cx); JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); if (!obj) { ret.setUndefined(); LOGERROR("Failed to create EmoState object"); return; } JS::RootedValue strAt(cx); ScriptInterface::ToJSVal(cx, &strAt, val.strAt); JS::RootedObject em(cx, JS_NewArrayObject(cx, 0)); if (!em) { ret.setUndefined(); LOGERROR("Failed to create EmoState object"); return; } for (size_t i = 0; i < val.emotions.size(); ++i) { JS::RootedValue el(cx); ScriptInterface::ToJSVal<EmoState::Emotions>(cx, &el, val.emotions[i]); JS_SetElement(cx, em, i, el); } JS::RootedValue em2(cx); em2.setObject(*em); JS_SetProperty(cx, obj, "strAt", strAt); JS_SetProperty(cx, obj, "emotions", em2); ret.setObject(*obj); } As mentioned before, the javascript code (as seen below) requests the data, which is then applied to their relevant variables on the javascript end. The specific problem variable in the script is the "eS.who" variable which returns undefined and as such the if statement defaults to else. let emoState = Engine.GetEmoState(PlayerID); let pHF = this.PersonalEmoState.HopeFear; let pJD = this.PersonalEmoState.JoyDistress; let pPS = this.PersonalEmoState.PrideShame; for(let eS in emoState.emotions) { if(eS.who === PlayerID) { this.PersonalEmoState.Strongest = eS.strongest; this.PersonalEmoState.PrideShame = eS.emotes[0].intensity; this.PersonalEmoState.JoyDistress = eS.emotes[1].intensity; this.PersonalEmoState.HopeFear = eS.emotes[2].intensity; this.PersonalEmoState.SatisfactionFearsconfirmed = eS.emotes[3].intensity; this.PersonalEmoState.ReliefDisappointment = eS.emotes[4].intensity; this.PersonalEmoState.GratificationRemorse = eS.emotes[5].intensity; } else { let pGA = m.EmotionHandler.SocialEmoState[eS.who].GratitudeAnger; m.EmotionHandler.SocialEmoState[eS.who].Strongest = eS.strongest; m.EmotionHandler.SocialEmoState[eS.who].AdmirationReproach = eS.emotes[0].intensity; m.EmotionHandler.SocialEmoState[eS.who].HappyforResentment = eS.emotes[1].intensity; m.EmotionHandler.SocialEmoState[eS.who].GloatingPity = eS.emotes[2].intensity; m.EmotionHandler.SocialEmoState[eS.who].GratitudeAnger = eS.emotes[3].intensity; if(gameState.isPlayerAlly(eS.who)) { pJD = (pJD === this.PersonalEmoState.JoyDistress ? 0 : this.PersonalEmoState.JoyDistress); pPS = (pPS === this.PersonalEmoState.PrideShame ? 0 : this.PersonalEmoState.PrideShame); if(pGA !== m.EmotionHandler.SocialEmoState[eS.who].GratitudeAnger) { pGA = m.EmotionHandler.SocialEmoState[eS.who].GratitudeAnger ? 0 : this.PersonalEmoState.PrideShame; this.Config.personality.cooperative = Math.max(Math.min(1, this.Config.personality.cooperative + ((pGA + pPS + pJD)/3)), 0); } } } } this.StrongestAt = emoState.strAt; Once again, I am very sorry for the long post and mass of code. I hope someone will be able to help me as I believe I can make this a cool update. If my tests of the system are successful I am planning on developing a fully Javascript version of my library, which I'll submit as a fork to the Petrabot for people to play with as they want.
  17. Thanks for the confirmation, that is much appreciated. I can read the code, I am just not sure what scripts define the data on the JavaScript side to transfer it to and from the agent..
  18. Hi, I am testing out a C++ library I've written to add extra functionality to an artificial agent. I have so far implemented the C++ end into the CCmpAIManager to transfer data to and from the Petrabot for testing purposes. As such, I was wondering what scripts I would have to modify on the Javascript end to transfer my custom data to and from the bot and if CCmpAIManager would be the best entry point. Further, if the system yields the desired results I would be interested in developing a dedicated version for a fork of the Petrabot (likely fully in javasript) as I think it could be a great addition to the system. I can't say too much until the results are in, however, I will update if anyone's interested. Regards Jotunson
  19. Hi, I'm using 0 A.D. to run some tests on some AI functionality I've been developing, more of a proof of concept than anything else. Anyway, for one of my next tests I want to pit my modified AI up against another, however, I can't seem to find what's blocking the creation of matches containing only AI. Could someone tell me where I might find and modify that code, and possibly if there are any larger implications to doing so?
×
×
  • Create New...