Developing my new game for the scene!

صفحة 42/75
35 | 36 | 37 | 38 | 39 | 40 | 41 | | 43 | 44 | 45 | 46 | 47

بواسطة flyguille

Prophet (3031)

صورة flyguille

29-03-2016, 01:09

hit9918 wrote:

"all is in the objects rack", the problem is always first algorithmic.
a way to avoid registering things in pointerarrays is to fill two pointerarrays on the fly.
in the one paste the addresses of objects of category 1, in the other the addresses of category 2.

say you got 32 objects.
when you couldn't make sub-regions, collision things go 32 * 32 = 1024 loops.
while wanted is M * N loops.
with filling 2 pointerarrays, it is 32 + 32 + M * N loops.

well and when you know one sub-region, that would go N * 32 loops and with one pointerarray it is 32 + N * M loops.

one array gets pasted the addresses of the objects that fit category 1,
the other one the addresses of category 2.
at the end of the arrays paste a 0 pointer.
this saves loop registers in the loops.

well and aside the algorithmic things, generaly things could be written faster. that double ex (sp),hl was extreme.
when all is cut down then the game goes in no time, it's just the blits.

Yes it is the best solution, but 2 regions don't solve the unused object hole. But still a good solution.

The game already has problems with "out of memory" in page3.

The maximun sprite count is 32. The sprite structure is:

Sprite:
	.InUse:				RB 1				; Sprite slot in use.
	.Class:				RB 1				; Logic class. Format: $0000CCCC. Exception $FF = Player character, $FC = Weapon sprite, $FD crushed class, $FE death class.
	.Pattern:			RB 1				; Current sprite pattern.
	.PatternFlip:			RB 1

	.HighHitBoxLeft:		RB 1
	.HighHitBoxWidth:		RB 1				; Width & height is << 3 instead of << 4. For allowing the value 16 to be set.
	.HighHitBoxTop:			RB 1
	.HighHitBoxHeight:		RB 1
	.LowHitBoxLeft:			RB 1
	.LowHitBoxWidth:		RB 1
	.LowHitBoxTop:			RB 1
	.LowHitBoxHeight:		RB 1

	.Live:				RW 1				; Health.

	.MapOy:				RB 1				; Where in the map actually is the sprite.
	.MapTy:				RB 1				; This information is needed for the logic, How the character interacts with the map?.
	.MapOx:				RB 1				; As is a waste of time calculating all the time, map coordinates / screen coordinates, both systems must be maintain.
	.MapTx:				RB 1
	.Bf0ScreenX:			RB 1
	.Bf0ScreenY:			RB 1
	.Bf0ScreenWidth:		RB 1
	.Bf0ScreenHeight:		RB 1
	.Bf1ScreenX:			RB 1
	.Bf1ScreenY:			RB 1
	.Bf1ScreenWidth:		RB 1
	.Bf1ScreenHeight:		RB 1
	.ScreenX:			RB 1				; Where it was drew?, current active buffer.
	.ScreenY:			RB 1
	.ScreenWidth:			RB 1				; Width = 0, not drew.
	.ScreenHeight:			RB 1				; Height = 0, not drew.

	.MapRespawnTy:			RB 1				; From which respawn spot it is?. It is for don't let the respawn spot to create characters as crazy.
	.MapRespawnTx:			RB 1
	.LogicArea:			RB 24				; Used for the logic of the game to store previous behaviour desicions, in order to have a smart action.

	.Reserved:			RB 8				; Used: for maintain a backup of where this character was when entering in a monster room.
	.SizeOf:							; 64 bytes. IF CHANGED adjust "Sprite size formula" at: IACharacters, GetFreeSpriteSlot, SetSprite.

So 64 bytes each one, quite big structure as for duplication this pool in two categories. Impossible to do. IIRC there don't fit 8 sprites more, I tried adding 16 slots and it broke, I didn't test 8, but cerainly, limiting the ammount of boxes and lifts to a maximun of 8 will be very MAP imagination frustrating limitation for doing good puzzles.

Also the game code is already 26K, I don't want to set major changes if possible.

So running a little stream of obj. addresses I thinks is the way to go, it is not like it will save time in each loop, but it will run just the correct ammount of loops and nothing more saving iterations.

بواسطة flyguille

Prophet (3031)

صورة flyguille

29-03-2016, 01:08

hit9918 wrote:

when in the pointerarray you put the addresses of obj.x, then you can load the X without using IX.
the tight loop can go without IX.
then, when one got an X hit, one can calculate obj base address from obj.x and continue with IX.

this idea is so much overhead than the one you want to prevent, because it needs to upgrade now that array in every single movement, code will do pufffffffffffffffffff out of memory in page1 too.

بواسطة MOA

Champion (293)

صورة MOA

29-03-2016, 01:32

[Nitpick mode]

.Live: RW 1 ; Health.

I would rename this to .Life or .Lives.

http://www.tolearnenglish.com/exercises/exercise-english-2/e...
[/Nitpick mode]

بواسطة MOA

Champion (293)

صورة MOA

29-03-2016, 01:49

Do you use the reserved bytes in the structure for anything?

You could use them as table storage for 4 pointers if you don't have enough RAM space and iterate over them like:

ld HL, Sprite.Reserved
ld E,(HL)
inc HL
ld D,(HL)
inc HL
.. do something ..
x Sprite.SizeOfReserved / 2

ld DE, Sprite.SizeOf - Sprite.SizeOfReserved
add HL,DE

ld E,(HL)
inc HL
ld D,(HL)
inc HL
.. do something ..
x Sprite.SizeOfReserved / 2

etc.

(or something like that)

