Increase the Sprite and Image Object limit. Sounds strange?

For everything that's not in any way related to PureBasic. General chat etc...
User avatar
takis76
Enthusiast
Enthusiast
Posts: 143
Joined: Tue Aug 30, 2011 1:31 pm
Location: Athens - Greece

Increase the Sprite and Image Object limit. Sounds strange?

Post by takis76 »

Is it possible to increase the number of images and sprites objects?

The compiler tells me the limit of the Images are up to 100000 and of sprites are up to 1000000.

You will say now , what do you need so many images.

The fact is , I need them , I need the number as object indicator.

For example , in (DarkBasic again) sorry if I compare the DarkBasic with PureBasic , but I am creating one game with darkbasic and I made this crash test here.
I am creating one dungeon crawler game and I am planning to create it with this programming language.

If we assume , we have wall graphics as images or sprites , I will use them as sprites here , because images are not able to be transparent as I discover.

If I assume I have 23 different possitions as wall graphics I should need 23 different sprite objects , but these 23 different wall graphics are only wall graphics positions , if these 23 wall graphics for example are brick wall graphics and I want to have and nother kind of dungeon wall graphics , for example if I will have 99 more kinds of dungeon graphics (or wall texture graphics) I will need another 99 sprite objects.

But I select my sprites not as 23+99=122 , I select with different way , because I have created a complete engine and works perfect in darkbasic :oops: .

For example if I say the texture graphic of my castle graphics of my walls of my game is 01 and I have 23 different positions as walls sprite positions:

Code: Select all

01=Castle 01=wall position
0101
0102
0103
.
.
.
0123
But I add another one digit in front of the 0101 to categorize my game elements for example 1 are my wall elements so in my game I tell to my game engine 1 is my wall element 01 to 99 are different environment graphics (01=castle 02=dungeons 03=mines 04=underworld 05=blah blah 99=forest) and I add another sub category fro 01 to 99 for wall items (01=the wall have a keylock on 02=the wall have button on)

So the category (1=walls) + (01 to 99=wallset or wall graphic environment) + (01 to 99 for wall graphic object some button or some tapestry) + (01 to 23) the position of wall sprite
creates this sprite object 1999923 I exceed the 1000000 sprites limit.

But is not finish there if the category is 2 , inventory items and the category is 3 monsters and category is 4 spells then I need at least 4000000 sprite objects and images.

Here there is a problem. Is it possible the next version 4.60 have higher limit of Image object and sprite objects. (DarkBasic have 11.000.000)

1=wall category , 01-99=wallset or wall graphic (Brick , Marble , Forest , Dungeons etc), 01-99=wall object as lever on the wall , or button on the wall , or keylock on the wall and 01-23=wall positions and some times there are and animated graphics , like some torch burning on the wall or some static object like fire pedestal I need another one digit from 1 to 9 for at least 9 frames of animation.

10101019

I colored each of the digits with specific color to show you , that there are cases , that all of these 10.000.000 million of sprites are needed.

So this is and the future request for the next version 4.60 , it sounds crazy , but with DarkBasic was happened.

How was your biggest program? 10000 lines of code? 100000 lines of code? or even more than 300000 lines of code , strange things happens here :P , really what are the source code limits , not in the demo , in demo I know is 800 lines , what are the limits of the licensed(complete) version of Pure basic , because I am planning to crash it and test all the limits.

Look what I have created in DarkBasic and I would like to create the same here:

Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image

Is time to test all PureBasic Limits now.
Last edited by takis76 on Sun Sep 04, 2011 1:52 am, edited 1 time in total.
User avatar
Derren
Enthusiast
Enthusiast
Posts: 318
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Re: Increase the Sprite and Image Object limit. Sounds stran

Post by Derren »

Dont use numbers, use constants or use a map.

Code: Select all

Enumeration
#Wall_Brick_Lever
#Wall_Stone_Torch
EndEnumeration

Code: Select all

