SyntaxBomb - Indie Coders

Languages & Coding => PureBasic => Topic started by: Pfaber11 on November 07, 2019, 13:19:20

Title: How Many Using Pure Basic
Post by: Pfaber11 on November 07, 2019, 13:19:20
Hi was just wondering how many people on syntax bomb are using Pure Basic . Some people say basic is dead but I disagree and think there will always be a place for it in one form or another . I think with PureBasic and AGK2 out there it will be around for a long time yet . I've had a long play with python and I think Purebasic or AGK2 are way better . When I was using python to do some 2d stuff the graphics used to judder every few seconds . Really not very professional . Don't know why it is main stream and PureBasic isn't and PB is much faster . Maybe it's because it isn't free but 79 euros to a developer isn't really that much for a tool that really kicks arse. Anyway would be interesting to know how many of us are out there and how long have you been using PB . I'm 4 weeks in and regard it as the best decision I've made in a while coming from AGK2 . In some ways they are similar in style although I believe PB can be used for more than just games , some might argue that AGK2 can also but I think it's best for gamey things .
Title: Re: How Many Using Pure Basic
Post by: MikeHart on November 07, 2019, 17:46:52
Quote from: Pfaber11 on November 07, 2019, 13:19:20
...I've had a long play with python and I think Purebasic or AGK2 are way better . When I was using python to do some 2d stuff the graphics used to judder every few seconds . Really not very professional ....
Why the hell you mention this in every fucking post? FYI, there are people out there who produce awesome stuff with Python. This language is used by countless professionals!!!!
You are just to fucking stupid to use it properly. Stop downgrading a tool just because you are not able to understand its most simple concepts.


Here is a suggestion for you before you try to damage the reputation of the next tool you jump to.And that you get for free! Draw stick figures instead... if you are able to.


Edit: And yes, I use Purebasic too. But it is just a tool in many I use! Not that it concerns you.
Title: Re: How Many Using Pure Basic
Post by: RemiD on November 07, 2019, 18:55:16
( i was going to flame such nonsense, but seeing that MikeHart did it with power (but with moderate words, a great demonstration of self control and deep breathing ability), i don't have to, good, i can stay the good nice boy today hihi ;D )
Title: Re: How Many Using Pure Basic
Post by: Steve Elliott on November 07, 2019, 20:01:02
SyntaxBomb goes hardcore.   :o  I think Pfaber11 is making the mistake of mixing-up computer language capabilities, with the game engine features that are either built-in or bolted-on to that language.

Languages like Blitz3D, AGK and Pure BASIC have a lot of features for dealing with graphics, sound and other useful features for game production.  Where as languages like C++ or Python deal with only logic.  So it's unfair to compare them when some languages are merely 'general purpose' languages, rather than languages more tuned for games.
Title: Re: How Many Using Pure Basic
Post by: Coder Apprentice on November 07, 2019, 20:08:52
Quote from: Pfaber11 on November 07, 2019, 13:19:20
...but 79 euros to a developer isn't really that much for a tool that really kicks arse.

Did you buy it?
Title: Re: How Many Using Pure Basic
Post by: Qube on November 08, 2019, 01:25:17
Quote from: Pfaber11 on November 07, 2019, 13:19:20
Hi was just wondering how many people on syntax bomb are using Pure Basic.
Bought it, tried it, didn't much like it as the syntax structure I found pretty odd. I did like the speed of the output though. Also I found the IDE just didn't feel right at all ( personal preference I guess ).

Will probably give it another go or two over time but I can't see me using it for games as it's missing so much that AGK has built in.

Quote from: Pfaber11 on November 07, 2019, 13:19:20
Some people say basic is dead but I disagree and think there will always be a place for it in one form or another
Coding snobs have been crying the death knell of basic for years and years. For business apps I use VB.net and Delphi and never once ( in 20 years ) has a company asked what language it's coded in. All they care about is if it works and works as they want it to do. I could have coded it in turtle for all they care. I love basic and always will as I don't see the need to code certain things in a more complex language just to say "It's written in X snazzy whizzy language"
Title: Re: How Many Using Pure Basic
Post by: GaborD on November 08, 2019, 03:04:35
Quote from: Qube on November 08, 2019, 01:25:17
For business apps I use VB.net and Delphi and never once ( in 20 years ) has a company asked what language it's coded in. All they care about is if it works and works as they want it to do. I could have coded it in turtle for all they care.

Exactly.
I have the same experience with more game-ish projects too. Noone cares what you use under the hood.
Basic variants are still going strong. :)

