First Person 3D - open source (AKA wolf3d)

Post here your demos and examples with the source files.
Forum rules
Always post the games with a screenshot.
The file must have the ged and data files (complete game source)
Use the forum attachment to post the files.
It is always better to use the first post to put the game files

First Person 3D - open source (AKA wolf3d)

Postby feral » Mon Aug 11, 2008 3:00 am

The code here is based on the GE wolf 3D raycasting example
see viewtopic.php?f=6&t=2850


[EDIT- NOTE: I updated the attached files - fixed some bugs listed in posts below, and optimized some more code, it should be quite a bit faster and less bug free,. It also runs directly on game play, (no need to press cursor keys to remove black screen)
There is also no need to replace the wall sprite with the one listed in posts below..it is now included]


this is NOT a working game- It is a work in progress - I am looking for feedback/Help to continue on.. and passing on the exsiting code for others to work on if they wish.


gefox2.jpg

I have tweaked the original version as much as "I possibly can " to gain a playable speed- hopefully some other coders can do better.

basically, I had to remove the "texturing", and, replaced the "draw" functions with sprites in order to get a decent speed...

so, it is no longer a real raycaster, but,.. at least it is 3D :(

I have however added some depth coloring back into it.... which sort of helps... hopefully tho, now that the drawing is done with sprites someone may work out a clever way to use sprites to get some texturing/graphical detail back into the game..

In the meantime, I intend to convert this idea, and my original 3D engine into one single engine, (if I can.. :? )

just looking for feedback on

1. whether this works OK, on whatever platforms you have ( I know it works on a pentium III, so should work on most PC's, but will it work on gpx or win mobile ? it should have a performance increase after converting to executable..

2. whether it is worth continuing, (now that I have had to remove the texturing :( :( )

and or

3, any ideas, or ways to improve it ????

NOTE :there is currently 30 additional sprites sitting in the corner of the screen, I placed them there to check on the performance hit , and, it appears I will be able to have at least 30 sprites on screen without slowing the game down..

(providing the code does not get to complex)

To remove the sprites press x while in game ( or simply delete the tester actor before runtime) and see if there is a difference in speed without the 30 extras..

to start press either left or right cursor keys
move using cursor keys
GeFOXredux2.zip
ged and data files
(44.37 KiB) Downloaded 707 times


let me know anything :D especially if you want to help !!

feral
Last edited by feral on Wed Aug 13, 2008 2:00 pm, edited 6 times in total.
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score

Re: First Person 3D - open source (AKA wolf3d)

Postby stevenp » Mon Aug 11, 2008 11:53 am

really nice, heres another point :D +1

you could redo the controls a bit for more efficient play

forward: W
back: S
strafe left: A (not rotate)
strafe right: D (not rotate)
rotate: mouse

btw, i put the game to 60 FPS and it ran perfectly, no FPS drop at all

thats a really good sign :D
Last edited by stevenp on Mon Aug 11, 2008 2:45 pm, edited 2 times in total.
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score

Re: First Person 3D - open source (AKA wolf3d)

Postby makslane » Mon Aug 11, 2008 12:03 pm

Great job! (moved to the Game Demos forum)
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: First Person 3D - open source (AKA wolf3d)

Postby Game A Gogo » Mon Aug 11, 2008 2:26 pm

when I tried to run this, blank screen? I suppose it has to be related to my video card because it's crap
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: First Person 3D - open source (AKA wolf3d)

Postby stevenp » Mon Aug 11, 2008 2:43 pm

no that happened to me to, all you need to so is press one of the arrow keys and it will work
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score

First Person 3D - how to improve

Postby asmodeus » Mon Aug 11, 2008 4:17 pm

that's great! :D

I have good a way how try to improve:
to use textures and drawing functions without make the game slow, there could be a way:
when starting the game you need to load a texture from an external file. The loaded image you put on a canvas, which isn't visible in the view. With some 3D coding (I'm sure you are the right perosn for that, feral) you make the texture drawn on several canvases, from different perspectives: the first canvas draws the texture seen from the front, the next is rotated by about 1° ... .In this case you will need 360 canvases to be able to see the wall from each side. You can reduce it by using every second or third, but that wouldn't look nice after a time.
A little example is attacheted with this post, see below.
After loading and drawing the texture (that can take time as the only one thing, wich I would find okay), you have to check in the game, where the walls are, from where you are watching to the wall and just use the draw_from() function to draw and scale the textures defined before.


I hope you understood and this will help.
Attachments
wall3d.png
Example: rotate the wall and draw them on a canvas
wall3d.png (22.88 KiB) Viewed 6001 times
User avatar
asmodeus
 
Posts: 483
Joined: Thu Oct 11, 2007 5:04 pm
Location: Germany
Score: 43 Give a positive score

Re: First Person 3D - how to improve

Postby feral » Mon Aug 11, 2008 11:23 pm

In this case you will need 360 canvases to be able to see the wall from each side


actually, you would only need 180, because the other 180 are hidden behind other walls.. :D

but a very good idea. :) ..

but sorry , I tried this (or something similar) when I did my first 3D engine where i had to scale the sprites depending on distance, and if I remember rightly, the draw_from slowed down terribly after a certain number of canvas's... :( ... I will test it again though ... stay tuned. (it may work for the odd item,.. like the flags, and wall pictures..)

I also tried run length encoding the "textures", ie; instead of drawing every pixel, if there was a continuous run of the same color... I used a line_to instead of putpixels (which works well when scaling objects up) unfortunately, again it bottled necked at about 5 different pen_changes .....think of a red brick pattern... putpixel(s) in grey for mortar lines, then draw line in red red for brick, until next mortar line then repeat...

BUT, I could only draw up_to 5 different colored lines per screen slice before critical mass :( workable, but limited...

doing it this way in the critical loop, even at only five changes per slice, means 1600 operations per each screen draw :shock: (320 screen slices ,times, 5 pen_changes and line_to's per slice)

So, by converting it to sprites I get a similar effect but much faster as there is now only 320 operations max ( on a 320*240 screen), and they are blitted rather then drawn..

I am trying to now work out how to have various animations for the sprites, and swap between them according to textures...

PS... it does also work in 640*480, but just a little to slow.. [correction] a little slow on my PC , it may work very well on something faster then a vintage PIII 8)

to try it, change the resolution in the global code and in config->Game Properties to see.. ( graphics are a bit clipped , because the other elements were designed for 320, but you should see the speed of the 3d OK.. let me know)
Code: Select all
#define GEWOLF_SCREEN_WIDTH  320 //change to 640
#define GEWOLF_SCREEN_HEIGHT 240 //change to 480
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score

Re: First Person 3D - open source (AKA wolf3d)

Postby MrJolteon » Tue Aug 12, 2008 12:09 pm

BOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOORING
Join us on Discord!
Game Editor 2
These are the best ways to reach me these days


Your local Community Janitor, always lurking in the shadows...
User avatar
MrJolteon
 
Posts: 2326
Joined: Sat Aug 09, 2008 3:25 pm
Location: Stranded under endless sky
Score: 105 Give a positive score

Re: First Person 3D - open source (AKA wolf3d)

Postby asmodeus » Tue Aug 12, 2008 12:17 pm

MrJolteon wrote:BOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOORING

Why is it b :?: :?: ring?
User avatar
asmodeus
 
Posts: 483
Joined: Thu Oct 11, 2007 5:04 pm
Location: Germany
Score: 43 Give a positive score

Re: First Person 3D - open source (AKA wolf3d)

Postby feral » Tue Aug 12, 2008 1:37 pm

MrJolteon wrote:BOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOORING


actually... I have to agree, for those who "just want to make games", this sort of thing can be terribly boring... :(

I know it gives me a headache.. :lol:

but, for some of the others amongst us, who like to code, it can be quite challenging to test out the capabilities of the system, to see how far we can stretch it, and to push the limits..

it all depends on what you want to do with GE.. or...programming in general.. :)
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score

Re: First Person 3D - open source (AKA wolf3d)

Postby Game A Gogo » Tue Aug 12, 2008 3:45 pm

this is pretty good. congrats :D
but I have a question, this gradient:
untitled.PNG

is it suppose to be like that? It's kinda ugly, I doubt brown would turn bright pink when there is more light ;P
and the gun, it appears under the walls D:I know this should be easily repaired, but was just saying :D

+1 point for you!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: First Person 3D - open source (AKA wolf3d)

Postby feral » Tue Aug 12, 2008 11:00 pm

is it suppose to be like that? It's kinda ugly, I doubt brown would turn bright pink when there is more light ;P
and the gun, it appears under the walls D:I know this should be easily repaired, but was just saying :D


the colors/gradient were just some numbers I typed in to see if it worked. Unfortunately on my first tests with the sprites I tried to do "textures" which is why the walls are colored. but what i needed to do was make them ALL white with shades of grey . that way I could use the rgb values to get what color I wanted.. but because I had already colored them pink... when I added RGB values things went a bit funny.. :lol: easy fixed..

same with the gun, I wrote a small piece of code to automatically zdepth the walls,( this is needed once enemies and objects are added in )
but, I started at 1.0 and went down... so now i don't have a spare zdepth to have the gun ON TOP.. :? . another simple fix..

I will fix both of those soon, at the moment I am trying to get textures back in,
if (that works)
{
I will do a rewrite
}
else
{ I will just fix these few problems & re-upload..}
:D
cheers
feral
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score

Re: First Person 3D - open source (AKA wolf3d)

Postby feral » Tue Aug 12, 2008 11:12 pm

Unfortunately on my first tests with the sprites I tried to do "textures" which is why the walls are colored. but what i needed to do was make them ALL white with shades of grey


here is the new wall sprite sheet ( now all white and grey) simply replace the wallsmaller.png file in the data directory with this one. ( before loading the game)

the colors are still a little off ( like i said they were random test colors...but it now works properly)

wallsmaller.png


PS, if for some reason, you edit the "wall' sprite to load the new sheet and you lose the settings, you may need to retype them in.
settings are
Horizontal frames 500
vertical frames 1
frame rate 1
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score

Re: First Person 3D - open source (AKA wolf3d)

Postby Azou » Wed Aug 13, 2008 10:49 am

Nice work! :mrgreen:
User avatar
Azou
 
Posts: 514
Joined: Thu Sep 13, 2007 1:12 pm
Score: 35 Give a positive score

Re: First Person 3D - open source (AKA wolf3d)

Postby feral » Wed Aug 13, 2008 1:49 pm

NOTE: updated the attached files - fixed some bugs as requested/listed in posts, and optimized some more code, it should be slightly faster and less bug free

fixed the "color" wall problems , and the zdepth of the gun, also changed some "float" variables to "int's", for somewhat faster
redraws..

see first post for latest version..
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score


Return to Game Demos

Who is online

Users browsing this forum: No registered users and 1 guest

cron