Probably even better to move the .LogicArea to a separate table and get rid of .Reserved (then your sprite will be 32 bytes with a separate .LogicArea table... not sure what it is used for... it will then free up space for some additional 64 byte pointer tables you can use for algorithmic optimizations)

بواسطة flyguille

Prophet (3031)

صورة flyguille

29-03-2016, 02:15

MOA wrote:

Do you use the reserved bytes in the structure for anything?

You could use them as table storage for 4 pointers if you don't have enough RAM space and iterate over them like:

ld HL, Sprite.Reserved
ld E,(HL)
inc HL
ld D,(HL)
inc HL
.. do something ..
x Sprite.SizeOfReserved / 2

ld DE, Sprite.SizeOf - Sprite.SizeOfReserved
add HL,DE

ld E,(HL)
inc HL
ld D,(HL)
inc HL
.. do something ..
x Sprite.SizeOfReserved / 2

etc.

(or something like that)

Probably even better to move the .LogicArea to a separate table and get rid of .Reserved (then your sprite will be 32 bytes with a separate .LogicArea table... not sure what it is used for... it will then free up space for some additional 64 byte pointer tables you can use for algorithmic optimizations)

Logic are is the brain of the character IA. No, can't be separated, include if I want a feature like, one character = using multiple sprites, I would just use the same structure, but indicating bigger width/height and calling a special sprite pattern render routine instead the usual one, indeed the current sprite render routine will be able to draw bigger sprites, if not were for all those micro-improvement shorting test with fixed constants or short algorithms.

I can think about the monster character, but probably I probably will use 4 tailing sprites or so. More sprites structures, more hitboxes that can be attacked, like killing the monster part per part.

And about chaining objects, it really don't save space, idd it increase memory usage. Chaining is normally used in dynamic storage allocation. Not this pool case. Chaining can skip holes, yes, but the same than the pointers stream. And with pointer stream you don't use indirection IX/IY saving ticks, the only dificulty is it uses HL/DE can't be use to pass parameters anymore.

بواسطة hit9918

Prophet (2927)

صورة hit9918

29-03-2016, 02:44

by the way, what is "Sprite.InUse"?
why isn't a check on class ID enough.

بواسطة flyguille

Prophet (3031)

صورة flyguille

29-03-2016, 03:18

Nishi

hit9918 wrote:

by the way, what is "Sprite.InUse"?
why isn't a check on class ID enough.

because CLASS = 0 is valid.

The class number, is a consequence of the extra bits (tile attribute).

When in the map you setup RESPAWN tile as major feature, and then in the parametters bits you has to set the class number (this is when mapping), classes number creatable from the map is classes 0 up to 15..., so the respawn tile is limited to chose any character from 16 classes.

Then there is more classes, weapon clases, them can't be created from the map, but can be created by the behaviour of others characters, like a player launching a secondary weapons.

On top of that is the special class BORN/DEATH/PLAYER, player is the class 255, for fast testing trick.... just INC A jr z, will test if a player, others special classes are 254, 253 etc.

so, a class is not valid if in the range from 32 up to 250. But class 0 is valid.

Ok we can when respawn something do INC A and then .CLASS = A. But, that will missalign numerical assignations for the 16 & 16 classes, so can't be tested simply bit 4 anymore for knowing is a weapon or a character, and a revision of all the code is required.

See how everything has to do with everything?.

BTW class = 0 = lifts, class 1= boxes, so it can be fastly be checked if class<3 then a fucking spacing thing.

We can assign a given class number = it is an empty slot. This will be the way to go, avoinding to use the .InUse property....., but, I don't know, too much work to do revisioning everything, probably a speedup, and the initialization of the pool gets a bit more code.... I will think about this major task.

بواسطة flyguille

Prophet (3031)

صورة flyguille

29-03-2016, 04:01

MOA wrote:

[Nitpick mode]

.Live: RW 1 ; Health.

I would rename this to .Life or .Lives.

http://www.tolearnenglish.com/exercises/exercise-english-2/e...
[/Nitpick mode]

maybe is more suitable "Energy".

بواسطة flyguille

Prophet (3031)

صورة flyguille

29-03-2016, 16:53

renamed to .Energy, remove the double ckeck of .InUse...., and working on implementing the pointers list, routines are done but I needs to check the several ways that a box/lifts can dissapear and upgrade consistently that list. And then to run that list instead of the sprite pool, I don't expect a noticeable speed up but then, all micro-improvements togheter maybe can do the difference.

PD: I am still looking for the musician, by that reason I am reworking code..., making time.

بواسطة flyguille

Prophet (3031)

صورة flyguille

29-03-2016, 16:55

refreshing

flyguille wrote:

For this game, I am looking for to associate with a musician able to make music for it, because I am realistic I have CERO experience & skills doing music, don't matter if finally I understand how to handle and produce a stream, and then how to import it in the game, that is not the problem, the problem is I am not a musician, and this game is so precious to be ruined with newbie attempt to compose.

So, If you thinks you can do good music for this game, I am willing to include you as a partner in the credits.

For the replayer is a whole vdp frame free just for it. It can be Scc or OPL, I don't care. The thing, it must be made for this game.

I expect several streams:

* 4 songs, for the normal gameplay, each time the player pass over a checkpoint in the map it will switch to the next song, so that prevent the player for being bothered with the song repeating again and again. The songs can be themed, one for day, other for night, other for interiors of the castle, other for puzzles/thinking areas.

* 1 songs, for the monster room.

* 1 for the main screen.

* 1 for the end/credits screen, where showing the recue of the princess.

* 1 very short for the game over box.

I really needs to delegate this, I preffer to be focused in coding and mapping & graphics, that trying to do something I don't know about.

صفحة 42/75
35 | 36 | 37 | 38 | 39 | 40 | 41 | | 43 | 44 | 45 | 46 | 47