NewMap sprites.i()
sprites("10101019") = LoadSprite(#PB_Any, "10101019.jpg")
User avatar
J. Baker
Addict
Addict
Posts: 2192
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Increase the Sprite and Image Object limit. Sounds stran

Post by J. Baker »

I think you just need to come up with a better method. Back when I was creating a program to blur images, I just loaded in groups at a time. Then freed them and loaded the next group. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
User avatar
takis76
Enthusiast
Enthusiast
Posts: 143
Joined: Tue Aug 30, 2011 1:31 pm
Location: Athens - Greece

Re: Increase the Sprite and Image Object limit. Sounds stran

Post by takis76 »

For example this code use to put the wall in front of the player is the wall position 04:

Code: Select all

    `WALL 04 =========================================================================================
    Wall_temp=Levels(party.level,party.x+1,party.y,4)
    if Levels(party.level,party.x+1,party.y,4)<>"00"
        if Levels(party.level,party.x+1,party.y,4)=Wall_temp
        Wall_String="1"
        Wall_String=Wall_String+Wallset+Wall_temp+"04": paste image val(Wall_String),62,30,1 `wall 04
        endif
    endif
    `==================================================================================
Wall_temp is one string in pure basic is like wall_temp.s
the array Levels(10,54,54,4) is my array which holds all levels of my game 54x54 with 4 side walls.

Code: Select all

if Levels(party.level,party.x+1,party.y,4)<>"00" ;=> here I am cheching if the square in front of the player is not empty.
The I check

Code: Select all

 if Levels(party.level,party.x+1,party.y,4)=Wall_temp
If the square in front is equals to something from the array Levels
If is something then I am in category 1 walls

Wall_String="1" ;=> is some variable string variable in pure basic is like wall_string.s="1"

This string variable populates everything I want to create my sprite unique number

Code: Select all

Wall_String=Wall_String+Wallset+Wall_temp+"04": paste image val(Wall_String),62,30,1 
the category is 1=walls, the wallset on current level is 02=dungeons
The walltemp takes something from the Levels array , my game map , what is in front , button? , lever?

And the "04" is the wall position.

So I generated this wall_string="1023304" and then change the string to variable and put my image number 1023304 on my screen but purebasic have limits now up to 1.000.000 sprites and only 100.000 images. PROBLEMMMMM
How do I translate this easier to Purebasic?
And something esle if I want to make transparent some sprite in pure basic I use this code:

Code: Select all

LoadImage(99999,"C:\Eob4 PB editor\Background.bmp")
LoadSprite(100,"C:\Eob4 PB editor\Background.bmp",0)
LoadSprite(1000000,"C:\Eob4 PB editor\Hand.bmp",0)


    TransparentSpriteColor(100, RGB(255,0,255))
    TransparentSpriteColor(1000000, RGB(255,0,255))
Do I need to change the transparent color for each sprite individually? is there any way to change some global transparent color for all sprites in generic?
User avatar
STARGÅTE
Addict
Addict
Posts: 2260
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Increase the Sprite and Image Object limit. Sounds stran

Post by STARGÅTE »

use TransparentSpriteColor(#PB_Default, RGB(255,0,255)) before you load any Sprites.
that all of these 10.000.000 million of sprites are needed.
no, you don't need!
you will use 10.000.000 indices for Sprites, but it needs ~ 40MB ! only to save the index (not the sprite itself)!!!

If you want to do this, oke, then use your own Array:

Code: Select all

Dim Sprite.i(10000000)
Sprite(3456734) = LoadSprite(#PB_Any, ...)
But if you have been working with these "agents", you have built your code / project false, sry
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
takis76
Enthusiast
Enthusiast
Posts: 143
Joined: Tue Aug 30, 2011 1:31 pm
Location: Athens - Greece

Re: Increase the Sprite and Image Object limit. Sounds stran

Post by takis76 »

But if you have been working with these "agents", you have built your code / project false, sry
My code and my project wasn't false , I was programming with different programming language. :)

As I see this language have different abilities.
Dim Sprite.i(10000000)
Sprite(3456734) = LoadSprite(#PB_Any, ...)
Is it possible to load an image in an array? and in integer array?
User avatar
Kuron
Addict
Addict
Posts: 1626
Joined: Sat Oct 17, 2009 10:51 pm
Location: Pacific Northwest

Re: Increase the Sprite and Image Object limit. Sounds stran

Post by Kuron »

BTW, your screen shots above are awesome!
Best wishes to the PB community. Thank you for the memories. ♥️
PMV
Enthusiast
Enthusiast
Posts: 727
Joined: Sat Feb 24, 2007 3:15 pm
Location: Germany

Re: Increase the Sprite and Image Object limit. Sounds stran

Post by PMV »

You can load unlimited number of objects. The only limit you
have in PB is the computer hardware.

The limit you really reached is the limit of the internal indices.
If you use constants to access an object, it is stored inside of an array.
And it makes no sense, to dim an array of 1.000.000, if you only use
1.000 of that. And thats, why this limit exists. It is a check for beginners.
You need to think about your concept. How to save the objects in a
better way with no/ less waste.

#PB_Any is a replacemend of that internal array. You will get
a unique number of the object you have created. So you can
store this number at any place you want. Array, Map, List, Structure, ...


And btw. there is no limit of lines for code in PB ... why should that be? :lol:
The only thing i have read about this is, that there could be problems, when
a single file gets bigger then 10k lines of code. But that is no problem,
because you can split code into several includefiles. And i think, there should
be never one big file with so many lines of code.

MFG PMV
Last edited by PMV on Sun Sep 04, 2011 3:52 pm, edited 1 time in total.
User avatar
takis76
Enthusiast
Enthusiast
Posts: 143
Joined: Tue Aug 30, 2011 1:31 pm
Location: Athens - Greece

Re: Increase the Sprite and Image Object limit. Sounds stran

Post by takis76 »

I have one , more than 35000 lines.
Does the Purebasic have limits in a single source code file up to 10000? :(
User avatar
STARGÅTE
Addict
Addict
Posts: 2260
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Increase the Sprite and Image Object limit. Sounds stran

Post by STARGÅTE »

one file with more than 35k lines ?
STARGÅTE wrote:you have built your code / project false, sry
you can use: inlude, loops, procedures, macros to make your code smaler!

takis76 wrote:Does the Purebasic have limits in a single source code file up to 10000?
No.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
takis76
Enthusiast
Enthusiast
Posts: 143
Joined: Tue Aug 30, 2011 1:31 pm
Location: Athens - Greece

Re: Increase the Sprite and Image Object limit. Sounds stran

Post by takis76 »

Now you made my day. :mrgreen:

I used to use many smaller source code files , but when I had errors , the DarkBasic compiler didn't produce the correct line when my error was.

For example if I had 10 smaller files with 1000 lines each and I had some error in line 5 in the 3rd file , the compiler told you have error in line 3005 , but the error wasn't in line 3005 but in line 5 of the third file.

And if your source code files wasn't fixed lines as 1000 or 2000 and you had 50 small files and the random lines of code

1st had 23050 lines
2nd had 1244 lines
3rd had 32454 lines
4th had 230 lines
.
.
50th had 45067 lines

And you have somewere in your 4th file some error and your compiler told you you have error in line 55320 , but your 4th file have only 230 line , how to find your error?
So I desided to put everything in one Huge file , and when I have error in 55320 line , the compiler and IDE direct me in the correct line number.
In fact the compiler was add all files and calculated the error , but sometimes there where errors which was related of some line of code for example some endif missing , in this case , you had PARSER ERROR or Command out of place in the last line of the specific source code file , but you didn't know where the missing endif really was , and you need to dubug whole code line by line.
If you had one source code file with 24235 lines and somewhere in 4231 line you had "endif" missing the IDE directs you to the line 24235 the last line and was impossible to find where your missing endif was. Sometimes I delete my whole game , because I was lost and I couldn't able to find when my missing endif was.

But as I saw the new PureBasic IDE and compiler , reports the error line numbers correct even if I have multiple smaller source code files and I am very happy for this. :mrgreen:

I am making and this test. My only problem is I need to learn whole language from the beginning and I will spend 1 year until reach one good level of knowledge (The famous learning curve) to start making some more serious game or make my game with this language.

And might I will learn to program much better now.

Hey STARGATE , my portal vortex travel sequence in my game is from STARGATE :) I will dedicate my portals to you :)

http://www.youtube.com/watch?v=Jbu7CoOg14w
User avatar
kenmo
Addict
Addict
Posts: 2054
Joined: Tue Dec 23, 2003 3:54 am

Re: Increase the Sprite and Image Object limit. Sounds stran

Post by kenmo »

Hi takis,

Your game looks great! I'd be happy to see this ported to PureBasic.

I am a former DarkBasic user who switched to PB probably 8 years ago now (around the time they released DB Pro). DB is (was?) very graphics-focused -- very quick to get a 2D or 3D game engine started -- but weak in other areas. PB attracted me with its small executables, fast speed, cross-platform compilers, tidy editor, clean code syntax, and many (beyond games) function libraries. PB's only disadvantage is probably less 3D features (although cross-platform?) but it improves with every couple versions.

Anyway, I agree with the others that you should adapt your sprite indexing method. For example:

Code: Select all

    `WALL 04 =========================================================================================
    Wall_temp=Levels(party.level,party.x+1,party.y,4)
    if Levels(party.level,party.x+1,party.y,4)<>"00"
        if Levels(party.level,party.x+1,party.y,4)=Wall_temp
        Wall_String="1"
        Wall_String=Wall_String+Wallset+Wall_temp+"04": paste image val(Wall_String),62,30,1 `wall 04
        endif
    endif
    `==================================================================================
You create a large index string here, then you display that sprite ID, paste image val(Wall_String), ...

It would be better to load your images sequentially beforehand (IDs from 0 to 50 or whatever), then create a large array/list/map/etc. of integers which tell which sprite ID to draw at each wall location, such as paste image WallID(val(Wall_String)), ... (pseudocode, where the values of WallID() are the loaded sprite IDs, 0 to 50, etc.)

Furthermore, you don't really need to create a wall ID as a string then convert to integer, you can just bypass all that with a multidimensional array, paste image WallID(Wallset, Wall_temp, 4), ... or similar.

I forget how DarkBasic's sprite functions work, but I sure hope that they aren't truly loading the same exact sprites into memory thousands of times, just to have different indexes!
Zach
Addict
Addict
Posts: 1677
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: Increase the Sprite and Image Object limit. Sounds stran

Post by Zach »

I just wanted to say, I also like your screen shots.

I wish I could do graphics like that, I would love to make a game similar to that one day 8)
User avatar
takis76
Enthusiast
Enthusiast
Posts: 143
Joined: Tue Aug 30, 2011 1:31 pm
Location: Athens - Greece

Re: Increase the Sprite and Image Object limit. Sounds stran

Post by takis76 »

I will help you to make a game like that.
User avatar
takis76
Enthusiast
Enthusiast
Posts: 143
Joined: Tue Aug 30, 2011 1:31 pm
Location: Athens - Greece

Re: Increase the Sprite and Image Object limit. Sounds stran

Post by takis76 »

I used this code:

Code: Select all

    all_sprites(1020001)=CatchSprite(#PB_Any,VBin_("Wallset02.eob","Backdrop02a.bmp"))
    DisplaySprite(all_sprites(1020001),14,14)
The number 1020001 is the category 1 walls , wallset 02 and the others are 0001 for my backdrop.
With this number will know my graphic index (1=category 02=wallset 99=wall graphics 23=wall possitions)
all_sprites(1029923) it looks very interesting.

And it worked , I thing , I broke the limit of only 1.000.000 sprites and I am very happy.
In fact I didn't broke the 1.000.000 because I use #PB_any , but the index I want is more than 1.000.000
I want only the index , so might this problem is solved. :mrgreen:

Now I will try create all wall engine to implement the idea. :D
Post Reply