android
  #61  
Old 09-08-2010, 03:41 PM
Habhome's Avatar
Habhome Habhome is offline
Moderator
 
Join Date: Jan 2010
Location: Sweden
Posts: 1,079
Default

Quote:
Originally Posted by Brett_val View Post
Hey thanks man

I've been playing around with tables lately, I was trying to make a tower defence game and that's really a table-challenge. I found that tables are really handy to handle a lot of data with the least amount of coding lines.
I'm not sure what kind of data you're talking about, maybe if you describe some problems I can play around with it.
Just saving different variations of tables:
Code:
table = {145, 536, 2415}
Code:
table = {HP = 145, MP = 536, MS = 2415}
Code:
test = {	{21, 22, 25, 22, 22, 23, 12, 12, 1, 1, 1, 1, 1, 1, 1},
			{2, 4, 28, 2, 3, 4, 12, 12, 1, 1, 1, 1, 1, 1, 1},
			{5, 7, 28, 5, 6, 7, 12, 12, 1, 16, 1, 1, 1, 1, 1},
			{8, 10, 28, 8, 9, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1},
			{1, 21, 30, 23, 1, 1, 1, 1, 17, 1, 1, 16, 1, 1, 1},
			{1, 1, 2, 3, 4, 1, 24, 22, 22, 26, 1, 1, 1, 1, 1},
			{1, 1, 5, 6, 7, 1, 28, 2, 4, 28, 1, 1, 1, 1, 1},
			{1, 11, 8, 9, 10, 1, 28, 8, 10, 28, 1, 1, 1, 1, 1},
			{1, 11, 1, 1, 1, 1, 21, 22, 22, 23, 1, 1, 1, 1, 1},
			{1, 11, 11, 11, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
			{1, 1, 1, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
			{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
			{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
			{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
			{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}
(The last example is my biggest concern, a two dimensional table. This example is actually the table containing the map you have seen in the playtest/screenshot, the others above are made up.)

Another thing is how to best update a table like this without loading the images several times (which I noticed in my black jack actually steals resources even if it replaces the same variable):
Code:
Enemy = {	
	{A = image.load("enemies/1A.png"),I = image.load("enemies/1I.png"),width = 22, height = 26, 
	HP = math.ceil(Health*(math.random(50,110)/100)), MP = 0, S = math.ceil(Strength*(math.random(50,110)/100)), 
	M = math.ceil(Magic*(math.random(50,110)/100)), D = math.ceil(Defence*(math.random(50,110)/100))}	--enemy 1, Mistborn
}
Right now I simply solved it like this:
Code:
for g=1,#Enemy do
		Enemy[g].A:close()
		Enemy[g].I:close()
	end
	dofile("enemylist.lua")
And one more thing, a way to save booleans. That would be slightly helpful, but if the table issue is resolved then that might not be necessary much.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine
Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it!
Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it.
Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^
Reply With Quote

Advertisement [Remove Advertisement]

  #62  
Old 09-08-2010, 05:53 PM
S1M1S S1M1S is offline
Junior Member
 
Join Date: Aug 2010
Location: Thailand
Posts: 23
Default

Well it seems my work with exp is done :P Well done Brett_val!

...Perhaps I should now proceed to learn what a Lua table is...
Reply With Quote

  #63  
Old 09-08-2010, 06:12 PM
Habhome's Avatar
Habhome Habhome is offline
Moderator
 
Join Date: Jan 2010
Location: Sweden
Posts: 1,079
Default

Quote:
Originally Posted by S1M1S View Post
Well it seems my work with exp is done :P Well done Brett_val!

...Perhaps I should now proceed to learn what a Lua table is...
It's not easy to come in as a beginner, but keep it up, you seem to know what you'redoing so just read up on stuff and you'll catch up in no time. *m not very experienced either, hence why I seek inspiration by listening to suggestions by other people. I really appreciate your contributions to this game. Keep it up, I like the ideas you have.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine
Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it!
Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it.
Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^
Reply With Quote

  #64  
Old 09-09-2010, 03:42 AM
S1M1S S1M1S is offline
Junior Member
 
Join Date: Aug 2010
Location: Thailand
Posts: 23
Default

Hmm... so any other things you think I can contribute on? I quite like coding :P It takes my mind off the vicious amount of IGCSE homework I have to do
Reply With Quote

  #65  
Old 09-09-2010, 05:10 AM
Habhome's Avatar
Habhome Habhome is offline
Moderator
 
Join Date: Jan 2010
Location: Sweden
Posts: 1,079
Default

Hm, well. There's of course a lot of coding to be done in the fight engine, but I've got it mostly figured out how I want it. i'm more in need of graphics and suggestions for enemies. Also easy missions you might have to solve for a boss (like navigate a labyrinth, find an object...)

One thing I could need is some enemy suggestions, and also with balancing. (as you see in the Enemy code above the "mistborn" can have a strength which is 50-110% of your's) I need some both easier and "stronger" opponents, but still well balanced so you wouldn't suddenly meet someone with 500% of all your stats. But there should be slight variations. I'm not sure if you get what I'm saying because I'm writing this in a bit of a hurry during lunch, I'm in the middle of doing research for our Uni project.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine
Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it!
Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it.
Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^
Reply With Quote

  #66  
Old 09-09-2010, 07:30 AM
S1M1S S1M1S is offline
Junior Member
 
Join Date: Aug 2010
Location: Thailand
Posts: 23
Default

Hmm... if you post the full code for your 'mistborn' enemy, perhaps I can help you code some more (I know, I know... Easy much :P) without pictures...

I guess if you post the enemy code, they will all pretty much be the same thing, with different health and attack variables... am I right?

Anyway, you need the elemental enemies, fire, water, earth, wind... there's a suggestion.

*Edit: Elementals are pretty hard dude, maybe 100%-130% health, with an extreme amount of attack - not random.
Reply With Quote

  #67  
Old 09-09-2010, 02:09 PM
lsquish's Avatar
lsquish lsquish is offline
Junior Member
 
Join Date: Mar 2010
Posts: 47
Default

You should make it like golden sun if youve ever played it, so you run around in a big world map and then when you get to a town or dungeon it zoom in to the actual size.
Reply With Quote

  #68  
Old 09-09-2010, 02:52 PM
delirius delirius is offline
Member
 
Join Date: Feb 2010
Posts: 131
Default

Yea, i liked golden sun too. And world map was done well. It was in pseudo 3D (more like 2.5D) because gameboy didnt have 3D acceleration.
Reply With Quote

  #69  
Old 09-09-2010, 03:43 PM
Habhome's Avatar
Habhome Habhome is offline
Moderator
 
Join Date: Jan 2010
Location: Sweden
Posts: 1,079
Default

S1M1S, the entire code for the Mistborn is up there. That is what I have so far for enemies. I forgot about the elemental aspect, if you've mentioned it before. I'm working on this pretty sporadically due to being busy with Uni, so I have about 3 half-finished features in progress, since I've only been able to quickly put in what's on my mind at the time.

Isquish/delirius, I have never played that game so I have no idea what you are talking about. Would you care to be a bit more specific? Though it sounds as if I'd have to remake my map handling if I used that idea, and depending on 'Six's status with the map editor it might be a bit late for any big changes there.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine
Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it!
Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it.
Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^
Reply With Quote

  #70  
Old 09-09-2010, 05:40 PM
Brett_val's Avatar
Brett_val Brett_val is offline
Senior Member
 
Join Date: Jan 2010
Location: The Netherlands
Posts: 636
Default

Quote:
Originally Posted by S1M1S View Post
Well it seems my work with exp is done :P Well done Brett_val!

...Perhaps I should now proceed to learn what a Lua table is...
Thanks man, I was a little worried that I might offend you by chiming in on the task. Lua.org has great info on tables, but it might be confusing (at least it pretty much confused me), so I think the best way to learn it is to read scripts that use them and tryout things, while using lua.org as a guide.

And Habhome, in response to your post:

You can save that two dimensional table to a file and load it from there, if that's what you mean.
I did it with this command I recently found, it's very helpful to walk through tables:
Code:
for key,value in pairs(table1) do
	print(key..": "..tostring(value))
end
And the loading would be with io.lines, and using table.insert(string.sub(lines,x,x)) to build the table again, while using string.sub(lines,x,x) to check for commas and spaces (to ignore them). I wrote a testscript that works with your map-table, but I'm not sure if this is what you were asking for. Besides, this would only be needed for an in-game map editor, because for pre-defined maps it's much easier to just do dofile(map1.lua) which contains "map={blabla}".

If you do mean you want to save different variations of tables to a file, I can try to work out a script that can handle all the examples you quoted, it's just that the second example causes some problems and I have to try some more to get this recognized by a save/load-script.

Next issue:
To exchange images from a table I used a substitute table, like this: (in my gta game)
subst[1]=cars[1]
cars[1]=subst[2]
If the files are not too big you can build a substitute table with all the enemy images and exchange them from there. But if they are too big, I don't see a better way than you are already doing; closing the images and loading new ones.
And yeah I also noticed that you have to close the specific files, just replacing them with another will not unload them and they'll still be in the memory.

I'm not sure if I understood the problems correctly and if this was of any help, so if it's not, please explain and I'll try something else.
__________________
this is a link to my personal homepage which I haven't
Reply With Quote

  #71  
Old 09-10-2010, 10:29 AM
Habhome's Avatar
Habhome Habhome is offline
Moderator
 
Join Date: Jan 2010
Location: Sweden
Posts: 1,079
Default

That saving thing for my map layout sounds very interesting. The reason I want it is because I want to be able to have manipulatable objects in the map, and I want it to remember the changes you have done to it. It might not be really super necessary, it depends on what you people think. But I know that it can cause bugs if it resets stuff you've moved, you could end up on a rock, in a tree, etc.

And I'm not really following the substitute method, might be because my brain is in Shooting mode since I'm at the Junior Swedish championships atm. Could you explain it a bit better? I think it would work very well since I will be having all the images loaded in a table, the Enemy table as you can see in an earlier post. Because they won't be too big for that.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine
Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it!
Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it.
Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^
Reply With Quote

  #72  
Old 09-11-2010, 10:39 AM
Pikelm Pikelm is offline
Junior Member
 
Join Date: Jun 2010
Posts: 1
Default

When the game will be released?
Reply With Quote

  #73  
Old 09-11-2010, 12:32 PM
jbob182's Avatar
jbob182 jbob182 is offline
X-Fi2 Development Moderator
 
Join Date: Feb 2010
Location: The U.S.A.
Posts: 554
Default

read this post
Quote:
Originally Posted by RobertsAccount View Post
...
Welcome to homebrew gaming my friend, where we know nothing of release dates. I know the anticipation must be killing you, but please try and hold back from asking this question as developers such as Habhome do this stuff in their free time. It will be released when it's ready. No sooner, no later.
Reply With Quote

  #74  
Old 09-12-2010, 10:18 AM
Brett_val's Avatar
Brett_val Brett_val is offline
Senior Member
 
Join Date: Jan 2010
Location: The Netherlands
Posts: 636
Default

Quote:
Originally Posted by Habhome View Post
That saving thing for my map layout sounds very interesting. The reason I want it is because I want to be able to have manipulatable objects in the map, and I want it to remember the changes you have done to it.
I found there is a lot to save from tables

Since all the map-tables probably have the same structure you can keep it simple, here is the smallest I could come up with to save your testmap and load it again from test.lua:
Code:
--save map to file
i=0
datawrite=io.open("test.lua","w+")
for key in pairs(testmap) do
	i=i+1
	for key,value in pairs(testmap[i]) do
		datawrite:write(value .. ",")
	end
	datawrite:write("\n")
end
datawrite:close()

-- build the table from the savefile
testmap={}
i=0
for lines in io.lines("test.lua") do
	i=i+1
	table.insert(testmap,{}) --insert secondary table
	b=1 --startingpoint of cel
	for a=1, string.len(lines) do
		if string.sub(lines,a,a)== "," then -- look for commas and insert the stuff before the comma in the table
			table.insert(testmap[i],tonumber(string.sub(lines,b,a-1)))
			b=a+1 --save new startingpoint of cel
		end
	end
end
io.close()
Booleans and other table.value stuff (I don't know how that's called) can also be saved like this if you add some more checks in the saving and change the loading a bit. But it doesn't seem to work for image.load() since that's saved as a memory address or something, and I don't know how to convert that back to the filename.. but I don't think those filenames need to be saved anyway.

Another more universally usable possibility would be to rebuild the whole table={{},} structure in the savefile, just walk through the whole table and write the contents to a file. I had some fun with that and it seems to work pretty well, and you can just use dofile() to load it. But again it doesn't seem to work for images and waves... but there's an easy workaround for that by adding those afterwards.

And about the enemies, do you mean you want to change the image but still have it in the same cell/place in the table? I think that just closing the cell and loading a new one into it would work.. Or if you want to save loading-time, have them preloaded in another table and copy them from there. That's what I meant with my gta example.

I think the files in a table are loaded into the memory when you build the table (the moment you call image.load()), and the cell only holds the memory-address (a print(table.img) shows this address). You can copy this address around and the memory-space will be unchanged until you close it. I also noticed this when I tried to juggle wave-files while playing with that music app in another thread.

I wasn't sure what you meant by "update the table", but you want to give it new images to make some animation happen or something?

I can't really help with enemy suggestions, RPGs are not really my kind of genre.. don't have much experience with it.
By the way what kind of Shooting championships are that?

Attached is the function I came up with, you don't have to use it but it's just to show how I tried to detect the different types of information in a table and save that in a usuable way. It works up to two dimensions. I can try and make something specific for your needs/data so it'll be a bit more efficient.
Attached Files
File Type: zip saveTablefunction.zip (608 Bytes, 2 views)
__________________
this is a link to my personal homepage which I haven't

Last edited by Brett_val; 09-12-2010 at 12:13 PM. Reason: Added function
Reply With Quote

  #75  
Old 09-18-2010, 01:56 PM
datallboy's Avatar
datallboy datallboy is offline
Member
 
Join Date: Feb 2010
Posts: 143
Default

are you almost done with it?
__________________
I wUz he3R
Reply With Quote

  #76  
Old 09-18-2010, 03:08 PM
Habhome's Avatar
Habhome Habhome is offline
Moderator
 
Join Date: Jan 2010
Location: Sweden
Posts: 1,079
Default

No, not yet. As I said Uni made me much busier than I expected so I have almost no dev time. I barely have much free time at all and what little I have I need to use for more important stuff, unfortunately. But it is slowly progressing.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine
Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it!
Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it.
Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^
Reply With Quote

  #77  
Old 09-23-2010, 01:41 PM
matthijs1929's Avatar
matthijs1929 matthijs1929 is offline
Junior Member
 
Join Date: Sep 2010
Location: the netherlands
Posts: 40
Default

when release the game?
Reply With Quote

  #78  
Old 09-23-2010, 01:53 PM
Brett_val's Avatar
Brett_val Brett_val is offline
Senior Member
 
Join Date: Jan 2010
Location: The Netherlands
Posts: 636
Default

Quote:
Originally Posted by matthijs1929 View Post
when release the game?
Please read the thread before you post. This question has been answered two times on this page already.
__________________
this is a link to my personal homepage which I haven't
Reply With Quote

  #79  
Old 09-23-2010, 01:53 PM
RobertsAccount's Avatar
RobertsAccount RobertsAccount is offline
X-Fi2 App Master
 
Join Date: Jan 2010
Location: UK
Posts: 310
Default

Quote:
Originally Posted by RobertsAccount View Post
...
Welcome to homebrew gaming my friend, where we know nothing of release dates. I know the anticipation must be killing you, but please try and hold back from asking this question as developers such as Habhome do this stuff in their free time. It will be released when it's ready. No sooner, no later.
Read ^
Reply With Quote

  #80  
Old 09-23-2010, 04:41 PM
Habhome's Avatar
Habhome Habhome is offline
Moderator
 
Join Date: Jan 2010
Location: Sweden
Posts: 1,079
Default

Thanks Brett and Robs for always standing up for me.

Quote:
Originally Posted by matthijs1929 View Post
when release the game?
As for you, follow their advice. I am really flattered that people are waiting in anticipation for this, but as I have stated before, I am currently VERY busy with other things in my life which are far more important than this. (Family, Formal education, Keeping my life in one piece, etc)

If people keep trying to push questions like this I might decrease the time I work on this even more, I'm getting sick and tired of trying to please everyone in my surroundings.

----

On another note, I'm re-installing my rig with Windows 7 tomorrow, and yes, I've thought of backing up all my programming projects So no need to worry about that. Just a side note.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine
Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it!
Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it.
Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^
Reply With Quote

Reply

Tags
creative, habhome, lua, neko apprentice, rpg, xfi2, zen

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 07:51 AM.