Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Constructive advice? In MY /prog/??!

Name: anon4help !!SMc+oRp3hlfrttZ 2011-02-27 3:36

Hey /prog/. I'm making a game engine.

I'm using C++ as my main language, maybe with a bit of LUA.
My goal is to make a simple verticle shooter, but with complex bullet patterns and smart enemies as entities.
If any of you played Touhou, you've got a pretty good idea.
I'm using DirectX as my main graphics and sound implementation, and everything was pretty easy so far.

But the problem lies with the actual management of making the game itself. I have two problems.

The first is, implementing yielding. I tried a Shmup maker with C-like syntax called 'Danmakufu', and it had some pretty clever design, but not enough power. Anyway, it had a cool little feature called "yield", in which it suspends a 'task' created by you, the scripter. See, the objects are already pre-made withing structs, and all I had to do was simply define how they behaved in a structure. A mainLoop for each object is run every frame, and a seperate thread called "Initialize" is run once throughout the per lifetime of the object(s). Most of the time, I'd put tasks up in Initialize, and put in yields to synchronize things like motions and bullet fire the entire script. What yield does, is delay everything within that thread, below that yield, for one frame. It looks like it works by giving up the thread's timeslice for the rest of that frame, and exists the thread. Now, using a return function in windows essentially does the same thing, except when you use the return function, the thread's scope is destroyed and we cannot re-enter it from where we left off like yield does in Danmakufu.

And that's where I have my problem.
My second problem, is how would I go about properly giving objects a behavior, an artificial inteligence? Since my entities are objects, they inherit things like XY coordinates on the screen, textures, vertices, direction, all that stuff. But setting all of those is as easy as passing a few arguments in parameters. EntityObject[indexnum].xpos=40 would easily set the X value to 40 for the object with the vale of indexnum. Passing behaviors isn't as easy, because I'd want to pass multiple functions to it. The most efficient way I can think of solving it is by passing a pointer to a text document in which has all the functions written out already. EntityObject.pointertoTextforBehav="behavior.txt", in which behavior.txt would have things written in it like {EntitySetX(50); yield(50);-wait 50 frames ShootCurtainFire();-done after the waiting


so what would be the best way about solving this sort of thing?

Name: Anonymous 2011-02-27 4:09

$ sbcl
This is SBCL 1.0.40.0.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>;.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (defun op-is-a-fag () 'op-is-a-fag)
OP-IS-A-FAG
* (compile 'op-is-a-fag)
OP-IS-A-FAG
NIL
NIL
* (disassemble 'op-is-a-fag)
; disassembly for OP-IS-A-FAG
; 0AADBAE6:       8B15B8BAAD0A     MOV EDX, [#xAADBAB8]       ; 'OP-IS-A-FAG
                                                              ; no-arg-parsing entry point
;       EC:       8BE5             MOV ESP, EBP
;       EE:       F8               CLC
;       EF:       5D               POP EBP
;       F0:       C3               RET
;       F1:       CC0A             BREAK 10                   ; error trap
;       F3:       02               BYTE #X02
;       F4:       18               BYTE #X18                  ; INVALID-ARG-COUNT-ERROR
;       F5:       4F               BYTE #X4F                  ; ECX
NIL
*

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List