10.03.2019 - Round 1 results of our "A Love Letter For FreeBASIC" game dev competition have been published. Please be sure to check the results thread: http://games.freebasic.net/forum/index.php?topic=629.0. Don't forget that the competition is continuing with a round 2, lasting till 29th of April, 300 USD first prize. Stay tuned!

Author Topic: Marble Maze Game  (Read 43973 times)

nkk_kan

  • Forum Howler
  • ****
  • Posts: 193
  • Let's rocK~!
    • Yahoo Instant Messenger - nkk_kan
    • View Profile
    • nkk's code cache
    • Email
Re: Marble Maze Game
« Reply #15 on: March 12, 2008, 02:58:06 PM »
glKillMyPc()

That command seems to work for my pc :P

Anyways, i got a super slow fps ...1 or 2  maybe i dunno
reason..crap video card :P

Good graphics though!
only the marble needs to be a bit shiny if you get what i mean!

BadMrBox

  • Forum Sage
  • *****
  • Posts: 411
    • View Profile
    • BadMrBox.com
Re: Marble Maze Game
« Reply #16 on: March 12, 2008, 03:00:25 PM »
nice :).
Maybe add more tilt?

Dr_D

  • Forum Sage
  • *****
  • Posts: 256
    • Yahoo Instant Messenger - dr_davenstein
    • View Profile
    • Dr_D's apps
    • Email
Re: Marble Maze Game
« Reply #17 on: March 12, 2008, 03:48:32 PM »
looking good man. ;)

phycowelder

  • Novice
  • ***
  • Posts: 72
    • View Profile
    • Email
Re: Marble Maze Game
« Reply #18 on: March 12, 2008, 03:49:51 PM »
i really don't know what to say nkk_kan! i an really new to OpenGL and i didn't think it was that badly coded!

Quote from: BadMrBox
Maybe add more tilt?
i have the tilt divided by 8 so it didn't appear more tilted!
i guess i can make it an option! ill get you one with full tilt! its about 40Deg i think!

and thnx Dr_D!

Hezad

  • Novice
  • ***
  • Posts: 88
    • View Profile
    • Email
Re: Marble Maze Game
« Reply #19 on: March 12, 2008, 04:46:52 PM »
Awesomer :)

Lachie Dazdarian

  • Double dipper
  • Administrator
  • Forum Sage
  • *****
  • Posts: 1308
    • Yahoo Instant Messenger - lachie13
    • View Profile
    • The Maker Of Stuff
    • Email
Re: Marble Maze Game
« Reply #20 on: March 12, 2008, 05:41:11 PM »
Nice work so far.

I only wish you chosen a lower resolution so I would at least have a chance to play this with more than 1 FPS. :P
"Things like Basic and Free Basic provide much-needed therapy and a return to sanity and a correct appreciation of people. The arrogant folk really hate a word like 'Basic' - fine, and good riddance." ~ pragmatist

KristopherWindsor

  • Forum Sage
  • *****
  • Posts: 363
  • The Thirsty Smiley
    • View Profile
    • Reddit/r/pics
    • Email
Re: Marble Maze Game
« Reply #21 on: March 12, 2008, 05:51:48 PM »
Nice, although I would prefer mouse controls. ;-)

BTW, don't listen to the people with 10-year-old hardware; they don't like progress. :) :P

phycowelder

  • Novice
  • ***
  • Posts: 72
    • View Profile
    • Email
Re: Marble Maze Game
« Reply #22 on: March 12, 2008, 07:12:51 PM »
lol progress is perceptive! it depends were you want it or not!

and latchie ill make ya one for what res? 640,400, or 320? whats your poison?

edit!
i will make control for mouse,keypad and Joystick!
im hoping to do smoother controls with both mouse and joystick!
« Last Edit: March 12, 2008, 07:37:28 PM by phycowelder »

KristopherWindsor

  • Forum Sage
  • *****
  • Posts: 363
  • The Thirsty Smiley
    • View Profile
    • Reddit/r/pics
    • Email
Re: Marble Maze Game
« Reply #23 on: March 12, 2008, 08:00:55 PM »
Progress is when you do something you couldn't do 10 years ago. ;)

nkk_kan

  • Forum Howler
  • ****
  • Posts: 193
  • Let's rocK~!
    • Yahoo Instant Messenger - nkk_kan
    • View Profile
    • nkk's code cache
    • Email
Re: Marble Maze Game
« Reply #24 on: March 13, 2008, 05:25:56 AM »
Quote
i really don't know what to say nkk_kan! i an really new to OpenGL and i didn't think it was that badly coded!

I said nothing about your coding skills! And i don't think it was badly coded either! i DID take a look at the code even though it didn't run...it's NOT your fault! Just raving about my pc anyways :P

Quote
BTW, don't listen to the people with 10-year-old hardware; they don't like progress. Smiley Tongue

I never said i don't like progress...it's just that i can't upgrade my hardware currently but i know i should... :( :( :(
And yeah it is a 10 year old hardware..but it still works nicely V_V

Anyways, I may seem aggressive..though this is not true...i was just trying to help.
« Last Edit: March 13, 2008, 05:39:07 AM by nkk_kan »