I am sure I own PureBasic, never really used it though. I think I got it right before I got sidetracked by NB.
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 08, 2019, 09:33:30
Sorry if I pissed you off Mike I shall not make any such remarks in the future.
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 08, 2019, 10:48:14
Hey Kris no I haven't purchased it yet  I'm still using the free edition which works the same but with a 800 line limit. Will be buying in the next couple of weeks as the practice stage is over and I'm ready to start producing . I don't think they have regular sales like the game creators which is a shame but still consider it to be worth the price . I feel quite confident in using it now . At least you get to try before you buy so won't end up wasting your money on something you can't use . The same with AGK2 as well.
Title: Re: How Many Using Pure Basic
Post by: Naughty Alien on November 08, 2019, 11:11:03
..im using it, and its clocking its cycles right now, somewhere in south east china sea, near Brunai..hehehehe...every tool is good, it just depend, does it suit particular needs of specific project..thats all... ;D
Title: Re: How Many Using Pure Basic
Post by: Phil7 on November 08, 2019, 13:49:55
QuoteHi was just wondering how many people on syntax bomb are using Pure Basic .

I have been using it for some time and for small apps it is really quick and easy.
When trying to write games a few things got more and more annoying to me at this time:
- Above 3000 loc my naming got longer and longer to keep things clean and I started missing real Classes and Objects to encapsulate things.
- I wanted my games to work on old unmaintained WinXP PCs. Everything that was in a screen just didn't work because of the wrong openGl or directX drivers.
- Purebasic is really easy to use when you rely on integrated functionality, but if you want to use userlibs and code snippets, it can get pretty overwhelming. This got better with the introduction of modules I have to admit.

That was the reason I got into Monkey, aka Cerberus X. It worked on all old PCs without hassle. The only hurdle at this time was the setup of the target SDKs and a confusing documentation.
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 09, 2019, 16:07:57
Never tried monkey the name just seems a little odd I have heard it's pretty good though. My last game had nearly 10,000 loc and the only problem was scrolling through the code that was in AGK2 biggest program I've ever wrote. anyway the scrolling through the code was weird still got the job done though .
Title: Re: How Many Using Pure Basic
Post by: Aurel [banned] on November 13, 2019, 21:57:14
Well i have it still somewhere on my hard drive but i really rare use PureBasic which is probably
the top 1 popular basic-like language ,it is not bad at all.
I am basic fan too and i cannot say good words about python at all,it is promoted as freakin replacement for
BASIC....yeah probably is "great" solution for linux users but on Windows..simply is too slow .
and yeah ..I never see such a reaktion from Mike(i know him long time ago) he sa really good guy
but i don't expect that he defend python,yes it is used in many science programs but not assuch then
as a glue language with well known extra library.
ehhhh...
Title: Re: How Many Using Pure Basic
Post by: Qube on November 14, 2019, 06:19:58
QuoteMy last game had nearly 10,000 loc and the only problem was scrolling through the code that was in AGK2 biggest program I've ever wrote
You do know that AGK has code folding? - Also I'm sure that with 10,000 + lines of code there is much scope to create modules?
Title: Re: How Many Using Pure Basic
Post by: iWasAdam on November 14, 2019, 07:54:52
10,000 for a simple maze game sort of sounds a bit loong. I would have thought (Max) should be around 2000 with 900-1000 being a good target - unless you using loads of rem statements to help you?
Title: Re: How Many Using Pure Basic
Post by: Steve Elliott on November 14, 2019, 08:44:46
Quote
Also I'm sure that with 10,000 + lines of code there is much scope to create modules?

AGK has modules?  Or are you just suggesting breaking-up the program into separate files?
Title: Re: How Many Using Pure Basic
Post by: Qube on November 14, 2019, 15:28:46
Quote from: Steve Elliott on November 14, 2019, 08:44:46
AGK has modules?  Or are you just suggesting breaking-up the program into separate files?
Yeah, I mean breaking up the code into sections that can be reused ( or easily separated ) and use #insert rather than have one huge single source.
Title: Re: How Many Using Pure Basic
Post by: Steve Elliott on November 14, 2019, 15:34:58
Quote
Yeah, I mean breaking up the code into sections that can be reused ( or easily separated ) and use #insert rather than have one huge single source.

