Page 1 of 2

[CODE] Renpystein Pseudo 3D with Ray casting

Posted: Sun May 20, 2012 1:36 pm
by SusanTheCat
I did this as a proof of concept to see if I could create Castle Wolfenstein 3D effects. It is based on the HTML5 tutorial found here: http://dev.opera.com/articles/view/crea ... l-5-can-1/

YouTube Video of it in action: http://youtu.be/RZZlHbyJcdA

Attached is the code I created. I provide it without guarantee and without much explanation.

Susan


Forgot to add that the source is released under GPLv3 http://www.gnu.org/licenses/gpl-3.0.txt
EDIT: updated code! See new video
http://youtu.be/jw7ThWERj2U

Re: [CODE] Pseudo 3D with Ray casting

Posted: Sun May 20, 2012 2:01 pm
by Starshine
Things for visual's & concepts and games sure use many scripts and codes. The video version reminds me of a maze game. The concept reminds me of Duke Numen, only without the guns and shooting. I could think of many things that the concept could do, if it works with Ren'py. Isn't Pseudo another word for fake? or mabey it's just the name of the concept.

Re: [CODE] Pseudo 3D with Ray casting

Posted: Sun May 20, 2012 2:17 pm
by Nuxill
Wow, this is fantastic! I guess one would have to learn a bit about python to be able to use this to it's fullest. Time to hit the books :P

Is it alright to ask how one could make a way to trigger an event when they stepped on a particular part of the map? And how to change the solid colors into images and adding sprites like what's in the second part of the html5 tutorial?

Re: [CODE] Pseudo 3D with Ray casting

Posted: Sun May 20, 2012 6:10 pm
by KimiYoriBaka
this is rather interesting, if somewhat limited in usefulness. You can now use renpy as a shell for an older than old school fps, which is at least progress over the idea of an fps in renpy being merely an amusing joke. That said, while I congratulate you on your success I have to wonder how much of renpy's functions could be used with this other than just the menu screen.

Re: [CODE] Pseudo 3D with Ray casting

Posted: Sun May 20, 2012 6:39 pm
by Nuxill
KimiYoriBaka wrote:this is rather interesting, if somewhat limited in usefulness. You can now use renpy as a shell for an older than old school fps, which is at least progress over the idea of an fps in renpy being merely an amusing joke. That said, while I congratulate you on your success I have to wonder how much of renpy's functions could be used with this other than just the menu screen.
Perhaps there would be a way to make the two parts jump between each other? I have no idea if it's possible but if so it could mean the creation of 1st person adventure game with visual novel aspects. Though that would probably need most of the work to be done with pygame instead of renpy.

Re: [CODE] Pseudo 3D with Ray casting

Posted: Sun May 20, 2012 8:46 pm
by SusanTheCat
This was very much me seeing the code for HTML 5 and wondering if I could do it in Ren'py. I also have a version that does the wall textures but it makes my netbook cry.

It is Pseudo 3D because it does not use a 3D rendering engine. It is faking the whole thing. You can't look up or down.

The screen is split into strips and a coloured bar the appropriate size is filled in.

My thought was to use it as a maze. (You wouldn't have to use gaudy colours!) You could set something up in the player's move function to check to see what square you are on and set a flag. The event function would then return with a value.

I will come up with more of a tutorial. I wanted to get the code out into the wild since I don't think I have optimized it too well for Ren'py.

Susan

Re: [CODE] Pseudo 3D with Ray casting

Posted: Mon May 21, 2012 6:09 pm
by TrickWithAKnife
It's a very interesting idea. I have a section in my game where this would be useful, so I'll be watching this topic closely.

Re: [CODE] Renpystein Pseudo 3D with Ray casting

Posted: Sun Aug 19, 2012 7:54 am
by SusanTheCat
New code! (See first post)



Now with Textures! And punching things!

You are welcome to use the code. It is based on the pythons code Gh0stenstein:
http://code.google.com/p/gh0stenstein/downloads/list
http://www.pygame.org/project-Gh0stenstein+-1882-.html

Susan

Re: [CODE] Renpystein Pseudo 3D with Ray casting

Posted: Sun Aug 19, 2012 9:22 am
by Nuxill
How exciting, I'll have to try it out right away!
I loved the punching sound effects. Did you make those yourself? :lol:

EDIT: How would you go about making it possible for the exit points to jump to different scenes in a story/different labels? Like if instead of just saying 'Test Exit 3', having it so if the player went to exit three a character in the vn part of the game congratulated them.

Re: [CODE] Renpystein Pseudo 3D with Ray casting

Posted: Sun Aug 19, 2012 9:42 am
by SusanTheCat
Nuxill wrote: How would you go about making it possible for the exit points to jump to different scenes in a story/different labels? Like if instead of just saying 'Test Exit 3', having it so if the player went to exit three a character in the vn part of the game congratulated them.
SusanTheCat wrote:I provide it without guarantee and without much explanation
That said, all you would need is to have an if statement based on the _return variable.

I currently have it set up to return the text from whatever exit you left by,

Code: Select all

        exits = [
            (1.5,1.5,"eileen"),
            (1.5,22.5,"lucy")
        ]
Like

Code: Select all

$ result = _return
if result == "eileen":
    e "You picked me!"

elif result == "lucy":
    e "It looks like you picked Lucy."
Susan

Re: [CODE] Renpystein Pseudo 3D with Ray casting

Posted: Sun Aug 19, 2012 10:12 am
by Nuxill
Ah, I feel so dumb! The answer was so obvious! Thank you. :)

