Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / random floats, sparky's and level design

Author
Message
Kryogenik
16
Years of Service
User Offline
Joined: 22nd Sep 2009
Location: Heidelberg, Germany
Posted: 28th Jun 2010 14:42
Sorry about asking 3 questions in one post, but I figured you guys would like it more than me posting 3 different threads. First question, is there a command like rnd() that returns a float? Say if you put rndfloat(1) you could get .4, or something? I have a shotgun in my game that fires 8 bullets from the shell, and I have a random number to rotate them so they don't all go straight, but it just looks like a square because it only gets whole numbers. Also, I ran into an issue with sparkys collision. When I added TBM, and I got alot of fps, you can walk through the invisible boundaries of the level. You can still walk on the level, but you can leave it. It doesn't do that on lower fps, is sparky's not accurate enough at low fps? I'm using version 1 of it by the way. This is probably fixed in version 2, but you need direct x 9.0c to run it (if I remember right) and I'm using an older dbpro version so you don't need to install 9.0c. Last question, whats the best way to design levels for games? I'm not looking for anything specific, just wondering how you guys do it. Sorry if these questions are confusing Thanks in advance

cout<<"I'm learning C++, and this is all I know \n"
thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 28th Jun 2010 15:40
answer #1: I don't think so, I just usually do this: (rnd(10)/10.0)=random float 0.0 to 1.0

answer #2:
Quote: "When I added TBM, and I got alot of fps, you can walk through the invisible boundaries of the level. You can still walk on the level, but you can leave it. It doesn't do that on lower fps, is sparky's not accurate enough at low fps? "

maybe the camera is going so fast that the collision entirely skips over the invisible wall?

answer #3:I think the best way is to either use or create a level editor that does what you want and can export a script with level data and a dbo of the static level scenery, and then write a parsing system that loads the script so that you don't have to put any of it into code, and you can modify levels without recompiling.


baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Jun 2010 15:41 Edited at: 28th Jun 2010 15:41
1- Why not just do something like:


2- Why aren't you using DX 9.0c? I wouldn't expect very much to work well if you are using old versions of software (and DirectX). I use sparky's (current) all the time and have never encountered this precise error.

3- Level design is a big subject. There are a lot of threads regarding level design in other areas of the forums, try here:
http://forum.thegamecreators.com/?m=forum_read&i=19

Level design could mean any one of a large number of different elements of game design from concept through to modelling or even gameplay, which part do you mean?

I'm happy to help where I can please don't think I'm being pedantic!

EDIT: Beat me to it TheNerd!

thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 28th Jun 2010 15:41
lol, we posted at the same time...


sneaky smith12
20
Years of Service
User Offline
Joined: 30th Apr 2006
Location: Like id tell you, oh wait i just did
Posted: 28th Jun 2010 15:58
If I remember right I read somewhere that multiplication is a whole lot faster than division in DBPro (like 35%)... that being said it would be beneficial to just multiply by ".1"

If at first you dont succeed, LOWER YOUR STANDARDS.
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Jun 2010 16:01
Quote: "I read somewhere that multiplication is a whole lot faster than division in DBPro (like 35%)"

Really!? I didn't know that. I'll remember that in future thanks!

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 28th Jun 2010 17:09 Edited at: 28th Jun 2010 17:09
A random float function with precision:



A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Kryogenik
16
Years of Service
User Offline
Joined: 22nd Sep 2009
Location: Heidelberg, Germany
Posted: 28th Jun 2010 17:59
@thenerd My bad, I worded the 2nd question wrong I meant that when I added TBM, the camera moves in really small steps, and maybe sparky's can't detect that (at least v1 can't, which I'm using because v2 needs direct x 9.0c, which brings me to...)
@baxlash I'm not using 9.0c so people don't have to install it when they play it. I also do it so I can play games I make during school while I'm supposed to work They don't have 9.0c on them. Installing 9.0c is hard without admin privileges (if not impossible) and the computer admins are already watching me since I put Halo PC on the schools network drive. My bad, I meant how to model/texture/lightmap the level. I don't think you're being pedantic, mostly because I don't know what that word means
@sneaky smith12 Really? I'll remember that.
@Sasuke Thanks for making the function, I'm sort of lazy myself...

Thanks for the responses.

cout<<"I'm learning C++, and this is all I know \n"
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 28th Jun 2010 18:11
Darkbasic can't run without DirectX 9.0c. End of?

Or am I missing something huge here?

Rawwrr. Sig Fail.
Newcastle is awesome
Kryogenik
16
Years of Service
User Offline
Joined: 22nd Sep 2009
Location: Heidelberg, Germany
Posted: 28th Jun 2010 19:50
Quote: "Or am I missing something huge here?
"

Well, yes and no. You can run a DBPro game without it, but only if it was compiled in an older DBPro version. I mean REALLY old (I compile with v 1.057, the current one is v 7.4, isn't it?). You do miss some things by doing this, like the .dbo format and newer commmands, but I heard holes can appear in converted models in .dbo, and I never used them anyway. DBPro plugins will still work, but I'm not sure where you would get the older version of DBPro, my brother had it lying around. So, yeah.

cout<<"I'm learning C++, and this is all I know \n"
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 28th Jun 2010 21:41 Edited at: 28th Jun 2010 21:42
@Kryogenik
v1.057 = U5.7

Latest:
v1.074 = U7.4

sneaky smith12
20
Years of Service
User Offline
Joined: 30th Apr 2006
Location: Like id tell you, oh wait i just did
Posted: 30th Jun 2010 00:40
@baxslash and Kryogenik... take a look here:
http://forum.thegamecreators.com/?m=forum_view&t=23118&b=1

Multiplication is quicker for whatever reason it may be, but the noticeable difference is when you have the divisions ran over and over in a loop.

If at first you dont succeed, LOWER YOUR STANDARDS.

Login to post a reply

Server time is: 2026-07-25 09:40:14
Your offset time is: 2026-07-25 09:40:14