Soamp Posted April 9, 2010 Share Posted April 9, 2010 one of the most common features of a game is save a special state of the game and continue it in future. anyone did this in leadwerks? anyone can help me for to do this? Quote Link to comment Share on other sites More sharing options...
Joh Posted April 9, 2010 Share Posted April 9, 2010 What do you mean exaclty? I think you mean save player position, and status. In this case you should create a file where you simply store all the data you may need. I did 2 type of save in my game normally, 1 where i store the option (graphics, sound etc.) and second type is game type save. How do this depend in your game. As for example in a race game if you save during the race, you'll need to save all the car position, rotation, speed, eventually damage, fuel, weather, consumed tyre etc.. In an rpg you probably should save quest (best use boolean). Etc. If you could tell me wich game you are creating i could try to help you more in deep. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Joh Posted April 9, 2010 Share Posted April 9, 2010 mmm didn't read your name at all.. I know wich game are you making Well could you explain better wich is the problem? Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Soamp Posted April 15, 2010 Author Share Posted April 15, 2010 Hi, In most fps games like Modern Warfare, there are some checkpoints. when you get passed them the game will be saved at that point. if you die in the game, it will be started from the last checkpoint. I want that kind of saving. thanks. Quote Link to comment Share on other sites More sharing options...
Joh Posted April 15, 2010 Share Posted April 15, 2010 This is easy enough, that "checkpoint" are area system normally porgrammer use radius starting from a point, or squared area or in some cases face of a navmesh to check if the player reach the point. Normally they did this in a "clean area" (no enemy, many npc are freeze no strange fx etc..) so the save system is clean and fast. You should check if the prior checkpoint is better, (as for example you pass a checkpoint and come back to an old one, you don't want save it) so save the position of char, his rotation and others (life, npc etc.). You can choose if save on a file (slower) or "keep it in mind" saving it in an array or list/vector (more memory). Let me know if you need more infos. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Soamp Posted April 17, 2010 Author Share Posted April 17, 2010 Hi,thank for reply I think file saving method is gonna work for me. How can I work with files in LE? Did anyone work with files using LUA? thanks. Quote Link to comment Share on other sites More sharing options...
Joh Posted April 19, 2010 Share Posted April 19, 2010 Can this help you? http://lua-users.org/wiki/SaveTableToFile Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Soamp Posted April 20, 2010 Author Share Posted April 20, 2010 Can this help you? http://lua-users.org/wiki/SaveTableToFile yeah, it seems like a great help ;-) thank you Quote Link to comment Share on other sites More sharing options...
AndyGFX Posted April 20, 2010 Share Posted April 20, 2010 Other option for loading data to lua from text file, is command dofile, where loaded file has format like this: file "game.data": return { pos = {0,1,2}, name = "player1", other = { items = {"item1","item1","item1"} } } then in your script call: GameData = dofile("game.data") Chceck data: print(GameData.pos[1],GameData.pos[2],GameData.pos[3]) print(GameData.name) print(GameData.other.items[1]) print(GameData.other.items[2]) print(GameData.other.items[3]) Benefit is, that you don't need write parser for data. EDIT: When you need data more secure, then compile your game data file with: luac -o game.cdata game.data your data are in binary format now, and simply change loading to GameData = dofile("game.cdata"). Note: Compiled data are good only for static data like startup setting, scene properties, addons, items descr., ... 1 Quote [HW] C2D Q6600, 4GB RAM, NV8800GTX, Vista Ultimate x64 [sW] Blide Plus, BlitzMax, Delphi, C++, 3DWS 5.53, Leadwerks 2.xx Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.