Re: [CODE] Renpystein Pseudo 3D with Ray casting

Posted: Sun Aug 19, 2012 3:15 pm
by SusanTheCat
The code the new code is derived from is under the GPLv3 Licence.
http://www.gnu.org/licenses/gpl-3.0.txt

And that makes my new code under that licence too.

Susan

Re: [CODE] Renpystein Pseudo 3D with Ray casting

Posted: Sun Aug 19, 2012 5:21 pm
by KimiYoriBaka
what an interesting mix of wolfenstein and doom resources

Re: [CODE] Renpystein Pseudo 3D with Ray casting

Posted: Thu May 01, 2014 10:05 am
by OokamiKasumi
It doesn't work anymore. :(

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 120, in script
  File "renpy/common/000statements.rpy", line 447, in python
  File "game/script.rpy", line 56, in python
  File "game/renpystein.rpy", line 62, in python
  File "game/renpystein.rpy", line 335, in python
TypeError: range() integer end argument expected, got float.

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "L:\Library\!Kenetic Novels\RenPy\renpy-6.15.5-sdk\renpy\execution.py", line 294, in run
    node.execute()
  File "L:\Library\!Kenetic Novels\RenPy\renpy-6.15.5-sdk\renpy\ast.py", line 1595, in execute
    self.call("execute")
  File "L:\Library\!Kenetic Novels\RenPy\renpy-6.15.5-sdk\renpy\ast.py", line 1613, in call
    renpy.statements.call(method, parsed, *args, **kwargs)
  File "L:\Library\!Kenetic Novels\RenPy\renpy-6.15.5-sdk\renpy\statements.py", line 144, in call
    return method(parsed, *args, **kwargs)
  File "renpy/common/000statements.rpy", line 447, in execute_call_screen
    store._return = renpy.call_screen(name, *args, **kwargs)
  File "L:\Library\!Kenetic Novels\RenPy\renpy-6.15.5-sdk\renpy\exports.py", line 2095, in call_screen
    rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
  File "L:\Library\!Kenetic Novels\RenPy\renpy-6.15.5-sdk\renpy\ui.py", line 237, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "L:\Library\!Kenetic Novels\RenPy\renpy-6.15.5-sdk\renpy\display\core.py", line 2059, in interact
    scene_lists.replace_transient()
  File "L:\Library\!Kenetic Novels\RenPy\renpy-6.15.5-sdk\renpy\display\core.py", line 577, in replace_transient
    self.remove(layer, tag)
  File "L:\Library\!Kenetic Novels\RenPy\renpy-6.15.5-sdk\renpy\display\core.py", line 851, in remove
    self.hide_or_replace(layer, remove_index, "hide")
  File "L:\Library\!Kenetic Novels\RenPy\renpy-6.15.5-sdk\renpy\display\core.py", line 775, in hide_or_replace
    d = oldsle.displayable._hide(now - st, now - at, prefix)
  File "L:\Library\!Kenetic Novels\RenPy\renpy-6.15.5-sdk\renpy\display\screen.py", line 189, in _hide
    hid.update()
  File "L:\Library\!Kenetic Novels\RenPy\renpy-6.15.5-sdk\renpy\display\screen.py", line 270, in update
    self.screen.function(**self.scope)
  File "L:\Library\!Kenetic Novels\RenPy\renpy-6.15.5-sdk\renpy\screenlang.py", line 1236, in __call__
    renpy.python.py_exec_bytecode(self.code.bytecode, locals=scope)
  File "L:\Library\!Kenetic Novels\RenPy\renpy-6.15.5-sdk\renpy\python.py", line 1382, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/script.rpy", line 56, in <module>
    add Renpystein(600, 400,worldMap,sprite_positions,exits,enemies, 22, 11.5, -1, 0, 0, .66):
  File "game/renpystein.rpy", line 62, in __init__
    self.my_load_image(Image("pics/items/barrel.png"),False),
  File "game/renpystein.rpy", line 335, in my_load_image
    for i in range(width):
  File "L:\Library\!Kenetic Novels\RenPy\renpy-6.15.5-sdk\renpy\python.py", line 558, in revertable_range
    return RevertableList(range(*args))
TypeError: range() integer end argument expected, got float.

Windows-7-6.1.7601-SP1
Ren'Py 6.17.4.409
A Ren'Py Game 0.0


Re: [CODE] Renpystein Pseudo 3D with Ray casting

Posted: Sat May 03, 2014 3:34 pm
by Human Bolt Diary
Attached is a fix for that error, plus I've added a "slide" when you're against walls, adapted from the HTML 5 tutorial.