About Store Forum Documentation Contact
Donations:
327$/mo



Post Reply 
Problem loading world files from code
Author Message
Semmy13 Offline
Member

Post: #1
Problem loading world files from code
Hi guys. I currently have a strange problem. Probably is just some kind of stupid mistake I'm doing.

I've set the data path using
PHP Code:
DataPath("Data"); 

After that I try to load the world dir using:
PHP Code:
Game::World .init()
              .
setObjType(PlayersOBJ_PLAYER)
          .New(
"prova.world"); 
Just something similar to the BM source code.
But when the game start it show me the pop-up with the message:
Can't load world "prova.world"
04-14-2011 09:22 PM
Find all posts by this user Quote this message in a reply
Truelegend Offline
Member

Post: #2
RE: Problem loading world files from code
Try
Code:
Game::World.init().setObjType(Players, OBJ_PLAYER)//before declare ObjMemx...
.New("world/prova.world");

you just missed add world/your_world_here.world
because World's are in World directory. the same to objects they are in obj.

Should work smile
(This post was last modified: 04-14-2011 10:01 PM by Truelegend.)
04-14-2011 09:54 PM
Find all posts by this user Quote this message in a reply
Semmy13 Offline
Member

Post: #3
RE: Problem loading world files from code
Thanks, but my world is in the Data root "C:/...../myProject/Data/prova.world"
Before loading the world I also print a Img located in the folder Data/img/logo.gfx" and it works
04-14-2011 10:04 PM
Find all posts by this user Quote this message in a reply
Dandruff Offline
Member

Post: #4
RE: Problem loading world files from code
I just tried putting my world in root of data folder and it loads fine. Have you built the game yet in the editor? Is there a folder named "Game" in prova.world? If there isn't one, go into the editor, load your world and go to world, build, clean all and build all, then save it. Try loading your game up now and see if it works.
04-14-2011 11:44 PM
Find all posts by this user Quote this message in a reply
Semmy13 Offline
Member

Post: #5
RE: Problem loading world files from code
Ok... the editor just don't save the world files. Now, after a couple of try, also the editor crash when I try to start it. Maybe is better if I try with a fres installation pfft
04-15-2011 08:27 AM
Find all posts by this user Quote this message in a reply
Semmy13 Offline
Member

Post: #6
RE: Problem loading world files from code
Ok... now I can load the world and one OBG_PLAYER. However the camera desn't stick to the player.
I'm using this code:
PHP Code:
void updateCamera()
{
    
Player &plr=Players[0];
    
Cam.setSpherical(plr.ctrl.actor.pos()+Vec(0,1,0),plr.angle.x,plr.angle.y,0,Cam.dist*ScaleFactor(Ms.wheel()*-0.2f));

04-15-2011 10:59 AM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #7
RE: Problem loading world files from code
Is your function being called?

If so, add this line at the end of your updateCamera function.

Cam.updateVelocities().set();

There is always evil somewhere, you just have to look for it properly.
04-15-2011 03:20 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Semmy13 Offline
Member

Post: #8
RE: Problem loading world files from code
Using your instruction it works :O
Also using Cam.set();

Really thanks!
04-15-2011 06:02 PM
Find all posts by this user Quote this message in a reply
Post Reply