Yes that's a much better choice than one big 10,000 line file for just one particular project.  What if you want to re-use some code for another project?  Just write some useful game functions that can be stored in separate files, then include them in the main source file with a simple insert command that your language supplies.
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 14, 2019, 17:52:11
What took up all those lines of code was the way I was checking to see if I was in collision with an orb or one of the pieces of food and repeated for all twelve levels . I  think that accounted for 4000 lines . I do like the end result though and it plays good but yeah I probably could have been a lot more economic with my coding . Code folding sounds good and yes insert could of been used but I just wanted to make it all in one piece. I was reading somewhere that some games are around 1000000 million lines of code so they must break it up. so nearly half my program was taken up by collision routines . with some clever programming I could of probably got it down to 500 by reusing the code for each level but just chose to copy and paste huge chunks of it which was very quick to do . I nearly wrote not quite but nearly 12 games if you know what I mean.
Title: Re: How Many Using Pure Basic
Post by: STEVIE G on November 14, 2019, 18:21:43
Quote from: Pfaber11 on November 14, 2019, 17:52:11
What took up all those lines of code was the way I was checking to see if I was in collision with an orb or one of the pieces of food and repeated for all twelve levels . I  think that accounted for 4000 lines . I do like the end result though and it plays good but yeah I probably could have been a lot more economic with my coding . Code folding sounds good and yes insert could of been used but I just wanted to make it all in one piece. I was reading somewhere that some games are around 1000000 million lines of code so they must break it up. so nearly half my program was taken up by collision routines . with some clever programming I could of probably got it down to 500 by reusing the code for each level but just chose to copy and paste huge chunks of it which was very quick to do . I nearly wrote not quite but nearly 12 games if you know what I mean.

You repeated the same code 12 times ... so each level has it's own code?!   :o That's a maintainance nightmare!  I hate to be harsh but getting your code down to 500 lines by not repeating the same same code is not clever programming - it should be standard practice.   ;D   
Title: Re: How Many Using Pure Basic
Post by: Derron on November 14, 2019, 18:36:22
QuoteI nearly wrote not quite but nearly 12 games if you know what I mean.

You wrote 12 times the same game :D


bye
Ron
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 14, 2019, 19:39:38
Yes it was just the easiest way to go at the time . The end result was pretty good though . But I do agree was very bad practice.
I think for my next project I'll do a flow chart first haven't done one in years but I think it's the way to go .
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 14, 2019, 20:21:16
When I think about it now it was crazy but it did the job very well . Then problem with it was when making small alterations I was having to do it not once but many times and it meant sorting through thousands of lines of code . Not difficult but hard work. I really need to start a new project but haven't found the right inspiration yet . It will be my first outing with purebasic and am really looking forward to it . Been playing around with terrain the last few days and I love it . A year ago I would of considered my own terrain as unobtainable and now I'm doing it . Been using a camera to create height maps and it works great and every one I make is unique and they are pretty huge . It takes ages to get from one side to the other and it's really got a great feel to it . I think the same method I used would work great in AGK2 or studio just as well . I did notice some software for photographing objects and turning them into 3d objects so I think I'm going to build a small studio to do this . I love programming and photography and have a reasonably decent camera . Want to get all this accomplished this year so got to get my skates on . Have any of you guys tried making 3d models with the camera method and if so was it practical . I was thinking a days work when I get it set up say 5 to 20 models .
Title: Re: How Many Using Pure Basic
Post by: Coder Apprentice on November 14, 2019, 23:30:18
@Pfaber11 C'mon man! Admit it! You just come here to troll.

;D
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 15, 2019, 00:54:13
Kris I'm here to meet like minded people seriously . If I'm trolling it's not on purpose . I seriously like this forum. This purebasic is coming on great my terrain is looking ace . The speed is awesome too easily reaching 60 fps . put a counter in my program and see how many frames it hits at ten seconds.
Title: Re: How Many Using Pure Basic
Post by: Coder Apprentice on November 15, 2019, 04:01:02
OK. Sorry...my bad.   ::)

