forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Lsokoban level editor for Windows

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
cgruber



Joined: 06 Sep 2005
Posts: 36

PostPosted: Thu Sep 15, 2005 1:50 pm    Post subject: Lsokoban level editor for Windows Reply with quote

Hi guys,
Just wanted to let you know I threw together a quick level editor for making new Lsokoban levels. It's very basic and only allows you to save files not load them but I think it's more than enough to whip out a couple levels in no time flat.

Just remember to save them to /levels directory and give them the next number up. If you want to share any levels post them here and I'll include them in the future.

http://stuff.hyperpixel.net/leveleditor.zip



Here's a new map for level 5

gamefield = {
0,1,1,1,1,0,0,0,0,1,1,1,1,0,
1,-2,-2,0,0,1,0,0,1,0,0,-2,-2,1,
1,-2,2,0,2,0,1,1,0,2,0,2,-2,1,
0,1,0,2,0,2,0,0,2,0,2,0,1,0,
0,0,1,0,0,0,0,0,0,0,0,1,0,0,
0,0,0,1,-2,0,1,1,0,-2,1,0,0,0,
0,0,0,0,1,0,-1,0,0,1,0,0,0,0,
0,0,0,0,0,1,1,1,1,0,0,0,0,0
}
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Sun Sep 18, 2005 4:36 am    Post subject: Reply with quote

Carl,

I am relatively new to Sokoban puzzle. Now, I have played the puzzle using Sokoban YASC (for Windows). I seemed to like it. Thought I would convert Skinner's Microban levels (the first 10) using your LevelEditor. They perfectly fit in your LSokoban's screen (8 by 14 tiles). You (and others) can get it at my webpage. The levels are good for beginners. Try them, huh?

Do you plan to upgrade your LevelEditor such as clearing all tiles, opening previous levels for re-editing, saving files with a new name, etc.?

With those features, I'll go ahead to add more levels to Skinner's Microban.

Thanks.
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Sun Sep 18, 2005 4:43 am    Post subject: Reply with quote

Forgot to mention another feature. Whenever the editor application is minimized or closed, the tile tool should be hidden.

Thanks.
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
cgruber



Joined: 06 Sep 2005
Posts: 36

PostPosted: Sun Sep 18, 2005 12:45 pm    Post subject: Reply with quote

Thanks for the levels and feedback.

I think I can add everything you requested.. It was basically a quick hack to get a level editor working (~15 minutes in visual basic).

I'm gonna play those levels now and add then into the rotation.


One question, what do you mean by save as a different name?

Like a save as command on the file menu?
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Sun Sep 18, 2005 1:02 pm    Post subject: Reply with quote

Yes, just like a regular editor.

I have somewhat trouble with moving player around. Sometimes the player steps twice when I meant a single step. Maybe it was my PSP but I tested the motion on LP for Windows, the same effect. Maybe, modify your code as to keep single steps, one a time just like Shine's calculator.

Have fun!
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
cgruber



Joined: 06 Sep 2005
Posts: 36

PostPosted: Sun Sep 18, 2005 1:11 pm    Post subject: Reply with quote

Just to verify your using version 0.4 and seeing that?
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Sun Sep 18, 2005 1:51 pm    Post subject: Reply with quote

Yep.

I just deliberately wrote a movetest script to see how the motion is improving. Here is a pair of codes, before and after versions, to get an idea.

Before version ...
Code:

-- movetest.lua by Geo Massar

function move()
  local pad = Controls.read()

  if pad:right() then
    playerPos = playerPos + 1
    if playerPos > 13 then playerPos = 13 end
  end
 
  if pad:left() then
    playerPos = playerPos - 1
    if playerPos < 1 then playerPos = 1 end
  end
end

player = Image.load "player.png"
playerPos = 1

while true do
  screen:clear()
  move()
  screen:blit(32*playerPos, 120, player)
  screen.waitVblankStart(5)
  screen:flip()
end


And, the after version ...
Code:

function move()
  local pad = Controls.read()

  if pad ~= oldpad then
    if pad:right() then
      playerPos = playerPos + 1
      if playerPos > 13 then playerPos = 13 end
    end

    if pad:left() then
      playerPos = playerPos - 1
      if playerPos < 1 then playerPos = 1 end
    end
    oldpad = pad
  end
end


The after version works much better but yet you have to press the same key repeatedly if you want to move the player in the same direction. Maybe, need more improvement. I'll try it once more and will let you know if you are interested.
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
cgruber



Joined: 06 Sep 2005
Posts: 36

PostPosted: Sun Sep 18, 2005 2:04 pm    Post subject: Reply with quote

Maybe if it matches the oldvalue a delay should be inserted so you don't have to keep pressing it.

Found a weird bug. Ocassionally the game crashes saying the map file isnt there even though it is. If you press back and forth enough times it will show up.
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Sun Sep 18, 2005 2:12 pm    Post subject: Reply with quote

Yes, I have seen the wierd bug.

I am working on the improvement. Looks like I got a solution.
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Sun Sep 18, 2005 2:24 pm    Post subject: Reply with quote

I got the working model. Let me know what you think.

