Proto-RTS

Show off your games, demos and other (playable) creations.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Proto-RTS

Post by Jasoco »

kikito wrote:The file was named images/Tiles/Units/eco.gif - notice the lowercase. Windows doesn't care about letter case on files (ECO=eco for him), but mac/ubuntu do. I guess ZIP also does. That must be why it was working on uncompressed windows, but not on the .love file.
No. OS X doesn't care about case in filenames either. Unless you format your HD as case sensitive UNIX which no normal user does on purpose. Linux might, but again, only if you format your HD as case sensitive UNIX.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Proto-RTS

Post by bartbes »

Ext2/3/4 is case-sensitive.
And, most importantly, PhysFS is, so love is, just watch your case.
Geti
Party member
Posts: 112
Joined: Tue Oct 20, 2009 6:38 am

Re: Proto-RTS

Post by Geti »

Yeah, fixed it now. It was caused by me changing the filename to lowercase and forgetting the sprite was loaded in game, as I aren't drawing any units yet, so I wasn't looking at the table. Cheers for the heads up.
Working on plains trees now, then I'll get units done, but I'm leaving soon, so it probably wont get touched much till tonight.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Proto-RTS

Post by Jasoco »

I always watch my case out of habit anyway since web URL's are case-sensitive.
Geti
Party member
Posts: 112
Joined: Tue Oct 20, 2009 6:38 am

Re: Proto-RTS

Post by Geti »

I'm having issues with the update function.
In love.update, I'm doing

Code: Select all

for k,v in ipairs(vegetation) do
	v:update()
end
and when i make a tree object, i do

Code: Select all

function tree:update()
	--lots of functiony stuff that doesnt error at all
end
The problem is that it isn't running the function at all.
Where am I going wrong? I can define the function elsewhere and force it to run on the object, but that's not any fun at all, as it makes all my planned AI routines into spaghetti code, rather than nice unit:update() or unit:move() or whatevers. Help?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Proto-RTS

Post by kikito »

What happens if you do this?

Code: Select all

for k,v in ipairs(vegetation) do
   print('updating vegetable no. ' .. k)
   v:update()
end
Does it print 1 message per vegetable? If not, then the issue must be on the for loop itself.

One quick thing you can try in this case is replacing ipairs by pairs. The former tends to be a bit "picky" about the tables it parses.
When I write def I mean function.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Proto-RTS

Post by Robin »

kikito wrote:What happens if you do this?

Code: Select all

for k,v in ipairs(vegetation) do
   print('updating vegetable no. ' .. k)
   v:update()
end
Just sprawling a lot of print()s around usually helps to point down the problem, yes.
kikito wrote:One quick thing you can try in this case is replacing ipairs by pairs. The former tends to be a bit "picky" about the tables it parses.
Before anyone thinks this is black magic: ipairs is sorted, pairs is unsorted, k, v in ipairs(t) is equivalent to this:

Code: Select all

do
    local k = 1
    local v = t[k]
    while v ~= nil do
        --do your thing
        k = k + 1
        v = t[k]
    end
end
k, v in pairs(t) is equivalent to this:

Code: Select all

do
    local k, v = next(t)
    while v ~= nil do
        --do your thing
        k, v = next(t, k)
    end
end
Help us help you: attach a .love.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Proto-RTS

Post by kikito »

Good point.

The next() function is totally black magic, however. :halloween:

(Just kidding)
When I write def I mean function.
Geti
Party member
Posts: 112
Joined: Tue Oct 20, 2009 6:38 am

Re: Proto-RTS

Post by Geti »

Hooray! It was idiocy on my part. Expect good things next update.
Thanks guys, I usually spam prints everywhere but I didn't think I'd be dumb enough to put the objects in the wrong table. Typos <_<
Anyway, cheers.
Geti
Party member
Posts: 112
Joined: Tue Oct 20, 2009 6:38 am

Re: Proto-RTS

Post by Geti »

Sorry for the double post, just informing you that there wont be an update tonight, but I've gotten a lot more things working (I just need to clean it all up for then v0.4 release)
Quick vote, yes or no for unit implementation before v0.4?
Post Reply

Who is online

Users browsing this forum: Amazon [Bot] and 10 guests