I'm not talking from experience since I do mostly manual modeling myself and you'll probably get lot's of useful info about this on other dedicated forums or fellow syntaxbombers with more hands on knowledge than mine but as far as I know photogrammetry requires many pictures from many angles. More the better. Once you loaded all pictures into the chosen app there will be some processing time depending on your computer specs and settings. After the process you'll get a very dense model that needs cleaning. Less cleaning if you use it as a static model in offline rendering (standalone CG animation/movie FX) where polygon count is less of an issue. Much more cleaning/optimization is needed if you want them in realtime application such as games. If you want to make them suitable for in game characters and animate them with bones that needs lots of work and in certain situation it's better to remodel certain parts or the whole model using the raw, dense 3D object as a reference. This might be a preferred method anyway if you want fairly low poly objects.

I think it will be a slow process in the beginning. Your first models might take days per model before they're suitable for your game. You'll find out your way but photogrammetry is not a magic bullet but indeed a very useful tool. 
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 15, 2019, 09:22:44
Thanks Kris I think you need at least 20 photos to accomplish this but for someone who can't draw to save his life like me it may be a way to make my models . I think I'm gonna need a tripod and a large piece of grey card for the backdrop. I did look into this about a year ago but never got around to trying it . Can't remember where I got the software but will find it again .
   some lighting too. I think I maybe a bit optimistic about how many I can produce it may turn out a day to do the photography and a day to clean it up . If this works though it would be awesome I guess I would have to make the textures too . I think once set up and I've got the hang of it it could be good , of coarse it maybe it's not very good and the quality is rubbish but I won't know until I have a go .
Title: Re: How Many Using Pure Basic
Post by: iWasAdam on November 15, 2019, 10:23:18
@Pfaber11
QuoteWhen I think about it now it was crazy but it did the job very well
Absolutely NOT! It did the job, but 'well', not and 'very' completely not! You did a terrible job. that fact it works at all is pure luck on your part! You lack of skill in ignoring people and their suggestions on how to improve is amazing.

how to check for a simple collision for 2 objects (size of 1):

xlength = object1x-object2x
ylength = object1y-object2y
length = sqrt( xlength + ylength )
if length < 1 then collide

say object1 is you and object2 is something (repeat for multiple collision)
4 lines of code. say 10 with a loop checking multiple things

You code = 4000-5000 lines of code. above code = 10 lines of code. your coding skills are terrible - please learn. other wise you are really just being a troll going on 'how good you are', and then wanting praise for <something>

<rant over>
Title: Re: How Many Using Pure Basic
Post by: Derron on November 15, 2019, 11:08:34
Quote
xlength = object1x-object2x
ylength = object1y-object2y
length = sqrt( xlength + ylength )
if length < 1 then collide

Dimensionless points? Objects tend to have at least a width and height - so it requires a bit more. For points you could simply do "if object1x = object2x and object1y = objext1y then collide"

Or do I miss some trick here?

bye
Ron
Title: Re: How Many Using Pure Basic
Post by: iWasAdam on November 15, 2019, 11:29:41
He's using just a flat 2d map - no height needed.

To get different width, just modify the length < 1 to something else like length < 0.5 or length < 2 etc. Without seeing how the x/y positions are being used, you can't get a perfect match - it's really just a pseudo-code approach :)

if you wanted to add height, you could do it by adding z to the sqrt or doing a quick height check on the return values - all very simple stuff.



Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 15, 2019, 20:36:41
you know I do agree with you and I now Know a better way to check for collisions . I have to be honest and the code I was using to check for a collision between 2 objects was about 35 lines of code and it was given to me from someone on TGC forum . What can I say it works . But I needed to check for 5 orb collisions and 5 food collisions hence 10 checks per level per frame . so that's 350 lines of collision checking for each level and there were 12 levels . Hence 350 lines per level times 12 . Hmm will not be doing that again all I can do is put it down to experience . There you go it was all down to TGC forum. Found a much faster and better way to do this in PureBasic  using way less code and I understand how it all works . I still think the game was fun to play though and nobody would ever know anyway. Have a  nice evening .
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 15, 2019, 21:22:35
This is the way I'm checking for collisions in purebasic and it works well basically if the entitys collide the screen turns red .

CreateEntityBody(2,1)
CreateEntityBody(4,1)
result = EntityCollide(2,4)
d=1
If result > 0
 
  d=d+1
