Unable to run mod in latest build

Get help with installing and running the Cafu Engine here. This forum is also for general questions and discussion of all aspects regarding the Cafu Engine.
Post Reply
SoulRider
Posts:95
Joined:2014-04-06, 00:16
Unable to run mod in latest build

Post by SoulRider » 2014-09-05, 04:49

Hi Carsten,

I updated to the latest version of cafu, but now for some reason my mod doesn't load.

The -svGame Duel command loads up into the menu. I see the Duel Map, which is only in the Duel path, but when I load it up, although it loads up the correct map, I get an error at

HUD_main.cgui:125 - Bad Argument #1 to get:("Frags") variable frags is unknown.

This tells me straight away this is loading the script code from the DeathMatch path, as that is your code. My line 125 is updated to make use of my Score component and looks like this:

local kills = gui.Entity:GetComponent("Score"):get("Kills")

To confirm the game was running deathmatch instead of duel, I moved the DeathMatch folder, and the game crashed with a Microsoft error reporting box. once I tried to load past the menu.

It seems to be loading everything except for the scripts from the correct path. Is there any hard defined link to the script folder anywhere in the code?

I must advise this is also a brand new issue, it wasn't in the build I downloaded on the 28th August, but is in this latest build.

Edit-- I found the problem, the GUI path is hardcoded in the HumanPlayer file. I didn't notice it previously, as I had worked in the deathmatch folder before swapping over to duel, so the code was the same in both branches.. I am now completely independent, or at least, haven't found any other dependency issues yet :D

I would suggest not communicating directly with the GUI through a component.cpp file, as it makes the engine very inflexible if you want to be able to run more than one game from the same base code.

I also noticed a lot of non-dynamic paths in the .cgui files etc, it may be worth looking at a pathing system which automatically inserts the -svGame parameter that is passed to it, so the engine always goes to the right script files :D
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Unable to run mod in latest build

Post by Carsten » 2014-09-05, 13:48

Hi SoulRider,

thanks for your report!

Are you referring to the paths in Ca3DE/Server/ServerWorld.cpp? These are indeed a problem, and must be fixed.
Or also anywhere else?
Best regards,
Carsten
SoulRider
Posts:95
Joined:2014-04-06, 00:16

Re: Unable to run mod in latest build

Post by SoulRider » 2014-09-05, 17:03

Yes, I am referring to those paths, as well as the path in CompHumanPlayer.cpp for the GUI. I haven't come across any other C++ hard coded links yet.

I think there should be a rule of no game paths hardcoded in the c++ side of the game, as it breaks flexibility.
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Unable to run mod in latest build

Post by Carsten » 2014-09-06, 12:24

Ok, thanks!

I'm currently looking into the Prefabs related code and will get back to this as soon as the Prefabs are working, but in order to make sure that things don't get forgotten, I've filed these tickets:

Btw., a side question: Are you using the global variable Map anywhere in your scripts?

This is the Lua "alter-ego" of the root entity of a map, that is, in the Map Editor it's the topmost entity as shown in the Entity Hierarchy (if you rename it there, the global variable will be renamed as well).

I'm asking because I'm considering to make it local to the related .cent file, analogously to GUIs in .cgui files, as this would also help with implementing Prefabs.

The same topmost entity would then be obtained by a call to world:GetRootEntity() (this method does not exist yet, I'll implement it soon) or to some_entity:[url=http://docs.cafu.de/lua/classGameSys_1_1EntityT.html#ad44896acc43a83ea569e9775ef261946]GetRoot()[/url] (which already exists).
Best regards,
Carsten
SoulRider
Posts:95
Joined:2014-04-06, 00:16

Re: Unable to run mod in latest build

Post by SoulRider » 2014-09-06, 15:01

I am not using a call to the Map global variable currently.

As a quick question, what command would I use to search for all game entities with a specified component?
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Unable to run mod in latest build

Post by Carsten » 2014-09-06, 19:36

SoulRider wrote:I am not using a call to the Map global variable currently.
Ok, that's good, will proceed. :-)
As a quick question, what command would I use to search for all game entities with a specified component?
You could implement it in Lua yourself, i.e. use EntityT:GetComponents() to search the entity for the desired component, then use EntityT:GetChildren() to recurse.

But indeed, this would make a nice built-in, C++ implemented method as well, which does not yet exist. Do you want to give it a try (it would probably be a nice exercise), or do you want me to look into it? ;-)
Best regards,
Carsten
SoulRider
Posts:95
Joined:2014-04-06, 00:16

Re: Unable to run mod in latest build

Post by SoulRider » 2014-09-06, 20:32

I'll have a go and will get you to check/advise on the progress I am making or not... :D
SoulRider
Posts:95
Joined:2014-04-06, 00:16

Re: Unable to run mod in latest build

Post by SoulRider » 2014-09-07, 00:10

OK, It seems I really don't have an idea. I am not sure where to start.. Could you point me in the right direction, and I will have a go at the code :)
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Unable to run mod in latest build

Post by Carsten » 2014-09-07, 10:12

Ok, some thoughts:

The new method would be added in the Libs/GameSys/Entity.*pp files, and, matching the existing (Lua) find methods, probably be named FindByComponent().

As we want to support recursive searching, it is probably helpful to implement this method in C++, too. The Lua methods FindByName() and FindByID() are similarly made, calling their C++ counterparts in the same files, and can serve as an example.

A specialty of the new FindByComponent() would be the fact that it doesn't return one, but possibly many entities. That is, in C++ an ArrayT would be used, and in Lua a table. You can see how this works in the (otherwise unrelated) GetChildren() methods, for which there are C++ and Lua versions, too.

This should give you a good start, but just let me know if I should tell you more. :up:
Best regards,
Carsten
SoulRider
Posts:95
Joined:2014-04-06, 00:16

Re: Unable to run mod in latest build

Post by SoulRider » 2014-09-11, 02:18

I've has an attempt at making the FindByComponent() function, but my understanding of what I am doing is not high enough currently, so I am getting very confused :)

I'll come back to it in a couple of weeks if you haven't got there first :)
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Unable to run mod in latest build

Post by Carsten » 2014-09-12, 17:05

Ok! So if you need this method and its absence is blocking your progress, just let me know! :up:
Best regards,
Carsten
SoulRider
Posts:95
Joined:2014-04-06, 00:16

Re: Unable to run mod in latest build

Post by SoulRider » 2014-09-21, 02:59

Hi Carsten,

I have just started a new job, so my programming time is very limited at the moment. I would be very grateful if you could add this for me, so I could be more efficient with my limited time :)
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Unable to run mod in latest build

Post by Carsten » 2014-09-21, 20:42

Hi SoulRider,

untested, but done! :cheesy: :wman:
Best regards,
Carsten
SoulRider
Posts:95
Joined:2014-04-06, 00:16

Re: Unable to run mod in latest build

Post by SoulRider » 2014-09-22, 20:31

Thanks Carsten.

I've compiled the new file, but yet to start testing it. Will probably not be for a few days though. I'll keep you updated :D
Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests