How Many Using Pure Basic

Started by Pfaber11, November 07, 2019, 13:19:20

Previous topic - Next topic

Steve Elliott

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?
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Qube

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.
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Steve Elliott

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.
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Pfaber11

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.
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

STEVIE G

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   

Derron

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

Pfaber11

#21
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 .
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

Pfaber11

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 .
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

Coder Apprentice

@Pfaber11 C'mon man! Admit it! You just come here to troll.

;D

Pfaber11

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.
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

Coder Apprentice

#25
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. 

Pfaber11

#26
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 .
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

iWasAdam

@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>

Derron

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

iWasAdam

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.