Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Getting Started

Organizing the project

You feel lost? You don't understand how to use ShiVa?

Organizing the project

Postby TailsetSonic » 03 Jun 2012, 11:43

Hello,

Now I made some progress on Shiva I wanna start the serious work. But for the moment I only know to create a game with a scene. How may I organize my project to have the main menu of my game in which I'll select my level and then load it ? Is it a "game" with HUDs that launch an other game (the level) or how ?

Thank you ^^
TailsetSonic
Senior Boarder
Senior Boarder
 
Posts: 41

Re: Organizing the project

Postby broozar » 03 Jun 2012, 15:03

"The Game" is just an abstraction. It is essentially a container with all your resources, scenes, etc. The Game should load a main user AI, which loads a scene for the main menu background, onto which you can display the HUD. Clicking on each level selection button should activate an event that sets the current user scene and deactivates the main menu HUD.

Every scene you want to select has to be referenced in the game editor module, scenes tab.
User avatar
broozar
Platinum Boarder
Platinum Boarder
 
Posts: 3486
Location: Berlin - Germany

Re: Organizing the project

Postby TailsetSonic » 05 Jun 2012, 13:28

Ok thanks.

On more question, usually I used keyboard handler in the main AI, with this configuration do I have to load an AI specific to the scene how can I do ?
TailsetSonic
Senior Boarder
Senior Boarder
 
Posts: 41

Re: Organizing the project

Postby broozar » 05 Jun 2012, 13:40

sorry i didn't get that completely.

input always has to be in a user ai, it cannot be in an object AI. Input is handled separately from scenes, therefor make sure, before you send any event to e.g. a player model in a scene that may or may not be loaded yet, make sure to always check its validity (e.g. if hScene ~= nil then etc.). input and scene loading do not have to be in separate AIs, but i usually do it because i have written an input module that i can reuse, an xml read modul, etc, they all stack up in the "main user ai" list. but you can all do it in 1 ai only if you want.
User avatar
broozar
Platinum Boarder
Platinum Boarder
 
Posts: 3486
Location: Berlin - Germany

Re: Organizing the project

Postby TailsetSonic » 08 Jun 2012, 12:54

Oh, ok, thank you.

One more question, is it possibleto send an event to an object without necessarely precise the name of the AI ?

In my game I have 3 different character (each has his specific leve) and I want to send an event to the character I am playing. So now I use "sendEvent ( this.hChar ( ), "Char1AI", "onYdirectionnalKey", -1 )" but if I play the Character number 2 I will have a problem because it's not the same AI. How can I do ?
TailsetSonic
Senior Boarder
Senior Boarder
 
Posts: 41

Re: Organizing the project

Postby broozar » 08 Jun 2012, 17:58

make sure this.hChar() is filled with the right object handle. as soon as you switch characters, make sure you send that object handle to your main AI.
User avatar
broozar
Platinum Boarder
Platinum Boarder
 
Posts: 3486
Location: Berlin - Germany

Re: Organizing the project

Postby TailsetSonic » 09 Jun 2012, 09:14

Yes of course, but what about the name of the AI in "sendEvent" ? I'll have to add a "hAIName" ?
TailsetSonic
Senior Boarder
Senior Boarder
 
Posts: 41

Re: Organizing the project

Postby broozar » 09 Jun 2012, 11:32

no, why? you do know the name of the AI model... it is the same for all instances carrying this AImodel.
User avatar
broozar
Platinum Boarder
Platinum Boarder
 
Posts: 3486
Location: Berlin - Germany

Re: Organizing the project

Postby TailsetSonic » 10 Jun 2012, 07:09

My characters don't have the same AI model because it's not the same gameplay :x
TailsetSonic
Senior Boarder
Senior Boarder
 
Posts: 41

Re: Organizing the project

Postby broozar » 10 Jun 2012, 07:37

then you should add an AI that is just there to receive the event. so each character would have 2 AI models: one that controls the individual behaviour, and one that handles the events, which is the same for all models. once the generic AI has received the events, you can send it to the main AI using this.getObject() for the object parameter.

alternatively, you can also just query the AIModel name(s) that are attached to an object using
http://www.stonetrip.com/developer/doc/api/object-getAIModelNameAt ,
the code snippet there shows you how to send an event only if the AI model name matches a given string.
User avatar
broozar
Platinum Boarder
Platinum Boarder
 
Posts: 3486
Location: Berlin - Germany

Re: Organizing the project

Postby TailsetSonic » 10 Jun 2012, 08:34

Ok thank you, the first method seems to be the mre beautiful.
TailsetSonic
Senior Boarder
Senior Boarder
 
Posts: 41

Re: Organizing the project

Postby TailsetSonic » 10 Jun 2012, 08:49

Just ... in the generic AI, what may I use to send the event to the main one ?
TailsetSonic
Senior Boarder
Senior Boarder
 
Posts: 41

Re: Organizing the project

Postby broozar » 10 Jun 2012, 09:34

object.sendEvent() with getAIModelNameAt index 0.
User avatar
broozar
Platinum Boarder
Platinum Boarder
 
Posts: 3486
Location: Berlin - Germany

Re: Organizing the project

Postby TailsetSonic » 10 Jun 2012, 09:49

Oh of course ^^' sorry for that question
TailsetSonic
Senior Boarder
Senior Boarder
 
Posts: 41

Re: Organizing the project

Postby TailsetSonic » 05 Jul 2012, 11:11

Hello,

I still have a question about how to organize the IA models.

So we have a AI model for the user that is the main IA model and recieve the inputs (keyboard, joypad, etc.). For the moment I just load a HUD menu and after a bouton clicked I load a scene and others HUD (like the "escape" menu). But now I want to control my menus with the keyboard. I understood that there is not generic method for that but where do I have to code that ? Still in the main AI ?

I just think my code will be heavy this way, maybe I'm mistaken.
TailsetSonic
Senior Boarder
Senior Boarder
 
Posts: 41

Next

Return to Getting Started

cron