Further improved...
Code:

-- movetest.lua by Geo Massar

function move()
  local pad = Controls.read()

  if (pad ~= oldpad) or (countpads > 5) then     -- adjust the count limit as needed
    if pad:right() then
      playerPos = playerPos + 1
      if playerPos > 13 then playerPos = 13 end
    end

    if pad:left() then
      playerPos = playerPos - 1
      if playerPos < 1 then playerPos = 1 end
    end
    oldpad = pad
    countpads = 0
  else
    countpads = countpads + 1
  end
 
end

player = Image.load "player.png"
playerPos = 1
countpads = 0

while true do
  screen:clear()
  move()
  screen:blit(32*playerPos, 120, player)
  screen.waitVblankStart()                  -- remove the 5 as it seems unnessary.
  screen:flip()
end


I'll call it a night. See ya tmw if you are around. :)
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Tue Sep 20, 2005 4:50 am    Post subject: Reply with quote

Carl,

I have modded your Lsokoban with the repeating mechanism mentioned in the other thread: http://forums.ps2dev.org/viewtopic.php?t=3423

It works flawless except the wierd bug you mentioned earlier. I'll try to solve it (I think I know the solution.)

I have added 10 more levels to Skinner's list. It is available in my webpage.

Thanks for the great puzzle in spite of its being a clone.
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Tue Sep 20, 2005 9:44 am    Post subject: Reply with quote

Here is the solution I think you might want to mod your LSokoban.

The code below is to load all levels at once and store them in a table (an array). For checkout, it prints all levels on the console using LP-Win32.

Use Lua's dostring() instead of dofile() to read one level a time into the system. Eq:

dostring(gamefields[level])

The "wierd bug" will be gone forever!

Have fun!

PS Triggers on PSP should advance levels at lightening speed.

Code:
-- levelloader.lua by Geo Massar, 2005

gamefields = {}
level = 1
while true do
  levelfile = string.format("Levels/%d.lua", level)
  f = io.open(levelfile)   -- as read by default
  if f then
    print("Reading "..levelfile)
    gamefield = f:read("*all")
    table.insert(gamefields, gamefield)
    level = level + 1
  else
    break                  -- no more left
  end
end

for level = 1, table.getn(gamefields) do
  print()
  print("Level "..level)
  print "--------------------"
  io.write(gamefields[level])
end

_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
cgruber



Joined: 06 Sep 2005
Posts: 36

PostPosted: Tue Sep 20, 2005 9:54 am    Post subject: Reply with quote

Nice I'll try it out.
Back to top
View user's profile Send private message
cgruber



Joined: 06 Sep 2005
Posts: 36

PostPosted: Tue Sep 20, 2005 8:55 pm    Post subject: Reply with quote

added some of the new stuff you wanted.

http://stuff.hyperpixel.net/editor.zip

just replace the exe with this one.
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Wed Sep 21, 2005 5:37 am    Post subject: Reply with quote

Thanks for the modded editor. Will the next version include opening files for re-editting?

For your reward, I have added 10 more levels (total is 30 so far.)

However, I am rather unable to verify the last 10 levels due to the "wierd bug". Hope you would fix it soon.

There are about 100 levels available. As soon as the bug is killed, I 'll add many more levels in return. :)
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
cgruber



Joined: 06 Sep 2005
Posts: 36

PostPosted: Wed Sep 21, 2005 6:49 am    Post subject: Reply with quote

I've been working on opening files and it works most of the time but theres another bug to track down. :(
Back to top
View user's profile Send private message
cgruber



Joined: 06 Sep 2005
Posts: 36

PostPosted: Wed Sep 21, 2005 6:56 am    Post subject: Reply with quote

That io.open bug doesnt happen in lua player for windows.

BTW level 29 is interesting :)
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Wed Sep 21, 2005 7:12 am    Post subject: Reply with quote

Try io.input() instead. However, you'll need to know how many files in advance to read in. Not pretty picture, tho',

The original level 29 was too big for 8 x 14 map. Maybe, the next major version will take either 8 x14 or 16 x 28. It will be a puzzle killer, indeed.
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
cgruber



Joined: 06 Sep 2005
Posts: 36

PostPosted: Mon Dec 12, 2005 12:54 am    Post subject: Reply with quote

I got so pissed off about this I stopped working on it but today I sat down and finally found the solution to that bug.

The fix is to use a local variable and set that to equal the result of the io.open
and then close the handler with variable.close(). Works perfect now
Back to top
View user's profile Send private message
cgruber



Joined: 06 Sep 2005
Posts: 36

PostPosted: Mon Dec 12, 2005 3:09 am    Post subject: Reply with quote

http://stuff.hyperpixel.net/lsokoban.zip

Version 0.5 with 29 playable levels and the control fix thanks to Geo
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Tue Dec 13, 2005 5:57 am    Post subject: Reply with quote

The control works MUCH better, indeed!

Thanks for your stubbornness to fix bugs. :)

For your reward, I'll send you another set of about 30 levels soon. Same author who designed the levels.

Hey, you folks, try this game for yourself. Rather addictive but challenge!
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group