EndIf

  If d <=1
    CameraBackColor(0,#Blue)
  EndIf
 
  If d >=2
    CameraBackColor(0,#Red)
    d=0
  EndIf

FreeEntityBody(2)
FreeEntityBody(4)



Don't think there is anything wrong with this code but you might . I guess we all have our own style .

edit Looking at this code now I see I could shorten it significantly but there you go .

I see I made a mistake should read createentitybody(1,#PB_entity_staticbody)

However the above still works.
Title: Re: How Many Using Pure Basic
Post by: Hotshot on November 15, 2019, 23:32:33
I used Purebasic sometimes :)
Title: Re: How Many Using Pure Basic
Post by: Derron on November 16, 2019, 09:01:17
> using way less code and I understand how it all works


So what does

CreateEntityBody(2,1)
CreateEntityBody(4,1)
result = EntityCollide(2,4)

do in detail?


Do not tell us you understand what it does if you didn't. If you did understand what it does, you would never have done that 35*12 collision thing.
Creating collision layers is better than nothing - but with hundreds or thousands of objects you sooner or later need other ways to approach this. So better understand the basics of collision detection - and what the above code is really doing as this helps to understand its limitations and possibilities.


bye
Ron
Title: Re: How Many Using Pure Basic
Post by: iWasAdam on November 16, 2019, 10:14:34
taking you 'working' code above:
CreateEntityBody(2,1)
CreateEntityBody(4,1)

if EntityCollide(2,4) > 0
   CameraBackColor(0,#Blue)
else
   CameraBackColor(0,#Red)
EndIf

FreeEntityBody(2)
FreeEntityBody(4)


Now I don't know the ins and outs of what EntityCollide does, but I do know that all the crap with 'd' and 'result' is not needed and is just adding 'cruft' and potential errors to your code.

I would possibly go further and suggest you only need to set up the entitybody's once (when they are created) and delete them when you have finished with them. not create and delete every frame. But again I don't know exactly how purebasic is dealing with them?
that would take your 'it's superb, my code is the best in the world, don't you wish you could do it like me' 20 lines of code and make it very simple 5 line! But hey - what do I know? I'm not the best programmer in the world - like you are...


It sort of seems you have very little grasp on some very basic fundamentals:
if else end
data/arrays

Anyone here would be happy to help you through any of these things - they are core basics. But banging on about how good one language is from another when you can't even use the basic building blocks is sort of irrelevant.
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 16, 2019, 10:20:25
Hmm well you create the entity body from the entity check for a collision then free the entity so it can be used as a normal entity again . Probably not what you were looking for but it works fine .
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 16, 2019, 10:26:47
yes  Adam that is a better way to do it I did realise this after I had put it up but there you go . Thanks for the input.
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 16, 2019, 10:36:54
Hey Hotshot what is your opinion of purebasic . For me personally I quite like it . And Ron you have to convert the entity into an entity body to check for a collision after this check you have to turn it back into an ordinary entity with freeentity and so on .
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 16, 2019, 11:14:11
But yes that code I put up for collision detection was very strange . But one thing and that's at least I didn't just copy someone  else's code . And it does work . Maybe my brain is packing up which would be a shame but there you go knock on wood I'll be fine . You should see the code I put up for AGK2 collision detection it's mind blowing . In fact I'm going to find it and show you .
Going to find it now.
Title: Re: How Many Using Pure Basic
Post by: Derron on November 16, 2019, 11:16:56
I did not ask for the reasons of the command usage - but more what they actually do. You told you know your code now. So what is the collision function actually doing, why does it need the entity bodies to get processed by that other functions - such stuff is what you "at least basically" need to know. Why? Because only then you can estimate how "costly" these functions are.

Sometimes the provided functionality is not good enough for a specific use case - too generic, doing too much. Sometimes you do not need complex hull collision checks if a bounding box collision check is already good to go (this is stuff the above used functions surely contain - but were you aware?).

It is similar to know if you can skip checks of collision between certain objects (either as you do not have a physics reaction like "repel" or because you are not interested in "enemy hitting enemy" or similar stuff).


As Adam suggested: learning the basics helps to read code, to write code. Learning tricks helps to speed up your code. Learning methods/approaches helps to shorten your code or to make it more efficient.
You plough through progamming languages and as soon as you do not advance in their ... or reach a "non-solveable problem" you move on. So far no problem - but you should avoid blaming these languages for stuff which obviously is not happening for others. So if your "game" (or prototype) is not smooth for you - but other programmes done in that language with the same framework are running smooth ... then you should always ask yourself twice if it is the language (maybe a bug?) or your code.


With game programming in general - and "hobby/indie games" in special: it is not just about bringing the game to the market. It is also about learning, about improving, about trying stuff out. Every dirt trick you do to achieve a fast "playable state" might repel smashing right into your coding face once you need to modify that piece of code. Especially more generic stuff like "collisions" - which you might need all over your game - should be done properly and not with tons of spaghetti code. There you _really_ benefit from "write once, use multiple times". Just assume you had to write a manual "image loading" ... and you copied + adjusted it for every image you load. It is tedious - and once you find a bug you need to adjust it everywhere...


On the other side - to not just "rant": It is good that you try out stuff, that you do not "force" yourself to feel comfort in a language which does not comfort you (and your current state of skills / knowledge). Maybe do not try to create a big game first ... create little "one screen" games. Later extend with Start screens, highscores, ... just to learn the "aspects" of the games. Learn to reuse stuff - it makes you learn what you are doing wrong in certain parts of the code (you recognize it is not easy to "copy paste" but requires a lot of adoption? ... something to improve on!).


bye
Ron
Title: Re: How Many Using Pure Basic
Post by: RemiD on November 16, 2019, 11:57:42
Quote
I needed to check for 5 orb collisions and 5 food collisions hence 10 checks per level per frame . so that's 350 lines of collision checking for each level and there were 12 levels . Hence 350 lines per level times 12 .

what you apparently need to learn is to store your entities in list(s) and use for{} loops to do checks between entities. less code to do the same thing.

you can also add a field (variable) for each entity, named "kind", which is given an integer (corresponding to a constant with a destrictive name) to further refine, your for{} loops and only do the checks between specific group of entities

in blitzbasic this would be :

;list with dim arrays :
global entitiescount%
dim entitykind%(100) ;integer constant (cplayer or corb or cfood)
dim entitymesh(100) ;reference
dim entitylife#(100) ;float

;list with custom type :
type entity
field kind% ;integer constant (cplayer or corb or cfood)
field mesh ;reference
field life# ;float
end type
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 16, 2019, 12:33:27
Thanks for all the advice I am taking it onboard. Gonna be a while before I get proficient at this although I have come on in leaps and bounds in the last 2 years . My next project will be a lot better thought out . As promised here is the AGK code for detecting collisions that was given to me from someone on TGC forum . The first couple of line and last few lines are mine and the stuff inbetween is alien.
objID=2
objID2=8
function checkCollision4(objID as integer,objID2 as integer)
     
local width# as float
local height# as float
local depth# as float
local x# as float
local y# as float
local z# as float
local start_x# as float
local start_y# as float
local start_z# as float
local end_x# as float
local end_y# as float
local end_z# as float
local object_Hit as integer

//this checks for colliion between an object with any other object and returns its id
width#=(GetObjectMeshSizeMaxX(objID,1)-GetObjectMeshSizeMinX(objID,1))/2
height#=(GetObjectMeshSizeMaxX(objID,1)-GetObjectMeshSizeMinX(objID,1))
depth#=(GetObjectMeshSizeMaxX(objID,1)-GetObjectMeshSizeMinX(objID,1))/2
 
x#=getObjectWorldX(objID)
y#=GetObjectWorldY(objID)
z#=getObjectWorldZ(objID)


// calculate the start of the ray cast
start_x# = x#-width#
start_y# = y#+height#
start_z# = z#-depth#
// calculate the end of the ray cast
end_x# = x#+width#   
end_y# = y#-height#
end_z# = z#+depth#
 
// determine which object has been hit
object_Hit = ObjectRayCast(objID2,start_x#,start_y#,start_z#,end_x#,end_y#,end_z#)
endfunction object_Hit

if checkcollision4(2,8)=1
deleteobject(8)
resettimer()
playsound(1)
key4=1
key=key+1
endif


You guys probably understand it . I don't although I know how to use it .
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 16, 2019, 12:48:49
I just counted the lines of code for that collision test and it's  even more than I thought. Anyway just looked at it and I understand some of it . But could not and did not write It myself.
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 16, 2019, 16:30:03
Well guys I did learn something today and that is don't check for a collision every frame instead do it every 5 frames or 10 frames and that really speeds things up . Thanks for the tip. Gonna use if else and endif more appropriately too. And that d thing was just spaghetti as you say . Thanks again for all the useful tips . I'm definitely not the best programmer on here I'm probably below par but I still enjoy it and strive to better myself .
  Twelve months ago I hadn't even heard of a height map or texture or mesh so I've come  a long way in a year. I've still got my first program I wrote in AGK2 and that was so crap. I did sort of think it was due to AGK2 at the time but I was wrong my programming skills were terrible ( still are maybe ) but I have improved . Ready to give up on making models from photos the quality is just not there . I'll either have to buy my models or do my best to make them decent . They will be on the simple side though . Anyway enjoy your evening . over and out.
Title: Re: How Many Using Pure Basic
Post by: iWasAdam on November 16, 2019, 17:12:21
Modelling from photos is nasty. My thought there would be to try some very low poly stuff. 3D is not the simplist thing to get your head into...
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 16, 2019, 18:30:50
Yes I think that's it for me as far as models from photos go . The results were useless . Read an article on line and this guy reviewed it and his results were rubbish as well . Oh well at least I've tried it . Back to blender . I guess that's why good models command a good price .
Title: Re: How Many Using Pure Basic
Post by: Hotshot on November 16, 2019, 23:36:36
Quote from: Pfaber11 on November 16, 2019, 10:36:54
Hey Hotshot what is your opinion of purebasic . For me personally I quite like it . And Ron you have to convert the entity into an entity body to check for a collision after this check you have to turn it back into an ordinary entity with freentity and so on .

I like purebasic due that you can produce small file size but what I don't like is unnecessary of using start drawing and stop drawing commands as if you not careful with these commands as could crash the program.

Title: Re: How Many Using Pure Basic
Post by: Derron on November 17, 2019, 07:17:09
QuoteWell guys I did learn something today and that is don't check for a collision every frame instead do it every 5 frames or 10 frames and that really speeds things up . Thanks for the tip.

Who told you that? Hope nobody here did. Skipping collision checks will result in missed collisions. Famous example is the "bullet vs thin wall". This example would expose one problem:
frame 1: bullet is at grid 0,10 and wall is on 3,10
frame 2: bullet is at grid 1,10 and wall is on 3,10
frame 3: bullet is at grid 2,10 and wall is on 3,10
frame 4: bullet is at grid 3,10 and wall is on 3,10
frame 5: bullet is at grid 4,10 and wall is on 3,10

You check frame 1, frame 6, frame 11 ...
Bullet hits the wall in frame 3 - which you skipped.


The real "bullet versus thin wall" is not about missing the wall because you skip frames - but because the bullet moves more than the width of the wall per physics frame. So in one check it is before and in the next it is right after the wall. So the idea is to check also "mini steps" of the units movement. so if bullet moved from "0,10" to "5,10" between two physic frames, the physics simulate the mini steps (1,10 / 2,10 / 3,10 / 4,10) to check for collisions too.


So I would say no to doing collision checks only every Nth physics frame (also assuming you properly split physics from rendering).
to increase performance of collision checks: only check what is in range - or give entities an area/locationID which describes a bigger area of your map. If areas differ or are not neighbours then they wont collide - no need for boundingbox or hull collision checks.



bye
Ron
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 17, 2019, 08:51:47
Yes I see your point Ron can't remember who mentioned not checking for a collision every frame . I think it may have it's uses but not for every situation. As you say bullets and thin walls .
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 17, 2019, 09:02:30
Yes Hotshot it can be a pain but I think the benefits outweigh the negatives . It does all I want and it's fast. Having to initiate everything I suppose that's a bit of a pain too but it only takes a minute so no real hardship.
Title: Re: How Many Using Pure Basic
Post by: MikeHart on November 18, 2019, 11:04:43
@Pfaber1: i am deeply sorry that i jumped at you.
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 18, 2019, 13:23:56
That's ok Mike no harm done . Have a nice day.
Title: Re: How Many Using Pure Basic
Post by: iWasAdam on November 18, 2019, 15:00:04
Quotenot checking for a collision every frame
mmm, error prone as Derron said.
But... If you are having issues with collision and speed (e.g. collide x2 is ok but collide x20 feels slow), it probably points to something amis with the collision routine.
The only way to get around this would be to code your own collision.

in something like a 2d (3d maze is really 2d) maze you should be able to do a couple of hundred collision checks per frame without affecting speed. See above code for simple circle collision.
box/rect collision is the simplist to do. But again the best policy is to only check those things that are closer to you.

Again you will need to learn a bit more code
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 19, 2019, 15:43:30
My mazes really are 3D mazes .  They are made out of height maps . A bit unconventional but they work. Not as good as your stuff though but easy to make .
Title: Re: How Many Using Pure Basic
Post by: iWasAdam on November 19, 2019, 18:04:51
You might think that they are 3D, but that is how they are displayed, internally and logically they are pure 2d. The moment you get a grasp of that, the simpler all you problems will become ;0
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 19, 2019, 21:40:35
Yes I know it's just an allusion but it's pretty damn convincing.
Title: Re: How Many Using Pure Basic
Post by: iWasAdam on November 20, 2019, 05:57:18
Please bear with me on this. I have a very easy question for you:

when you load in your initial bitmap and convert it to a 3d height map (3dmap). Do you use the bitmap to decide the collision or the 3dmap?
Title: Re: How Many Using Pure Basic
Post by: Derron on November 20, 2019, 07:20:14
I assume he uses the 3d model and simply checks if something collides with the object or not ... which is cpu costly, kind of stupid but might somehow work (albeit with issues).


If you want to draw your maps then "just" define a grid width, lay a grid over the image (scale one of them) ... and for each grid you identify what is drawn there (make it black and white - and check if it could represent straight line or corners (by checking splitting the grid in subgrids, and checking if there are vertical _and_ horizontal areas -> corner, or just one of them). That way a hand drawn map could be used to generate simple 2d labyrinth maps.


bye
Ron
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on November 20, 2019, 14:51:19
I do a check for what's in front or behind my object and camera so it stops and doesn't go through the wall. Something like if height map height at cameraz +10 > 50 cameraz = cameraz - 1. That's not exactly right but you get the idea.
No Adam I don't I just check what's in front and instead of going over the height map I just stop and can't go forward. Very simple really . 
Title: Re: How Many Using Pure Basic
Post by: iWasAdam on November 21, 2019, 08:45:55
hmm. I am at a loss to how to help you go further:
1. You realize that your code is not brilliant (see many lines of code verses a few lines of code)
2. you realize that the collide methods are not correct (it is better to skip collision instead of per frame, etc - if many objects need collision the whole thing slows to a crawl)
3. you refuse to widen your method of thinking (E.G. my code works - therefore it is brilliant)
3. you also acknowledge that people here are trying to help
4. but you continue to ignore any help or suggestions
I wish you all the best

Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on January 25, 2020, 12:18:05
I appreciate what you are saying Adam and I do muddle through with my programming . The reason I make my programs is I get some sort of satisfaction out of it . Really wish I had been to college or whatever and learnt to program properly from the start but I didn't and am self taught . Been at this two years and have 10 games under my belt and they have improved no end in that time . I have my own style of programming which is to make it as simple as I can . The one I'm working on now is the best one so far and is way more advanced than my first offerings and am building it in PB , probably gonna be ready in a couple of months all going well. I'm not what I would call thick but I'm not as smart as some of you guys on here but I'm enjoying what I do and I think if I come up with the right idea I may just make something out of this . I have offered my services for free on my website but so far have no takers . I don't get many visitors . Anyway over and out . Enjoy your coding .
Title: Re: How Many Using Pure Basic
Post by: 3DzForMe on January 25, 2020, 16:14:48
@Pfaber11, we're all here for the fun of hobbyist coding, keep having fun creating what you're doing  ;)

I'm all mojod out myself today, have been wallpapering, on the plus side I just saved the he last 2 jam doughnuts from the dog!
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on January 26, 2020, 16:33:53
Yes I'm gonna keep going at it . Nothing quite like releasing a new game on itch.io , I'm actually creating my own terrain and stuff now . Been doing the 3d programming now for a year and have come a long way in that time . Really need to knuckle down and work hard . This year I have set my goal to finish my game I started a couple of months ago and anything else is a bonus . At least I don't think I'll be learning any new languages this year quite content with what I'm working with at the moment . The only compromise is no Mobile compatibility but I'm happy just producing for PC right now. Have a nice day.
Title: Re: How Many Using Pure Basic
Post by: Pfaber11 on February 06, 2020, 01:06:00
I get five jam doughnuts for I think it's 1.15 from my local shop or two Belgian buns for 1.40 makes a nice snack. Haven't had any this week though but will make up for it next chance I get . Not sure how many levels to give my new game I am thinking a minimum of 4 though . Might have it finished in a couple of weeks if everything keeps going smoothly. Backup Backup and Backup almost lost it all earlier and would of been devastated. Still have made significant progress today . Happy coding and good evening .