Lachie Dazdarian

  • Double dipper
  • Administrator
  • Forum Sage
  • *****
  • Posts: 1308
    • Yahoo Instant Messenger - lachie13
    • View Profile
    • The Maker Of Stuff
    • Email
Re: Marble Maze Game
« Reply #25 on: March 13, 2008, 04:23:38 PM »
Yeah, same thoughts as nkk_kan's. I'm just raving about my PC too. You are free to ignore me and I won't blame you.

But if you don't want to ignore me, I would like to see a 320*240 version, if one is doable. At least for some initial testing. Thanks.
"Things like Basic and Free Basic provide much-needed therapy and a return to sanity and a correct appreciation of people. The arrogant folk really hate a word like 'Basic' - fine, and good riddance." ~ pragmatist

Merick

  • Amoeba
  • *
  • Posts: 11
    • View Profile
Re: Marble Maze Game
« Reply #26 on: March 13, 2008, 06:08:46 PM »
Looking good, but the ball moves too fast, and maybe you should make it so that the plane returns to 0 tilt when the player stops pressing the arrow keys


The cake is a lie!

phycowelder

  • Novice
  • ***
  • Posts: 72
    • View Profile
    • Email
Re: Marble Maze Game
« Reply #27 on: March 13, 2008, 10:18:40 PM »
this is the code for 320x240 Res!
looks really bad but it may work much smoother!

just copy this code over the old BAS file!


Code: [Select]
randomize timer
#include once "GL/gl.bi"
#include once "GL/glu.bi"
#include once "fbgfx.bi"
#include once "libs/milkshapemodel.bi"
#include once "libs/bmpload.bi"
#include once "libs/createtex.bi"
#include once "libs/GL_ASCII.bi"
#include once "newton.bi"
#include once "libs/matrix.bi"
#include once "libs/apples_n_milk.bi"
using FB

dim shared Milkmodels(1) as model '<-Maze + Marble
dim shared Milk_Objects(1) as _apples '<-Maze + Marble
dim shared camera(15) as single
dim shared Grav as _vector3d2

dim shared i as short,ii as short,iii as single,iiii as ubyte,o as single,oo as ubyte
dim shared info as string
DECLARE SUB LOAD_SCENE
DECLARE SUB DRAW_SCENE
declare sub tilt_reforce(nW as newtonworld ptr,Object as _apples ptr,Torce as _vector3d2 ptr)
Open Cons For Output As #2

Const screenX=320
Const screenY=240
'----------NewtonBi--------------
dim Collision as NewtonCollision Ptr'<----------newton var
dim shared ID As Integer
dim shared Mtrx(15) as single  '<----------MATRIX array
Dim As NewtonWorld Ptr nWorld = NewtonCreate( 0, 0 )

Windowtitle "TILT MAZE as by Phyco"

Model_Init @Milkmodels(0)
Model_LoadModelData @Milkmodels(0), "maze1.ms3d"

Model_Init @Milkmodels(1)
Model_LoadModelData @Milkmodels(1), "Marbel2.ms3d"

Collision = NewtonCreateTreeCollision(nWorld,NULL)
i = NewtonMaterialGetDefaultGroupID(nWorld)
NewtonMaterialSetDefaultFriction   (nWorld, i, i, 1.2f, 0.6f)
NewtonMaterialSetDefaultElasticity (nWorld, i, i, 0.1f)
NewtonMaterialSetDefaultSoftness   (nWorld, i, i, 0.01f)
NewtonMaterialSetCollisionCallback (nWorld, i, i, 0, 0, 0, 0)
screen 14,32,,2
GLFontLoad
LOAD_SCENE
milk_objects(0).body_models=@Milkmodels(0)
milk_objects(1).body_models=@Milkmodels(1)
? #2, collision
clean_matrix @milk_objects(0).m_matrix(0)
'rotate @milk_objects(0).m_matrix(0),65,1,0,0
where @milk_objects(0).m_matrix(0),0,0,0
'rotate @milk_objects(0).m_matrix(0),65,1,0,0
Make_CollisionTree nWorld,collision,@milk_objects(0)
? #2, collision
clean_matrix @milk_objects(1).m_matrix(0)
where @milk_objects(1).m_matrix(0),10,-2,2
Make_Hull nWorld,@milk_objects(1),1000
Grav.xyz(0)=0
Grav.xyz(1)=0
Grav.xyz(2)=0
do:
    if multikey(fb.sc_left) then Grav.xyz(0)-=10: if Grav.xyz(0)<-30 then Grav.xyz(0)=-30
    if multikey(fb.sc_right) then Grav.xyz(0)+=10: if Grav.xyz(0)>30 then Grav.xyz(0)=30
    if multikey(fb.sc_up) then Grav.xyz(2)-=10: if Grav.xyz(2)<-30 then Grav.xyz(2)=-30
    if multikey(fb.sc_down) then Grav.xyz(2)+=10: if Grav.xyz(2)>30 then Grav.xyz(2)=30
   
    tilt_reforce nWorld,@milk_objects(1),@Grav
    NewtonUpdate(nworld, 60)
   
'   
    draw_Scene
    flip
