Rocket-Ticket Questionthread (... haha)

Introduce your project and write about your work.

Moderator: PPS-Leaders

tyderion
Noxonian Brolghormeg
Posts: 36
Joined: Tue Mar 02, 2010 5:26 pm

Rocket-Ticket Questionthread (... haha)

Post by tyderion » Mon Apr 26, 2010 2:21 pm

didn't know how to name the thread because right now I have one specific problem after which the other questions might disappear.


Right now the Rocket (named SimpleRocket) is in the folder: modules\weapons\projectiles\
the RocketController "sits" in: \orxonox\controllers
while the weapon mode is in: \modules\weapons\weaponmodes\

In the RocketController-file I cannot include "weapons/projectiles/SimpleRocket.cc" but I need to do this because I make a new pointer to my rocket (similar to the DroneController) to control it.

In the case of the droneController this works, because the drone is in: /orxonox/worldentities

How can I include this file? is it not possible?

I hope you get what i mean ... for me it's quite confusing ...

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Re: Rocket-Ticket Questionthread (... haha)

Post by x3n » Mon Apr 26, 2010 7:03 pm

do you need RocketController in src/orxonox or is it only needed in modules/weapons? because if the controller is only used by the weapon, i suggest to move the controller to modules/weapons.

however if you have to access the controller from within src/orxonox, we probably need an interface (i can't tell you right now how this interface would look like, because i don't know the actual problem, but interfaces are a common way to solve dependency problems).
Fabian 'x3n' Landau, Orxonox developer

tyderion
Noxonian Brolghormeg
Posts: 36
Joined: Tue Mar 02, 2010 5:26 pm

Re: Rocket-Ticket Questionthread (... haha)

Post by tyderion » Tue Apr 27, 2010 5:36 am

ah. I think i only need it in modules/weapons ... I'll try that and put the controller there too. I'll post again after testing.
thanks for the suggestions :)

tyderion
Noxonian Brolghormeg
Posts: 36
Joined: Tue Mar 02, 2010 5:26 pm

Re: Rocket-Ticket Questionthread (... haha)

Post by tyderion » Thu Apr 29, 2010 12:16 pm

ok ... now I was able to include all needed files but when compiling (after adjusting all includes and adding a function) there were ... strange errors.

Code: Select all

18>..\..\..\..\src\modules\weapons\RocketController.cc(58) : warning C4273: 'orxonox::RocketController::tick' : inconsistent dll linkage
18>        m:\orxonox\orxonox_vs\trunk\src\modules\weapons\RocketController.h(53) : see previous definition of 'tick'
it tells me I redefined tick as well as the initializerfunction. Once in the headerfile and once in the source file. This is wrong.
Somewhere something went wrong (inconsistent dll linkage) but I don't know what.
Thanks for helping :)

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Re: Rocket-Ticket Questionthread (... haha)

Post by x3n » Thu Apr 29, 2010 10:47 pm

i'm not 100% sure, but i guess you have to change this:

Code: Select all

RocketController.h:32
-#include "OrxonoxPrereqs.h"
+#include "weapons/WeaponsPrereqs.h"

Code: Select all

RocketController.h:46
-    class _OrxonoxExport RocketController : public Controller, public Tickable
+    class _WeaponsExport RocketController : public Controller, public Tickable
Fabian 'x3n' Landau, Orxonox developer

tyderion
Noxonian Brolghormeg
Posts: 36
Joined: Tue Mar 02, 2010 5:26 pm

Re: Rocket-Ticket Questionthread (... haha)

Post by tyderion » Fri Apr 30, 2010 12:40 pm

oh thanks now it compiles :)
okay now i struggle again with the problem that I'm not able to "spawn" a model of a rocket.
i get the following error:
Unhandled exception at 0x5ae8a4b4 (libweapons.dll) in orxonox.exe: 0xC0000005: Access violation reading location 0x00000000.

which originates in my RocketControllers call to one of the control-functions of the (I reckon not really existing) rocket.
I uploaded the newest files into the rocket branch.
What I'm trying to do right now is get a model of the rocket to spawn in "empty space" when trying to shoot a "SimpleRocket" (same button as rocket, T)

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Re: Rocket-Ticket Questionthread (... haha)

Post by x3n » Fri Apr 30, 2010 4:03 pm

do you tell the RocketController which ControllableEntity it has to controll?

you probably have to call this->getController()->setControllableEntity(this); in SimpleRocket.cc after you created a controller.

Code: Select all

61	        RocketController* myRController = new RocketController(this);
62	        this->setController(myRController);
+ 	        this->getController()->setControllableEntity(this);
or
+ 	        myRController->setControllableEntity(this);
Fabian 'x3n' Landau, Orxonox developer

tyderion
Noxonian Brolghormeg
Posts: 36
Joined: Tue Mar 02, 2010 5:26 pm

Re: Rocket-Ticket Questionthread (... haha)

Post by tyderion » Fri Apr 30, 2010 10:41 pm

