Search the Community
Showing results for tags 'map'.
-
Since this was a hot topic recently, I've written code to preload model files from a map and display a progress bar. Then, when you load the map, it should load much faster since you already "preloaded" the models and the ones in the map will be instances (copies) of existing ones. This is an alternative to Map::Load's hook, which may be a better way to go about this. #include "Leadwerks.h" using namespace Leadwerks; std::string mapfile = "maps/map.map"; string model_file[100]; // Stores list of model files in map Model *preload_model[100]; // Array to preload model files to int modelcount=0; // Counts total number of models found in map file int main(int argc, const char *argv[]) { Leadwerks::Window* window = Leadwerks::Window::Create(); Context* context = Context::Create(window); // Load map as just a file Stream* stream = FileSystem::ReadFile(mapfile); if(stream==NULL) { cout << "Could not open map file to read." << endl; exit(1); } // Put MDL paths/files in a list and get count while(!stream->EOF()) { string line = stream->ReadLine(); // If what we read is a model line (ends with .mdl) if(line.size()>3 && line.compare(line.size() - 4, 4, ".mdl") == 0) model_file[modelcount++]=line; } stream->Release(); cout << "Number of model files in map: " << modelcount << endl; for(int i=0; i<modelcount; i++) { cout << "Preloading file #" << i << ":" << model_file[i] << endl << endl; preload_model[i]=NULL; preload_model[i]=Model::Load(model_file[i]); // You can check if model was properly loaded here (should not be NULL) preload_model[i]->Hide(); // Preload model should not be seen // Draw progress bar context->SetColor(0.0, 0.0, 0.0); context->Clear(); context->SetColor(1.0, 0.0, 0.0); float barwidth = (float)(context->GetWidth())-20.0; barwidth *= (float)(i+1); barwidth /= (float)modelcount; context->DrawRect(10, 10, (int)barwidth, 20); // Remove the below delay line. It's put in just to show progress bar effect Sleep(500); context->Sync(); } // You can then load the map here and it should be much faster // since you already loaded the models in it above // Map::Load(mapfile); // Game code here return 0; }
-
I worked the half day on that problem and I think I give the information to everyone who also has this problem with fog. In the Editor fog looks a little bit like fog. Without implementig fog in C++ source, no fog is visible in C++. Loading a map after craeting a camera only a touch of a color is visible in the very far, and fog is not working as it should. I mean with map not a terrain, I loaded a map with only a plattform and some prefabs. I have not tested with terrain. So load a map before creating a camera. Nothing works correct if you not do that.
-
hello 21.12.2018 i,m from germany 1. Since the new update, Im falling always through the map I had copied my map and made a 2 by taking her instead of amnesia-l1 --- (amnesia-l0 and amnesia-l1) have renamed 2. my sound sound pivot will not go any further when i approach them (sound) range function is not recognized by the player anymore
-
As i understand it now, the maps made in the editor aren't compiled... Would that make the ingame engine able to edit and save or replace .map files? Im intrested in an "Multiplayer VR Map builder"
-
As large maps can suffer from floating point accuracy problems, are there any plans to add some sort of streaming system to terrain maps, where the world origin is reset to zero when the player enters a new section/zone, as in Unreal Engine 4? CryEngine was also going to have a similar feature added (called segmented worlds), but I'm not sure if that ever happened for public releases. Populating such large areas should be much easier - even for smaller teams - with Leadwerk's procedural vegetation system.
-
I loaded up my demo map to add some decals, and I found out that my models with bones have shrunk down. Might be similar to this http://www.leadwerks.com/werkspace/topic/12680-models-and-their-bones-slowly-rotate-with-each-saveload/ However, the rotation stayed the same indicating that fix is still working. As you can see, the scale is suppose to be 1.0, but here, it's 0.993 for X,Y, and Z. It also seems to be the root node that does this, the children don't scale down separately, only with the root. Oh, it's also not selected red because of a shader gotcha that I've made, that's something I did.
-
Hi everyone. This is my first attempt at making a level. I know it's just a simple map, and I don't plan on using it to make a real game, but it's just to practice my new skills. Anyway, I started an "Advanced First-Person Shooter" project using that template, and it automatically created two boxes, a floor and a block. I've programmed for years, but I've never been serious about game design until about 2 weeks ago. I decided to give Leadwerks a try after a website listed it as a decent game engine ( --- that also runs on Linux --- ) emphasis added. I have a few questions: 1. Do you suggest I leave the "floor" box at that elevation? It looks like its top side's y coordinate is at 0, if I'm assuming the correct coordinate system. I can see the grid on the top face of the floor, which looks bad. 2. Should I leave the thickness of the floor alone? It looks like it protrudes below the grid plane a ways. Are there good reasons for this? 3. When I have multiple projects, do I have to install addons for each project? That would waste a lot of storage. Is it possible to leave these models/materials/prefab/etc. in a higher parent directory, so that they can use them without wasting unnecessary storage capacity? Thanks, looks awesome so far.
-
Hi, How one will go about passing variables between maps? For eg. let's take Marble Game. When player reaches trigger to load another map, game map loads from start and you play again, your score is zeroed. What if you want to pass a highscore or some other vars so I can access them in the new map? Should I store those vars globally so they are accessible regardless of what map is loaded ? How do I go about it ? Thanks.
-
Bonjour, c'est encore moi le nul en ce logiciel. Bref en essayant de créer des map Random ne sachant pas si c'était possible je me suis dit autant faire beaucoup de portes en formes de mur qui en commencant la partie s'active ou non j'ai voulue reprendre le code de BushBoutton.lua mais sa ne semble pas fonctionner. Merci pour vos aide, si il existe des façon de générer des map je suis preuneur un peut comme Monstrum désoler pour la pub. Hello, it's me again a draw in software. In short, trying to create Random map not knowing if it was possible I thought as do many doors wall shapes that starting the game is activated or not I wanted to resume code BushBoutton.lua but its not working. Thank you for your help, if there is way to generate a map I can preuneur as Monstrum grieve for the pub. Script.enabled=true--bool "Enabled" Script.soundfile=""--path "Sound" "Wav Files (*.wav):wav" v = math.random(1,2) function Script:Start() if self.soundfile then self.sound = Sound:Load(self.soundfile) end end if (v = 1;){ function Script:Use() if self.enabled then if self.sound then self.entity:EmitSound(self.sound) end self.component:CallOutputs("Use") end end } if (v = 2;){ function Script:Use() if self.enabled then if self.sound then self.entity:EmitSound(self.sound) end self.component:CallOutputs("Use2") end end } function Script:Enable()--in if self.enabled==false then self.enabled=true self.component:CallOutputs("Enable") self.health=1 end end function Script:Disable()--in if self.enabled then self.enabled=false self.component:CallOutputs("Disable") self.health=0 end end function Script:Release() if self.sound then self.sound:Release() end end
-
I am trying to make it so when you press space it advances to the next map, but am having a little trouble. I have it embedded in the Player (for the ball game template). Here's what I have Script.mapname=""--string "Map Name" if self.levelcomplete then if window:KeyHit(Key.Space) then return Map:Load("Maps/"..self.mapname) end When I hit space, the text disappears and reappers really fast. It's doing something, but I don't know what. Are there any suggestions???
- 1 reply
-
- Map
- Load Next Map
-
(and 2 more)
Tagged with:
-
I was working on an update for the demo of "A Demon's Game", I got reepblue's LEX integrated and started using his ChangeLevel script that came with the template to change the level in the game's demo. However, everytime I tried to change the map, it just gives me an error on the console. Failed to read file "C:/Users/Ruben/Documents/Leadwerks/Projects/ADemonsGame/Sewers_2.map". If I try to use the script that comes with leadwerks, this error pops up. "C:/Users/Ruben/Documents/Leadwerks/Projects/ADemonsGame/scripts/objects/triggers/triggerchangemap.lua" : 10 : attempt to call method 'changeMap' (a nil value) This only started happening recently, so I really don't know what could be causing it. I have attached all 3 scripts that were used. Main.lua ChangeMap.lua CollisionTrigger.lua
-
- 3 replies
-
- Level design
- Shore of the red dead
-
(and 3 more)
Tagged with:
-
... function App:SwitchLevel(levelname) self.world:Clear() self.world = World:Create() self.mapFile = name self.world:Release() end ... function App:Loop() self:ShouldSwitchLevel() --If window has been closed, end the program if self.window:Closed() or self.window:KeyDown(Key.Escape) then return false end if (self.window:KeyHit(Key.C)) then self.world:Clear() self:SwitchLevel("Maps/Level01.map") end So I have been working on a new project and it always seemed to be no big deal to load a map but right now I dont know why its not loading at all. When i press c (test) it makes the .exe not respond http://www.artur-betz.de/sdsd..html here the full App.lua
-
Hello, My name is Tiago. I have an idea that I think would be a good one. The thing is that I have connections, but I don't have the skills for that. I have researched about the subject, but I still don't know how to do it. It is an anime graphic style of game. I need volunteers: programmers, map builders, modellers for the characters, etc. If anyone would like to help, I appreciate a lot. Yours sincerely, Tiago
- 13 replies
-
- Game engine
- programmers
-
(and 5 more)
Tagged with:
-
I have the urge to get some good answers now because I am reaching the apex of tolerance and patience reloading my old project and EVERYTHING IS EMPTY there is NOTHING in the map Now loading my new project it's also empty
-
Hi, I'm new to GLSL coding so I hope this isn't a silly question. I am trying to use a second UV map for a diffuse detail texture on models imported from blender. I made a modified version of the diffuse+normal+specular shader by adding the extra code: //Extra code added to vertex shader //Attributes in vec2 vertex_texcoords1; //Outputs out vec2 ex_texcoords1; void main() { ex_texcoords1 = vertex_texcoords1; } //Extra code added to fragment shader //Uniforms uniform sampler2D texture4; //detail map //Inputs in vec2 ex_texcoords1; void main(void) { outcolor += texture(texture4,ex_texcoords1); } This does not appear to work, this may be because the code is wrong or because the model does not get imported into leadwerks with more than one UV map. If someone could enlighten me I would be very grateful. Thanks, El
-
Hey so I have been messing around with the map changer that came with leadwerks (copied it and renamed it so I have the original still) to choose between random seed maps (initial starting areas the rest is generated) but when it tried to change maps it crashes or gives me a lua stack overflow issue. Is there something wrong with my code? Here it is. --[[ This script will act as a trigger to change the current map. Place this at the end of your map to make the player progress to the next level. ]]-- Script.mapname={} Script.mapname[0] = "" --string "Map Name" Script.mapname[1] = "" --string "Map Name" Script.mapname[2] = "" --string "Map Name" Script.mapname[3] = "" --string "Map Name" function Script:Start() self.enabled=true math.randomseed(Time:Millisecs()) math.random();math.random();math.random(); self.counter = 0 end function Script:Collision(entity, position, normal, speed) changemapname = math.random(0,3) end function Script:Enable()--in if self.enabled==false then self.enabled=true self:CallOutputs("Enable") end end function Script:Disable()--in if self.enabled then self.enabled=false self:CallOutputs("Disable") end end
-
I'm slowly getting to grips with the game engine and seeing how far I can go with just LUA, so plenty of learning opportunities! I'm looking at how to implement all the functionality I need for an RPG and decided the latest bit was worth sharing. This allows you to control where on the map the player is positioned when the map is loaded. I created TriggerChangeMapPos.lua which accepts a second optional parameter, a target object. If this is not specified then the saved player position is used as previously so this could be used as a drop in replacement for the original TriggerChangeMap.lua I then updated App.lua so that it created an entity list on map load and then searched for the specified entity and copied its location to the players. Pivots are of course excellent for this kind of purpose. The files are TriggerChangeMapPos.lua App.lua
-
For a project, I was working on one map (map1). Then i created another map within that same project and worked on that (map2). However, when I reloaded map1, the uv coordinates of surfaces that I changed (such as uv scale, and rotations from using the lock texture option) reverted back to what they were when the entities were originally created. This doesn't occur if I only work on map1 (even if I reload it from inside of Leadwerks).
-
This is a bug that happens a lot to me. After placing objects and working on terrain my map won't save and then all my work will be deleted. I believe this is caused by the same bug that was pointed out in my last post - http://www.leadwerks.com/werkspace/topic/10631-directional-light-and-model-editor-bug/ I really can't do any more work like this. I have lost to many hours of my time to this specific issue. Looks like the Hunt for Food is on hold. Video - https://www.youtube.com/watch?v=mjyjNBnFnTM&feature=youtu.be I can provide my project if needed, just let me know. Edit-- I looked into my backup maps and all the backups are named temp.map and when I try to open them I get Exception Access Violation.
-
I ran into a problem with loading map as I use a state machine to switch in and out between main menu and game level. First I didn't notice that the map wasn't unloaded as I thought it was unloaded when that state exited. But when I try to go back second time from menu it crashes and debugger points at Map::Load(..). But how do I unload the map (when unloading state) so it could load another map later? I have tryied with world->Clear() and world->Release() but without luck. How can I overcome this problem?
-
Hi I'm trying to set the camera to one I have in the scene Currently I'm using one that is created, but I would like to switch to one that already is in the scene/level/map. I'm curious as to how to do this? Thank you for your time and replies AZ