Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
24 May, 2013, 07:57:01 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1]   Go Down
  Print  
Author Topic: Enemies and objects - How to handle/store enemies and objects  (Read 338 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
chickendude
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Female
Last Login: 21 May, 2013, 19:04:07
Date Registered: 06 September, 2008, 11:27:30
Posts: 435

Topic starter
Total Post Ratings: +66

View Profile
« on: 05 June, 2012, 20:10:20 »
0

Currently what i do is just load a list of enemies when i go to load the map and run through and update the entire list each frame. Really it doesn't take so long and even with maybe 20 enemies the slow-down isn't that noticeable, but i think i will probably just build them into the map so that they are triggered when you reach a certain tile. I'm not sure how large the final levels will be. Anyway it wouldn't be too difficult to do, i've just been lazy and not really sure if there are better ways to do it.

I've also never done enemy routing/paths, will i need to touch any trig? Right now the enemies just kinda fly around and bounce off the walls, which i think is pretty interesting and a little funny even but maybe not so practical for the final game.

I guess it's not really anything i desperately need help with as most of the code's already written, but it'd be fun to talk about something here and hear your ideas (and not just ASM programmers, since i imagine the concept would be basically the same), i learned a lot from the old tilemap discussions over at RevSoft and MC.
Logged
aeTIos
You got stair'd!
LV12 Extreme Poster (Next: 5000)
************
Offline Offline

Gender: Male
Last Login: Today at 07:24:11
Date Registered: 15 September, 2010, 06:00:00
Location: Netherlands, Overijssel
Posts: 3121


Total Post Ratings: +120

View Profile
« Reply #1 on: 05 June, 2012, 20:28:36 »
0

Maybe this could better be moved to a more general forum?
Logged

If something above sounds rude, feel free to vote it down, it was not meant to be rude<<lolol
--Always stay relAXEd!--


Spoiler for Hidden:


[







Spoiler for Still Alive:
This was a triumph.
I'm making a note here: HUGE SUCCESS.
It's hard to overstate my satisfaction.

Aperture Science:
We do what we must because we can.
For the good of all of us
Except the ones who are dead.

But there's no sense crying over every mistake
You just keep on trying till you run out of cake
And the science gets done and you make a neat gun
For the people who are still alive.

I'm not even angry.
I'm being so sincere right now.
Even though you broke my heart and killed me.
And tore me to pieces.
And threw every piece into a fire.
As they burned it hurt because
I was so happy for you.

Now these points of data make a beautiful line
And we're out of beta we're releasing on time.
So I'm GLaD I got burned think of all the things we learned
For the people who are still alive.

Go ahead and leave me.
I think I prefer to stay inside.
Maybe you'll find someone else to help you.
Maybe Black Mesa -
THAT WAS A JOKE. HA HA, FAT CHANCE.
Anyway, this cake is great:
It's so delicious and moist.

Look at me still talking when there's science to do.
When I look out there it makes me GLaD I'm not you.
I've experiments to run there is research to be done
On the people who are still alive

And believe me I am still alive.
I'm doing science and I'm still alive.
I feel FANTASTIC and I'm still alive.
While you're dying I'll be still alive.
And when you're dead I will be still alive.

Still alive
Still alive
LincolnB
Check It Out Now
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: 20 May, 2013, 05:36:22
Date Registered: 02 May, 2011, 00:56:28
Location: Utah Valley
Posts: 1114


Total Post Ratings: +121

View Profile
« Reply #2 on: 05 June, 2012, 22:11:39 »
0

what kind of discussion are you trying to start?
Logged

Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler for Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)


aeTIos
You got stair'd!
LV12 Extreme Poster (Next: 5000)
************
Offline Offline

Gender: Male
Last Login: Today at 07:24:11
Date Registered: 15 September, 2010, 06:00:00
Location: Netherlands, Overijssel
Posts: 3121


Total Post Ratings: +120

View Profile
« Reply #3 on: 05 June, 2012, 22:13:46 »
0

He wants to discuss any ways to code enemies and objects.
Logged

If something above sounds rude, feel free to vote it down, it was not meant to be rude<<lolol
--Always stay relAXEd!--


Spoiler for Hidden:


[







Spoiler for Still Alive:
This was a triumph.
I'm making a note here: HUGE SUCCESS.
It's hard to overstate my satisfaction.

Aperture Science:
We do what we must because we can.
For the good of all of us
Except the ones who are dead.

But there's no sense crying over every mistake
You just keep on trying till you run out of cake
And the science gets done and you make a neat gun
For the people who are still alive.

I'm not even angry.
I'm being so sincere right now.
Even though you broke my heart and killed me.
And tore me to pieces.
And threw every piece into a fire.
As they burned it hurt because
I was so happy for you.

Now these points of data make a beautiful line
And we're out of beta we're releasing on time.
So I'm GLaD I got burned think of all the things we learned
For the people who are still alive.

Go ahead and leave me.
I think I prefer to stay inside.
Maybe you'll find someone else to help you.
Maybe Black Mesa -
THAT WAS A JOKE. HA HA, FAT CHANCE.
Anyway, this cake is great:
It's so delicious and moist.

Look at me still talking when there's science to do.
When I look out there it makes me GLaD I'm not you.
I've experiments to run there is research to be done
On the people who are still alive

And believe me I am still alive.
I'm doing science and I'm still alive.
I feel FANTASTIC and I'm still alive.
While you're dying I'll be still alive.
And when you're dead I will be still alive.

Still alive
Still alive
LincolnB
Check It Out Now
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: 20 May, 2013, 05:36:22
Date Registered: 02 May, 2011, 00:56:28
Location: Utah Valley
Posts: 1114


Total Post Ratings: +121

View Profile
« Reply #4 on: 05 June, 2012, 22:17:04 »
0

Personally, I have a set of subroutines like CreateEnemy(), KillEnemy() which add to/subtract from the list of enemies (stored in free ram wherever), and some stuff with MoveEnemy, SimEnemies(), which runs through the list and moves the enemies however I defined it. And collisions and whatnot
Logged

Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler for Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)


chickendude
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Female
Last Login: 21 May, 2013, 19:04:07
Date Registered: 06 September, 2008, 11:27:30
Posts: 435

Topic starter
Total Post Ratings: +66

View Profile
« Reply #5 on: 06 June, 2012, 07:21:04 »
0

Well, right now i've got my data set up like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
;ENEMY EQUATES (pour utiliser avec ix)
MECHANT_SPRITE = 0
MECHANT_X = 1
MECHANT_XOFF = 2
MECHANT_Y = 3
MECHANT_YOFF = 4
MECHANT_XVEL = 5
MECHANT_YVEL = 6
MECHANT_HP = 7

MECHANT_SIZE = 8
liste_de_mechants:
; .db # sprite, mechantX, mechantXOff, mechantY, mechantYOff, xVel, yVel, HP
; m1 S X XO Y YO XV YV HP
.db $5, 12, 0, 7, 0, 0, 0, 1
; m2
.db $0, 6, 2, 4, 0, -1, 1, 1
; m3
.db $0, 4, 3, 3, 1, -3, 1, 1 ; carré
; m4
.db $4, 7, 4, 4, 1, -1, -1, 1 ; sorte d'oeil
; m5
.db $0, 6, 5, 4, 4, 0, 2, 5
nombreMechants:
.db 5
...and modify those values each frame. I realize that if i add in a lot of enemies later on, loading them all at once will slow the game down quite a bit (though it'd have to be a LOT of enemies). When an enemy is killed, i just shift all enemies below it up one. Basically, i'm curious how you store and process your data, for example whether it's worthwhile to keep track of offscreen enemies or remove them from the list. I think giving the map the ability to create (spawn) enemies would make the map routine much more powerful would give you code to easily reuse in other places, for example if you want a boss to be able to toss out enemies at you or something.
Logged
tr1p1ea
LV6 Super Member (Next: 500)
******
Offline Offline

Last Login: Yesterday at 22:47:49
Date Registered: 27 August, 2008, 07:52:13
Posts: 349


Total Post Ratings: +55

View Profile
« Reply #6 on: 14 June, 2012, 11:10:28 »
0

If you move around in your game screen-by-screen then you could possibly think about having another list that simply hold the 'index' of any onscreen objects in your list.

Apart from that you could look at some 'early exit' techniques for ignoring offscreen objects when looping through?
Logged
chickendude
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Female
Last Login: 21 May, 2013, 19:04:07
Date Registered: 06 September, 2008, 11:27:30
Posts: 435

Topic starter
Total Post Ratings: +66

View Profile
« Reply #7 on: 14 June, 2012, 12:22:50 »
0

Well, when a level is loaded the entire level is loaded. I could set a certain distance to remove (delete) an object from the list, as i've never really liked resetting enemies back to their original positions when they go offscreen. I remember you talking to me about how you had objects and enemies set up in Super Mario a couple years back, maybe over at RevSoft?
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.252 seconds with 30 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.