loop until multikey(sc_escape)
NewtonDestroy(nWorld)


sub LOAD_SCENE
    glViewport 0, 0, screenX, screenY                  '' Reset The Current Viewport
glMatrixMode GL_PROJECTION                 '' Select The Projection Matrix
glLoadIdentity                             '' Reset The Projection Matrix
gluPerspective 65.0, screenX/screenY, 1.0, 1000.0  '' Calculate The Aspect Ratio Of The Window
glMatrixMode GL_MODELVIEW                  '' Select The Modelview Matrix
glLoadIdentity
    'SETTING SCENE
    Model_ReloadTextures @Milkmodels(0)
    Model_ReloadTextures @Milkmodels(1)
    glEnable GL_TEXTURE_2D                               '' Enable Texture Mapping ( NEW )
glShadeModel GL_SMOOTH                               '' Enable Smooth Shading
glClearColor .0, 0.0, 0.0, .5                      '' Black Background
glClearDepth 1.0                                     '' Depth Buffer Setup
glEnable GL_DEPTH_TEST                               '' Enables Depth Testing
glDepthFunc GL_LEQUAL                                '' The Type Of Depth Testing To Do
glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST     '' Really Nice Perspective Calculations
    glenable GL_Color_Material
    glEnable GL_BLEND 
    glBlendFunc GL_SRC_ALPHA, GL_one_minus_SRC_ALPHA
    'glPolygonMode GL_BACK,GL_point
    'glPolygonMode GL_FRONT,GL_FILL
   
end sub   
sub DRAW_SCENE
    glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
glLoadIdentity()
    glpopmatrix
    glenable gl_texture_2d
    '"""""""""SETTING CAMERA VIEW OVER BALL""""""""""""
    clean_matrix @camera(0)
    rotate @camera(0),(grav.xyz(0))/8,0,0,1
    rotate @camera(0),(-grav.xyz(2))/8,1,0,0
   

    camera(12)=- milk_objects(1).m_matrix(12)
    camera(13)=- milk_objects(1).m_matrix(13)-60 '<----20 Units Over Ball
    camera(14)=- milk_objects(1).m_matrix(14)
    rotate @camera(0),-90,1,0,0   
    glloadmatrixf @milk_objects(0).m_matrix(0)
    glmultmatrixf @camera(0)
    '""""""""""""""NOW SETTING MAP + MARBEL
    glpopmatrix
    glmultmatrixf @milk_objects(0).m_matrix(0)
    model_draw milk_objects(0).body_models
    glmultmatrixf @milk_objects(1).m_matrix(0)
    model_draw milk_objects(1).body_models
end sub

sub tilt_reforce(nW as newtonworld ptr,Object as _apples ptr,Torce as _vector3d2 ptr)
    Object[0].Force.y=-(Object[0].mass*(98*((90-abs(Torce->xyz(0))-abs(Torce->xyz(2)))/90)))
    if Torce->xyz(0)>0 then
        Object[0].Force.x=(Object[0].mass*(98*(abs(Torce->xyz(0))/90)))
        Object[0].Omega.x+=.001
    elseif Torce->xyz(0)<0 then
        Object[0].Force.x=-(Object[0].mass*(98*(abs(Torce->xyz(0))/90)))
        Object[0].Omega.x-=.001
    else
        Object[0].Force.x=0
    end if
    if Torce->xyz(2)>0 then
        Object[0].Force.z=(Object[0].mass*(98*(abs(Torce->xyz(2))/90)))
        Object[0].Omega.z+=.001
    elseif Torce->xyz(2)<0 then
        Object[0].Force.z=-(Object[0].mass*(98*(abs(Torce->xyz(2))/90)))
        Object[0].Omega.z-=.001
    else
        Object[0].Force.z=0
    end if
end sub


nkk_kan

  • Forum Howler
  • ****
  • Posts: 193
  • Let's rocK~!
    • Yahoo Instant Messenger - nkk_kan
    • View Profile
    • nkk's code cache
    • Email
Re: Marble Maze Game
« Reply #28 on: March 14, 2008, 03:30:06 AM »
Excellente! Merveilleux! Magnifique!  ;D
I did some tinkering and managed to topple the ball over the board :P
good game! Still waiting for more exciting next version  ;D

Lachie Dazdarian

  • Double dipper
  • Administrator
  • Forum Sage
  • *****
  • Posts: 1308
    • Yahoo Instant Messenger - lachie13
    • View Profile
    • The Maker Of Stuff
    • Email
Re: Marble Maze Game
« Reply #29 on: March 14, 2008, 05:45:08 PM »
Well, the low res version runs smooth like baby bottoms on my PC and I really like it. Doesn't look bad too me. I guess I'm not spoiled with high resolutions.

Anyway, I wish I could tilt the playfiled with a higher angle. Now it doesn't feel much challenging to control the ball. Tilting should be more tricky and sensitive by my opinion. And prefarable mouse controlled.
"Things like Basic and Free Basic provide much-needed therapy and a return to sanity and a correct appreciation of people. The arrogant folk really hate a word like 'Basic' - fine, and good riddance." ~ pragmatist