Jump to content

smashthewindow

Members
  • Posts

    136
  • Joined

  • Last visited

Posts posted by smashthewindow

  1. Does anyone know how the demo recording system in Source engine is done?

    I would like to implement something similar in my game, but I am absolutely clueless on how to do this.

    My initial thought is to save the absolute positions of every entity per frame into an XML file and then move every entity accordingly during demo replay.

    But my current solution would probably end up with giant XML files and game crashing when trying to load the XML file. (I currently use TinyXML as my XML library.).

    Thanks.

  2. So I'm almost finished coding for my game, the only problem is that I need to create a in-game gui and a loading system.

    However, I just can't think of the appropriate way to do this.

    Can anyone tell me how my main loop should look like?

    I don't need specific code, just the concepts, but sourcecode example would be good.

  3. in 3dws using the default scale conversion that is used with the inherent exporter, a 128x128x128 box in 3dws is equal to exactly 1x1x1 meter box in LE.

     

    use the '[' & ']' to change grid size in 3dws of the active orthogonal window - suggest you look at the Key Shortcuts listed in the Help file - granted all of these are shown as well from the pulldown menus... :)

     

    oh ****

    ohcrap.png

    lol

     

    Could you elaborate more on 128x128x128 box size? how do I see the size of a box?

     

    EDIT:

    fixedq.png

    HAPPY :lol:

  4. I've been messing around with blender and 3DS World Studio.

    How do I set the grid size in the 3DS World Studio so that one grid would match the size of 1 unit in Leadwerks Engine?

     

    Also how do I use the ConvertModel tool? What type of models does it convert? I selected the folder that has a .obj and .gmf it still doesn't work...

  5. Hi, I'm trying to code something like the Bouncy Ball in GMod. (Here's a video:

    )

    Basically, I'm trying to create a mesh that bounces without losing any velocity at collisions.

    I've tried this by setting the velocity constantly at update callback functions(the one that gets called every frame, UpdateEntityCallback), but I've realized that sometimes the ball goes through the walls.

    Any suggestions for a better implementation?

  6. Thanks for all your help, Mumble and Rick.

    I still havent figured out my problem, but I've tested the following code on a sample project, Get/SetUserData seems to be working fine.

    Maybe it's just time for me to rewrite some stuff.

     

    Fixed the problem:

    This is my class layout:

     

    Object->Ball->Controller

     

    I have a virtual function in Ball & Controller (its called GetBallType(), returns int )

    I removed the virtual function, everything's working perfect and all. (I were thinking somethinking like pointer alignment because the address I got from GetUserData was always 4 bits off from the original place - maybe the vtable pointers got messed up.)

    Can I ask why it maybe causing problems like that?

  7. void Scene::LoadMap( string mapname ) {
    	_mapname = mapname;
    	_scene = LoadScene(mapname.c_str());
    
    	_camera = GetLayerCamera( GetFrameworkLayer(0) );        
    	PositionEntity( _camera, Vec3(0,0,-2) ); 
    
    	ProcessMapInfo();
    	ProcessMap();
    }
    
    void Scene::ProcessMapInfo() {
    }
    
    void Scene::ProcessMap() {
    	if(!_scene)return;
    	TEntity e=NULL;
    	int i=0;
    	int done=0;
    	int childs=0;
    	string tp="";
    	string en="";
    	string em="";
    	string ct="";	// collision type, used for collision with static objects
    	while(!done) {
    		done=1;
    		childs = CountChildren(_scene);
    		for(i=1;i<=childs;i++) {
    			e=GetChild(_scene,i);
    			tp=GetEntityKey(e,"Type");
    			en=GetEntityKey(e,"Name");
    			em=GetEntityKey(e,"Mass","");
    			ct=GetEntityKey(e,"CollisionType","");
    
    			if( tp == "info_ball_node" ) {
    				Controller newcont(e);
    				//newcont.SetCamera(_camera);
    				done=0;
    				break;
    			}
    		}
    	}
    }
    

     

    shouldn't be a problem as there is break; before the closing braket of if (this is how gamelib does it.)

    gives the same results even if I use the global instances.

  8. So you are stepping through this and e->UpdateBall() makes it into your Controller::UpdateBall() and you are seeing _campivot as a bad pointer is that right?

     

    I don't see where _campivot is being created in your code above. Also not seeing where the callback is setup above. Can you show that. Also I assume you are creating a pointer to Controller like:

     

    Object* obj1 = new Controller(); ??

     

    	Controller( TEntity entity_ = NULL ) {
    		Ball::Ball(entity_);
    
    		//set mesh of the ball
    		SetMesh("abstract::ball_ball1.gmf");
    
    		_campivot = CreatePivot();
    		_camposition = CreatePivot(_campivot);
    		PositionEntity( _camposition, Vec3(0,0,-5) );
    
    		//control variables
    		camrotation=Vec3(0); 
    		cam2rotation=Vec3(0);
    		mx=0; 
    		my=0; 
    		move=0; 
    		strafe=0; 
    		jump=20;
    
    		SetEntityCallback( _entity, (byte*)UpdateControllerCallback, ENTITYCALLBACK_UPDATE );
    	}
    

     

    That's my constructor.

    Object->Ball->Controller, this is the class inheritance structure.

    Everything else I've implemented is working except for the accessing userdata part.

     

    Object* obj1 = new Controller(); ??

     

    and no. I loop through entities in a map and search for the entity with key "ball_controller". From there I call

    Controller my_awesome_controller_instance(found_map_entity);

     

    basically a while() & for() loop like they do it in GameLib.

    Thank you for replying anyways.

  9. Okay, I need some help in C++...

    I'm just a hobby programmer so I'm not that good.

     

    I've a basic class called "Object", and every class I made inherits from that object:

    class Object {
    public:
    	TEntity _entity;
    	TVec3	_abspos;
    
    	Object( TEntity entity_ = NULL ) {
    		if( entity_ != NULL ) {
    			_abspos = EntityPosition( entity_, 1 );
    			FreeEntity(entity_);
    		}
    		_entity = CreatePivot();
    		SetEntityUserData( _entity, (byte*)this ); //take notice in this part...
    		HideEntity(_entity);
    	}
    };
    

    and of the callback function:

    void _stdcall UpdateControllerCallback( TEntity entity ) {
    	Controller* e = (Controller*)GetEntityUserData(entity);
    	e->UpdateBall();
    }
    
          void Controller::UpdateBall() {	
    	PositionEntity( _campivot, EntityPosition(_ballmesh,1) );
    }
    

    Of course, controller inherits from Object class and yes, Object's constructor is called.

     

    But that PositionEntity() throws an exception if I run it at VS2010 (_campivot is a bad pointer...)

    I know this is noob question, but I can't figure it out after hours of searching.

    Can anyone help me?

     

    EDIT: Basically, I'm asking if anyone knows what the hell is wrong with UserData setting/retrieving...

    The pointer I get from GetUserData() func seems to be +4 bits from the original location.

    I'm using Leadwerks 2.5 by the way, straight from the Updator.

  10. in the editor's asset list on the right, you have the models available to drag into a scene... if you double click on the model icon in the list it will open the script editor and the model's lua script... this is where you can add properties... look at the standard models that come with the SDK to see what is in their object scripts to see how this is accomplished...

     

    thanks for the reply

    I've been looking at the point light's LUA example and trying to find "light_point" string(which is it's class name). But there isn't on the LUA file.

    Help?

  11. Actually this is one of the things that I had a really hard time with too.

    What you could do is look at how GameLib initializes it's things, the Source SDK (Source Engine's Development Kit) for some reference source code on structuring you're custom entity system,

    some Leadwerks forums for more tips.

    Of course if you're doing this in LUA you would have to find the engine function equivalents through the Wiki. (Which is farelly well documented.)

  12. Is there some engine function to get the slope of the current environment that a controller in on?

    I'm guessing that this is possible due to the fact that the controller take's a parameter that set's maximun climb angle of the controller at it's constructor.

    If not, I'm thinking raycasting to solve my problem, but I'm just making sure before I go do something stupid.

  13. it would have been nice if the wiki showed some theories or concepts of how people set up/integrate their entity structures though.

    Actually nevermind. I found this amazing library called GameLib that kinds of shows you how to do all the basic stuff.

    I should probably be looking into that closer now.

  14. Yes. Leo is finnished since long time ago. The goal with LEO is to be a thin class wrapper around the C-api. No more and no less. Same thing goes for LE.Net

     

    Ah, I see. I came from a Source engine modding background, and was quite surprised when I saw that the structures was a lot different.

    I'm a nearly noobie in game programming, so it would have been nice if the wiki showed some theories or concepts of how people set up/integrate their entity structures though.

  15. While I am not familiar with LEO, keep in mind that when you're doing IsVisible between two meshes, you need to hide both meshes prior to testing or the result will always evaluate to false.

    I run a filter function to filter out some of the things it should ignore :) But thanks for the input.

    What template do you use? I get a feeling that the LEO template isn't quite finished, and I'm pretty fluent in other language other than BlitzMax, so I might as well change.

×
×
  • Create New...