this tells me no access

Code: Select all

+            this->getController()->setControllableEntity(this);
leads to

Code: Select all

1>SimpleRocket.cc
1>..\..\..\..\src\modules\weapons\projectiles\SimpleRocket.cc(65) : error C2248: 'orxonox::Controller::setControllableEntity' : cannot access protected member declared in class 'orxonox::Controller'
1>        M:\Orxonox\orxonox_VS\trunk\src\orxonox\controllers/Controller.h(63) : see declaration of 'orxonox::Controller::setControllableEntity'
1>        M:\Orxonox\orxonox_VS\trunk\src\orxonox\controllers/Controller.h(37) : see declaration of 'orxonox::Controller'

and this

Code: Select all

myRController->setControllableEntity(this);
leads to this

Code: Select all

1>SimpleRocket.cc
1>..\..\..\..\src\modules\weapons\projectiles\SimpleRocket.cc(66) : error C2065: 'myController' : undeclared identifier
1>..\..\..\..\src\modules\weapons\projectiles\SimpleRocket.cc(66) : error C2227: left of '->setControllableEntity' must point to class/struct/union/generic type
... i could add Simplerocket as a friendclass to the Controller ... but somehow that seems extremely ... "hack-ish" as well as unnecessary

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Re: Rocket-Ticket Questionthread (... haha)

Post by x3n » Sat May 01, 2010 12:22 am

ah yeah you're right. i'm a little unsure how this was intended to be handled (even though it was coded by me, but quite some time ago).

one option is, instead of creating a new SimpleRocket (and then create a controller within the constructor of SimpleRocket), create a new RocketController and then create a rocket in it's constructor. that way "setControllableEntity" would be called in the context of the controller and thus works with the "protected" keyword.
Fabian 'x3n' Landau, Orxonox developer

tyderion
Noxonian Brolghormeg
Posts: 36
Joined: Tue Mar 02, 2010 5:26 pm

Re: Rocket-Ticket Questionthread (... haha)

Post by tyderion » Sat May 01, 2010 10:39 am

ah yes doing it in this file resolves the access problems.
It now compiles without errors, but when invoking the "Rocketfire" (which creates a new rocketcontroller) nothing happens ingame.

User avatar
greenman
Baron Vladimir Harkonnen
Posts: 360
Joined: Wed Oct 03, 2007 2:53 pm
Contact:

Re: Rocket-Ticket Questionthread (... haha)

Post by greenman » Sat May 01, 2010 11:01 am

i'm not sure, but i think the way you programmed it, rocketfire should create a new rocket and the rocket itself should create it's own controller, or am i wrong?
There are only 10 types of people in the world: Those who understand binary, and those who don't.

tyderion
Noxonian Brolghormeg
Posts: 36
Joined: Tue Mar 02, 2010 5:26 pm

Re: Rocket-Ticket Questionthread (... haha)

Post by tyderion » Sat May 01, 2010 12:57 pm

no i changed that. the rocket does nothing but initialize some default values.
the rocketfire should create a controller and the controller should create the rocket...

User avatar
greenman
Baron Vladimir Harkonnen
Posts: 360
Joined: Wed Oct 03, 2007 2:53 pm
Contact:

Re: Rocket-Ticket Questionthread (... haha)

Post by greenman » Sat May 01, 2010 1:06 pm

then i would rather create rocket and controller both in rocketfire and tell them about the other.
like that you can easily select different controllers depending on the firemode or whatever and they don't need to create the rocket themself

edit: seems like that's not possible at the moment ^^
There are only 10 types of people in the world: Those who understand binary, and those who don't.

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Re: Rocket-Ticket Questionthread (... haha)

Post by x3n » Sat May 01, 2010 1:08 pm

tyderion wrote:ah yes doing it in this file resolves the access problems.
It now compiles without errors, but when invoking the "Rocketfire" (which creates a new rocketcontroller) nothing happens ingame.
i guess it spawns, but you don't see it, because it spawns in the middle of the level. you have to set position and orientation according to your weapon.

you already have this code in SimpleRocketFire.cc:

Code: Select all

68	        rocket->setOrientation(this->getMuzzleOrientation());
69	        rocket->setPosition(this->getMuzzlePosition());
now instead of rocket, use con->getControllableEntity() and it should work
Fabian 'x3n' Landau, Orxonox developer

tyderion
Noxonian Brolghormeg
Posts: 36
Joined: Tue Mar 02, 2010 5:26 pm

Re: Rocket-Ticket Questionthread (... haha)

Post by tyderion » Sat May 01, 2010 4:17 pm

i changed that but still no rocked is visible.
I just tried to go back to the main menu for the first time after trying the "rocket" and orxonox crashes while trying to destroy the RocketController.
I attached a screenshot of the commandline output.
Attachments
orxonox_fail_001.JPG
orxonox_fail_001.JPG (55.02 KiB) Viewed 3666 times

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests